Dark Knight Posted September 7, 2009 Author Share Posted September 7, 2009 Hey guys, I'm a bit of a noob at Eclipse. But I was wondering, how do I get this code to work? **I went out on the edge here and tried to code this myself.** - So please correct me on this code.**What is the purpose of this code?**I want this code to give people points when you do: **/givep playername** **Where is the code located?**The bottom of Main.txtCode:``` Case "/givep" PlayerID = FindPlayer(TextSay(1)) If GetPlayerAccess(Index) > 0 Then Call PlayerMsg(Index, "You don't have enough rights to do this command!", RED) Else If SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 5) End Case``` Link to comment Share on other sites More sharing options...
Mellowz Posted September 7, 2009 Share Posted September 7, 2009 ```Case "/givep" PlayerID = FindPlayer(TextSay(1)) If GetPlayerAccess(Index) = 0 Then Call PlayerMsg(Index, "You don't have enough rights to do this command!", RED) Else Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 5) End If``` Link to comment Share on other sites More sharing options...
Dark Knight Posted September 7, 2009 Author Share Posted September 7, 2009 @Mellowz:> ```> Case "/givep"> PlayerID = FindPlayer(TextSay(1))> If GetPlayerAccess(Index) = 0 Then> Call PlayerMsg(Index, "You don't have enough rights to do this command!", RED)> Else> Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 5)> End If> > ```Doesn't work. Link to comment Share on other sites More sharing options...
balliztik1 Posted September 7, 2009 Share Posted September 7, 2009 This doesn't go at the bottom. It goes in the Commands sub. You'll see other /commands there, as well. Link to comment Share on other sites More sharing options...
Dark Knight Posted September 7, 2009 Author Share Posted September 7, 2009 Oh, thanks to both of you! :cheesy: Link to comment Share on other sites More sharing options...
Dark Knight Posted September 7, 2009 Author Share Posted September 7, 2009 Wait, it isn't working. Do I have it in the right place?Edit: Keeps saying it's an Invalid Command now.' Executed whenever a slash command is sent to the server.Sub Commands(Index)Dim TextSayDim PlayerIDDim MapNum' Get the command and arguments from the cache.TextSay = Trim(GetVar("Scripts\Command.ini", "TEMP", "Text" & Index))' Split the command into an array. All arguments are seperated by spaces.TextSay = Split(TextSay)Select Case TextSay(0)Case "/testscripts"Call TestMain(Index)Exit SubCase "/help"Call PlayerMsg(Index, "Social Commands:", WHITE)Call PlayerMsg(Index, "'msghere = Broadcast Message", WHITE)Call PlayerMsg(Index, "-msghere = Emote Message", WHITE)Call PlayerMsg(Index, "!namehere msghere = Player Message", WHITE)Call PlayerMsg(Index, "Available Commands: /help, /info, /who, /fps, /inv, /stats, /train, /party, /join, /leave, /refresh", WHITE)Exit SubCase "/calladmins"If GetPlayerAccess(Index) = 0 ThenCall AdminMsg(GetPlayerName(Index) & " needs your help!", BRIGHTGREEN)ElseCall PlayerMsg(Index, "You are an admin! You cannot call for help!", BRIGHTGREEN)End IfExit SubCase "/admin"If GetPlayerAccess(Index) > 0 ThenCall PlayerMsg(Index, "Social Commands:", WHITE)Call PlayerMsg(Index, """msghere = Global Admin Message", WHITE)Call PlayerMsg(Index, "=msghere = Private Admin Message", WHITE)Call PlayerMsg(Index, "Available Commands: /admin, /loc, /mapeditor, /warpmeto, /warptome, /warpto, /setsprite, /mapreport, /kick, /ban, /edititem, /respawn, /editnpc, /motd, /editshop, /ban, /editspell", WHITE)End IfExit SubCase "/warpmeto"If GetPlayerAccess(Index) > 0 ThenPlayerID = FindPlayer(TextSay(1))If PlayerID > 0 ThenCall PlayerWarp(Index, GetPlayerMap(PlayerID), GetPlayerX(PlayerID), GetPlayerY(PlayerID))Call PlayerMsg(Index, "You have been warped to " & GetPlayerName(PlayerID) & ".", BROWN)ElseCall PlayerMsg(Index, "Player is not online.", WHITE)End IfEnd IfExit SubCase "/warptome"If GetPlayerAccess(Index) > 0 ThenPlayerID = FindPlayer(TextSay(1))If PlayerID > 0 ThenCall PlayerWarp(PlayerID, GetPlayerMap(Index), GetPlayerX(Index), GetPlayerY(Index))Call PlayerMsg(PlayerID, "You have been warped to " & GetPlayerName(Index) & ".", BROWN)ElseCall PlayerMsg(Index, "Player is not online.", WHITE)End IfEnd IfExit SubCase "/warpto"If GetPlayerAccess(Index) > 0 ThenMapNum = TextSay(1)If MapNum > 0 And MapNum <= MAX_MAPS ThenCall PlayerWarp(Index, MapNum, GetPlayerX(Index), GetPlayerY(Index))Call PlayerMsg(Index, "You have been warped to map #" & MapNum & ".", BRIGHTBLUE)ElseCall PlayerMsg(Index, "Invalid map number.", BRIGHTRED)End IfEnd IfExit Sub Case "/givep" PlayerID = FindPlayer(TextSay(1)) If GetPlayerAccess(Index) = 0 Then Call PlayerMsg(Index, "You don't have enough rights to do this command!", RED) Else Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 5) End IfEnd SelectCall PlayerMsg(Index, "That is not a valid command.", BRIGHTRED)End Sub Link to comment Share on other sites More sharing options...
Dark Knight Posted September 7, 2009 Author Share Posted September 7, 2009 Anyone? Link to comment Share on other sites More sharing options...
Kimimaru Posted September 7, 2009 Share Posted September 7, 2009 Are you sure you've reloaded your scripts and/or restarted the Server? Link to comment Share on other sites More sharing options...
Sigait Posted September 7, 2009 Share Posted September 7, 2009 You should add ExitsubCase "/givep" PlayerID = FindPlayer(TextSay(1)) If GetPlayerAccess(Index) = 0 Then Call PlayerMsg(Index, "You don't have enough rights to do this command!", RED) Else Call SetPlayerPOINTS(Index, GetPlayerPOINTS(Index) + 5) End IfExit SubSigait. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now