04.11.2014, 14:35
I quit my server when i in jail , then how to let me in jail after login
I have a login system already, how to add in
this is my jail command
I have a login system already, how to add in
this is my jail command
PHP Code:
COMMAND:jail(playerid, params[])
{
if(!IsPlayerAdmin(playerid))return 0;
{
new targetid,reason;
if(sscanf(params, "dds", targetid, second,reason)) return SendClientMessage(playerid, COLOR_RED,"[USAGE]:{FFFFFF}/jail [playerid][second][reason]"); //detects the wrong params and show the usage
if(PInfo[targetid][pJail] == 1)return SendClientMessage(playerid, COLOR_RED,"[ERROR]:{FFFFFF}This player is already in jail.");
{
new str[128];
format(str, sizeof(str), "{FF02A7}[ADMIN]:{fFFFFF}%s has jailed %s for %d second.{00ff00}[REASON]:%s", Name(playerid), Name(targetid), second,reason); //get the admin's name, the player's and show the minutes
SendClientMessageToAll(COLOR_LIGHTBLUE,str); //let everybody know what you did, this will send the message to everyone
SetPlayerPos(targetid, -1346.5848,1323.8483,2.4516); //Sets the player's position to the jail in LS
PInfo[targetid][pJail] = 1; //now, here we'll check, if the player's in jail, we'll set the value to "true", means that he IS in jail
GameTextForPlayer(targetid, "~p~JAILED", 5000, 6); //this is for decorating and writing a big "JAILED" for the player
PlayerPlaySound(targetid,1057,0.0,0.0,0.0); //that's also a small sound, for decoration
SetPlayerHealth(targetid, 9999);
ResetPlayerWeapons(targetid);
PInfo[playerid][pJailTimer] = second;
JailTimer[targetid] = SetTimerEx("Unjail",second*1000, false, "i", playerid);
}
}
return 1;
}
PHP Code:
forward Unjail(playerid);
public Unjail(playerid) //this was the name of the timer (Unjail), if you remember
{
SetPlayerPos(playerid, -1388.3654,1346.0662,2.7087); //we'll set the interior to "0", which means to the normal world
PInfo[playerid][pJail] = 0; //we'll set the value of the variable to "false" here, that means he isn't in jail anymore
GameTextForPlayer(playerid, "~g~Unjailed", 1000, 6); //this is for decoration again, will display "UNJAILED"
PlayerPlaySound(playerid,1057,0.0,0.0,0.0); //a smart "success-sound" again
SetPlayerHealth(playerid, 100);
PInfo[playerid][pJailTimer] = 0;
}