/Unjail command doesn't work (Very urgent)
#1

Hey guys, I've got my jail and unjail command in my script. The jail command works fine, but when I do /unjail, it says that the person is not in jail when he is. Heres the jail command:

Код:
CMD:jail(playerid,params[])
{
		if(pInfo[playerid][Adminlevel] < 2)return SendClientMessage(playerid, 0xFF0000FF, "You are not authorised to use this command");
        new id,time,reason[100],plname[MAX_PLAYER_NAME],GPlayerName[MAX_PLAYER_NAME], szString[128];
        if(sscanf(params,"dds",id,time,reason)) return SendClientMessage(playerid, -1, "USAGE: /jail <playerid> <time> <reason>");
        if(Jailed[id] == 1) return SendClientMessage(playerid, 0x8B0000FF, "ERROR: Player is already jailed.");
        GetPlayerName(id, plname, sizeof(plname));
        GetPlayerName(playerid, GPlayerName, sizeof(GPlayerName))
        format(szString, sizeof(szString), "AdmSys-: %s (ID:%d) has been jailed for %d minutes; Reason: %s", plname, id, time, reason);
        SendClientMessageToAll(0x5F9EA0FF, szString);
        SetPlayerInterior(id, 3);
        SetPlayerVirtualWorld(id, 10);
        SetPlayerFacingAngle(id, 360.0);
        SetPlayerPos(id, 197.5662, 175.4800, 1004.0);
        SetPlayerHealth(id, 9999999999.0);
        ResetPlayerWeapons(id);
        JailTimer[id] = SetTimerEx("Unjail",time*60000, false, "i", id);
        return 1;
}
The jail command works fine, but the problem is in the unjail:

Код:
CMD:unjail(playerid,params[])
{
	if(pInfo[playerid][Adminlevel] < 2)return SendClientMessage(playerid, 0xFF0000FF, "You are not authorised to use this command");
    new id;
    if(sscanf(params,"u",id)) return SendClientMessage(playerid, COLOR_BLUE, "USAGE: /unjail <playerid>");//sscanf routine
    if (!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not connected.");//checks if the targetid is connected
    if(Jailed[id] == 0) return SendClientMessage(playerid, COLOR_RED, "ERROR: Player is not jailed.");//checks if the id is jailed and if he isnt it will send an error.
    Jailed[id] = 0;
    SetPlayerInterior(id, 0);
    SetPlayerVirtualWorld(id, 0);
    SpawnPlayer(id);
    SetPlayerHealth(id, 100);
    KillTimer(JailTimer[id]);
    return 1;
}
Please help! Thansl
Reply
#2

you do not set Jailed[id] to 1 in /jail.

pawn Код:
CMD:jail(playerid,params[])
{
        if(pInfo[playerid][Adminlevel] < 2)return SendClientMessage(playerid, 0xFF0000FF, "You are not authorised to use this command");
        new id,time,reason[100],plname[MAX_PLAYER_NAME],GPlayerName[MAX_PLAYER_NAME], szString[128];
        if(sscanf(params,"dds",id,time,reason)) return SendClientMessage(playerid, -1, "USAGE: /jail <playerid> <time> <reason>");
        if(Jailed[id] == 1) return SendClientMessage(playerid, 0x8B0000FF, "ERROR: Player is already jailed.");
        GetPlayerName(id, plname, sizeof(plname));
        GetPlayerName(playerid, GPlayerName, sizeof(GPlayerName))
        format(szString, sizeof(szString), "AdmSys-: %s (ID:%d) has been jailed for %d minutes; Reason: %s", plname, id, time, reason);
        SendClientMessageToAll(0x5F9EA0FF, szString);
        SetPlayerInterior(id, 3);
        SetPlayerVirtualWorld(id, 10);
        SetPlayerFacingAngle(id, 360.0);
        SetPlayerPos(id, 197.5662, 175.4800, 1004.0);
        SetPlayerHealth(id, 9999999999.0);
        ResetPlayerWeapons(id);
        Jailed[id] = 1;//fix
        JailTimer[id] = SetTimerEx("Unjail",time*60000, false, "i", id);
        return 1;
}
Reply
#3

1 more thing. On this line:

Код:
format(szString, sizeof(szString), "AdmSys-: %s (ID:%d) has been jailed for %d minutes; Reason: %s", plname, id, time, reason);
I get this error:

Код:
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(1185) : error 001: expected token: ";", but found "-identifier-"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Please help
Reply
#4

Quote:
Originally Posted by Goldino
Посмотреть сообщение
1 more thing. On this line:

Код:
format(szString, sizeof(szString), "AdmSys-: %s (ID:%d) has been jailed for %d minutes; Reason: %s", plname, id, time, reason);
I get this error:

Код:
C:\DOCUME~1\DANNY~1.YOU\MYDOCU~1\CNRSER~1\GAMEMO~1\Testing.pwn(1185) : error 001: expected token: ";", but found "-identifier-"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Please help
and what is on line 1184? (or some code before 1185)
Reply
#5

Add a ';' on line 1184's end.
Reply
#6

Anyone? plz help
Reply
#7

You're missing a ; at the end of GetPlayerName(playerid, GPlayerName, sizeof(GPlayerName))

Just like SKAzini said.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)