Ertzel Posted September 17, 2009 Author Share Posted September 17, 2009 I can't seem to get this /jail command to work. I have it in the right spots and everything, but each time I do the command /jail player (and put in the players name) all it says is…The command is /jail playerThis is what the code looks like…``` Case "/jail" If GetPlayerAccess(Index) > 0 Then If LBound(TextSay) > 0 Then Dim Target Target = FindPlayer(TextSay(1)) If Target > 0 Then Call PlayerWarp(Target, 16, 16, 14) Call PlayerMsg(Target, "You have been jailed!", BRIGHTGREEN) Call PlayerMsg(Index, GetPlayerName(Target) & " has been jailed!", BRIGHTGREEN) Else Call PlayerMsg(Index, "The player " & TextSay(1) & " is either offline or doesn't exist.", BRIGHTRED) End If Else Call PlayerMsg(Index, "The command is /jail player", BRIGHTRED) End If End If Exit Sub End Select``` Link to comment Share on other sites More sharing options...
JayT Posted September 17, 2009 Share Posted September 17, 2009 put a "Exit Sub" at the end that may be your problem, my sadscript checker didnt find any probsEdit: my bad, didnt sroll down sorry Link to comment Share on other sites More sharing options...
Ertzel Posted September 17, 2009 Author Share Posted September 17, 2009 I know, I can't find the problem in it but it just wont work >.< Link to comment Share on other sites More sharing options...
Kite Posted September 17, 2009 Share Posted September 17, 2009 Don't Dim Target in the command, dim it where the rest are at.Sub Commands(Index)Dim TextSayDim PlayerIDDim MapNumThats at the top of the commands.Try that and let me know.EDIT: PlayerID is dim as that, so replace target with PlayerID insteadIf that still fails try mine, it works perfect for me.```Case "/jail" If GetPlayerAccess(Index) > 0 Then PlayerID = FindPlayer(TextSay(1)) If PlayerID > 0 Then Call PlayerWarp(PlayerID, 90, 15, 4) Call PlayerMsg(index, "You have been jailed!", BRIGHTGREEN) Call PlayerMsg(Index, GetPlayerName(PlayerID) & " has been jailed!", BRIGHTGREEN) End If Else Call PlayerMsg(Index, "Player is not online.", WHITE) End If Exit Sub``` Link to comment Share on other sites More sharing options...
Ertzel Posted September 17, 2009 Author Share Posted September 17, 2009 Woot thanks, yours works great! Link to comment Share on other sites More sharing options...
Kite Posted September 17, 2009 Share Posted September 17, 2009 Your welcome, glad I could help. :) Link to comment Share on other sites More sharing options...
Greendude120 Posted September 17, 2009 Share Posted September 17, 2009 WOw dude u got that from the other topic i posted its exactly the same: http://www.touchofdeathforums.com/smf/index.php/topic,51540.msg541477.html#msg541477 Link to comment Share on other sites More sharing options...
mrdani Posted September 17, 2009 Share Posted September 17, 2009 Well, he never claimed it to be his script, so i guess its alright. He could've posted on the topic but its not a sin to make a new topic, or is it? Link to comment Share on other sites More sharing options...
Kite Posted September 17, 2009 Share Posted September 17, 2009 No, I scripted that myself :(I have had that for ages, I don't steal, nor do I use other peoples stuff.I try and make my own when I can. Link to comment Share on other sites More sharing options...
Greendude120 Posted September 18, 2009 Share Posted September 18, 2009 @mrdani : he said "use mine" so i made an assumpton, either way he just said he made it@kratos aurion: what are the chances they are exactly identical (even the player msg)… w/e Link to comment Share on other sites More sharing options...
Godlord Posted September 18, 2009 Share Posted September 18, 2009 ```Case "/jail" If GetPlayerAccess(Index) < 1 Then Call PlayerMsg(Index, "You don't have the appropriate access level.", BRIGHTRED) Exit Sub End If If UBound(TextSay) < 1 Then Call PlayerMsg(Index, "The command is: " & TextSay(0) & " name", WHITE) Exit Sub End If PlayerID = FindPlayer(TextSay(1)) If PlayerID < 1 Then Call PlayerMsg(Index, "The player doesn't exist or is offline.", BRIGHTRED) Exit Sub End If Call PlayerWarp(PlayerID, 90, 15, 4) Call PlayerMsg(Index, "You have been jailed!", BRIGHTGREEN) Call PlayerMsg(Index, GetPlayerName(PlayerID) & " has been jailed!", BRIGHTGREEN) Exit Sub```I still don't get why people don't use UBound or inverse if-checks :icon_nif:.Regards, Godlord. Link to comment Share on other sites More sharing options...
DarkSpine Posted September 18, 2009 Share Posted September 18, 2009 @Godlord:> ```> Case "/jail"> If GetPlayerAccess(Index) < 1 Then> Call PlayerMsg(Index, "You don't have the appropriate access level.", BRIGHTRED)> > Exit Sub> End If> > If UBound(TextSay) < 1 Then> Call PlayerMsg(Index, "The command is: " & TextSay(0) & " name", WHITE)> > Exit Sub> End If> > PlayerID = FindPlayer(TextSay(1))> > If PlayerID < 1 Then> Call PlayerMsg(Index, "The player doesn't exist or is offline.", BRIGHTRED)> > Exit Sub> End If> > Call PlayerWarp(PlayerID, 90, 15, 4)> Call PlayerMsg(Index, "You have been jailed!", BRIGHTGREEN)> Call PlayerMsg(Index, GetPlayerName(PlayerID) & " has been jailed!", BRIGHTGREEN)> > Exit Sub> ```> I still don't get why people don't use UBound or inverse if-checks :icon_nif:.> > Regards,> Godlord.Actually wouldn't it be-```Case "/jail" If GetPlayerAccess(Index) < 1 Then Call PlayerMsg(Index, "You don't have the appropriate access level.", BRIGHTRED) Exit Sub End If If UBound(TextSay) < 1 Then Call PlayerMsg(Index, "The command is: " & TextSay(0) & " name", WHITE) Exit Sub End If PlayerID = FindPlayer(TextSay(1)) If PlayerID < 1 Then Call PlayerMsg(Index, "The player doesn't exist or is offline.", BRIGHTRED) Exit Sub End If Call PlayerWarp(PlayerID, 90, 15, 4) Call PlayerMsg(PlayerID, "You have been jailed!", BRIGHTGREEN) Call PlayerMsg(Index, GetPlayerName(PlayerID) & " has been jailed!", BRIGHTGREEN) Exit Sub```(Replaced where it said "Call PlayerMsg(Index, "You have been jailed!", BRIGHTGREEN)")Right? Link to comment Share on other sites More sharing options...
Kimimaru Posted September 18, 2009 Share Posted September 18, 2009 Yeah, that looks right to me. Link to comment Share on other sites More sharing options...
Godlord Posted September 18, 2009 Share Posted September 18, 2009 @Spechno:> Actually wouldn't it be-> ```> Case "/jail"> If GetPlayerAccess(Index) < 1 Then> Call PlayerMsg(Index, "You don't have the appropriate access level.", BRIGHTRED)> > Exit Sub> End If> > If UBound(TextSay) < 1 Then> Call PlayerMsg(Index, "The command is: " & TextSay(0) & " name", WHITE)> > Exit Sub> End If> > PlayerID = FindPlayer(TextSay(1))> > If PlayerID < 1 Then> Call PlayerMsg(Index, "The player doesn't exist or is offline.", BRIGHTRED)> > Exit Sub> End If> > Call PlayerWarp(PlayerID, 90, 15, 4)> Call PlayerMsg(PlayerID, "You have been jailed!", BRIGHTGREEN)> Call PlayerMsg(Index, GetPlayerName(PlayerID) & " has been jailed!", BRIGHTGREEN)> > Exit Sub> ```(Replaced where it said "Call PlayerMsg(Index, "You have been jailed!", BRIGHTGREEN)")> Right?I copied it and fixed the common mistakes such as the missing UBound and the inverse ifs.@Kratos:> Don't Dim Target in the command, dim it where the rest are at.> Sub Commands(Index)> Dim TextSay> Dim PlayerID> Dim MapNum> Thats at the top of the commands.> Try that and let me know.> > EDIT: PlayerID is dim as that, so replace target with PlayerID instead> If that still fails try mine, it works perfect for me.> ```> Case "/jail"> If GetPlayerAccess(Index) > 0 Then> PlayerID = FindPlayer(TextSay(1))> > If PlayerID > 0 Then> Call PlayerWarp(PlayerID, 90, 15, 4)> Call PlayerMsg(index, "You have been jailed!", BRIGHTGREEN)> Call PlayerMsg(Index, GetPlayerName(PlayerID) & " has been jailed!", BRIGHTGREEN)> End If> Else> Call PlayerMsg(Index, "Player is not online.", WHITE)> End If> Exit Sub> > ```"Call PlayerMsg(**index**, "You have been jailed!", BRIGHTGREEN)"Regards, Godlord. 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