Does not unjail automatically. (Urgent) -
Goldino - 03.02.2013
Hey guys, I've got my jail and unjail command. They both work. But when I jail someone, they don't automatically come out. For example, I do /jail 1 1 test. It jails the person for 1 minute, but he wont come out automatically. Please help
Re: Does not unjail automatically. (Urgent) -
Goldino - 03.02.2013
Anyone? plz help
Re: Does not unjail automatically. (Urgent) -
SilverKiller - 03.02.2013
Code?
Re: Does not unjail automatically. (Urgent) -
Goldino - 03.02.2013
Код:
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;
JailTimer[id] = SetTimerEx("Unjail",time*60000, false, "i", id);
return 1;
}
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;
}
Re: Does not unjail automatically. (Urgent) -
SilverKiller - 03.02.2013
Show the unjail callback you used in SetTimerEx
Re: Does not unjail automatically. (Urgent) -
spedico - 03.02.2013
I'm not sure if SpawnPlayer works if you're spawned already, or if you have to use SetSpawnInfo. Try using SetPlayerPos instead.
Re: Does not unjail automatically. (Urgent) -
Goldino - 03.02.2013
Need the whole script, so u can help fix it?
Re: Does not unjail automatically. (Urgent) -
spedico - 03.02.2013
The reason it isn't unjailing automatically is because there is a error in your Unjail function, which you are using here: JailTimer[id] = SetTimerEx("Unjail",time*60000, false, "i", id);
If you are trying to set the timer to do the command /unjail, you can't. You need to make a public function called Unjail(playerid);
Re: Does not unjail automatically. (Urgent) -
SilverKiller - 03.02.2013
Quote:
Originally Posted by spedico
You need to make a public function called Unjail(playerid);
|
That is why I said show your callback..
Re: Does not unjail automatically. (Urgent) -
Goldino - 03.02.2013
I always get errors when making the callback for unjail. Can u plz help? or help me make it plz?