I'm tired because I stayed up all night working on my script. But when I'm tired its like I don't give a damn and I just do it. I need a little help with this. I'm making a jail command for my cops N robbers server. And this idea is based on how Argonath's server jail system is. I'm kind of stuck and I get 26 errors and I want to find the source of the problem. So lets start.
I have
[pawn]new AutoJail[MAX_PLAYERS];
new IsJailed[MAX_PLAYERS];[/pawn]
At the top.
Now I have my command that starts it all.
[pawn]}
else if ( strcmp( cmd, "jail", true ) == 0 )
{
new szMsg[ 128 ], plr;
tmp = strtok( cmdtext, idx ), plr = FindPlayerIDFromString( tmp );
if(PlayerInfo[playerid][Logged] != 1) SendClientMessage(playerid, COLOR_YELLOW, "*****You need to login first*****");
else if(IsCop[playerid] == 0) SendClientMessage(playerid, COLOR_YELLOW,"*****Only Officers Of The Law Can Use This*****");
else if (!strlen(tmp)) SendClientMessage(playerid,COLOR_RED,"USAGE: /c jail [Nick/ID]");
else if(strcmp(GetPlayerLocation(playerid), "Vice-City-Prison-Washington-Beach-Vice-City-Beach", false) == 0) SendClientMessage(playerid, COLOR_YELLOW, "*****[Error]You have to be at the jail cells to jail someone!*****");
else if(strcmp(GetPlayerLocation(plr), "Vice-City-Prison-Washington-Beach-Vice-City-Beach", false) == 0) SendClientMessage(playerid, COLOR_YELLOW, "*****[Error]%s has to be at the jail cells to be jailed!*****", gPlayers[playerid]);
else if (IsCop[plr] == 1) SendClientMessage(playerid,COLOR_YELLOW,"*****[Error] %s Is A Cop!*****", gPlayers[playerid]);
else if (plr == INACTIVE_PLAYER_ID) SendClientMessage(playerid,COLOR_YELLOW,"*****[Error] Unknown player*****");
else if (IsCriminal[plr] == 0) SendClientMessage(playerid,COLOR_YELLOW,"*****[Error] >> %s << has not commited a crime!*****", gPlayers[playerid]);
{
format( szMsg, sizeof( szMsg ), "*****Officer >> %s << has jailed >> %s <<*****", gPlayers[ playerid ], gPlayers[ plr ]);
SendClientMessageToAll( COLOR_YELLOW, szMsg );
SetPlayerPos(plr,387.873, -509.743, 8.98706,0,0);
(IsJailed [plr] = 1);
TogglePlayerControllable(plr,0);
RemovePlayerMarker(plr);
}
return 1;[/pawn]
I tried this one before but Stormeus was telling me about how you can't put timers on other people. So I thought it's just like a trap. Why not push them in and it works all by itself. So since they are jailed I'm telling the server they are and it should start the auto jail
My publics
[pawn]public OnPlayerJail(playerid)
{
if (IsJailed[playerid] == 1){
SetTimer("Jailed", 100000, 0);
GameTextForPlayer(playerid, "~w~Jailed", 60000,0,0);
AutoJail[playerid] = 1;
}
return 1;
}
public OnPlayerAutoJail(playerid)
{
AutoJail[playerid] = 1;
if (strcmp(GetPlayerLocation(playerid), "Vice-City-Prison-Washington-Beach-Vice-City-Beach", false) == 0){
SetTimer("AutoJail", 3000, 1);
}
if (AutoJail[playerid] == 0){
KillTimer("AutoJail");
return 1;
}
[/pawn]
And then I have my timers
[pawn]public Jailed( playerid )
{
AutoJail[playerid] = 0;
SendClientMessage(playerid, COLOR_YELLOW, "*****You have been released out of jail*****");
}
public AutoJail( playerid )
{
SetPlayerPos(playerid, 387.873, -509.743, 8.98706,0,0);
}[/pawn]
Is this not genius or what?
heheh. Anyways I get these errors and I know on my public the if fails. I need something to put in that if.
if (strcmp(GetPlayerLocation(playerid), "Vice-City-Prison-Washington-Beach-Vice-City-Beach", false) == 0){