[HELP] Command - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [HELP] Command (
/showthread.php?tid=70049)
[HELP] Command -
Hot - 22.03.2009
So, i have a jail command for cops , but it doesn't work ... :/
When I type /copjail [ID] it says unknown command , and when i type /copjail says the way how to use.
Help ?
Code:
Код:
if(strcmp(cmdtext, "/copjail", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREEN, "Use: /copjail [Player ID]");
return 1;
}
giveplayerid = strval(tmp);
if(jailed[giveplayerid]==0)
{
if (gTeam[playerid] == COPS)
{
if (IsPlayerConnected(giveplayerid))
{
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "You have been jailed by officer %s!", sendername, playerid);
SendClientMessage(giveplayerid, COLOR_RED1, string);
format(string, sizeof(string), "%s has been jailed by %s!", giveplayer, giveplayerid, sendername, playerid);
SendClientMessageToAll(COLOR_RED1, string);
printf(string);
SetPlayerInterior(giveplayerid,3);
jailed[giveplayerid] = 1;
SetPlayerPos(giveplayerid,198.3797,160.8905,1003.0300);
SetPlayerFacingAngle(giveplayerid,177.0350);
SetCameraBehindPlayer(giveplayerid);
PlayerPlaySound(giveplayerid,1082,198.3797,160.8905,1003.0300);
TogglePlayerControllable(giveplayerid,0); //So the player that is jailed can't use /kill
DisablePlayerCheckpoint(giveplayerid);
SetTimerEx("UnJail",180000,true,"d",playerid);
return 1;
}else{
format(string, sizeof(string), "ID %d is not connected.", giveplayerid);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
}else{
format(string, sizeof(string), "You are not a cop", giveplayerid);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
}else{
format(string, sizeof(string), "He/She is already jailed", giveplayerid);
SendClientMessage(playerid, COLOR_YELLOW, string);
}
}
return 0;
}
Unjail:
Код:
public UnJail(playerid)
{
if(jailed[playerid] == 1)
{
SetPlayerPos(playerid,197.1827,179.1550,1003.0234);
jailed[playerid] == 0;
SendClientMessage(playerid, COLOR_RED,"SERVER: You've been unjailed .");
}
}
Unjail Warning:
Код:
C:\DOCUME~1\Gustavo\Desktop\SAMP02~1.WIN\GAMEMO~1\LVCNR.pwn(530) : warning 215: expression has no effect
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Warnings.
Код:
Line 530: jailed[playerid] == 0;
Re: [HELP] Command -
Dujma - 22.03.2009
This
jailed[playerid] == 0; should be
jailed[playerid] = 0;
And put return 1; on the end of the command.
Re: [HELP] Command -
Hot - 22.03.2009
Okay, fixed warning, but the command still doesn't working
it says unknown command , i am testing with my self , is it a problem ? cuz it don't have a jail-yourself protection :/
Re: [HELP] Command -
Hot - 22.03.2009
I NEED TO DOUBLE-POST TO YOU HELP ME ?
Re: [HELP] Command -
Rks25 - 22.03.2009
Try:
http://pawn.pastebin.com/d267b860
Re: [HELP] Command -
Hot - 22.03.2009
I tryed , still the same .
Re: [HELP] Command -
Rks25 - 22.03.2009
note the formats..
Re: [HELP] Command -
Hot - 22.03.2009
What you wanna mean ? i am newbie , speak with easy words ...
Re: [HELP] Command -
Rks25 - 22.03.2009
pawn Код:
format(string, sizeof(string), "You are not a cop", giveplayerid);
SendClientMessage(playerid, COLOR_YELLOW, string);
is
wrong
Search on wiki how to use formats and SCM.
Re: [HELP] Command -
Hot - 22.03.2009
If I change it my command will work? can U post the code

?