SA-MP Forums Archive
How to unjail automatically after period of time - 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: How to unjail automatically after period of time (/showthread.php?tid=90239)



How to unjail automatically after period of time - ThePS3Guy - 07.08.2009

This is my command to jail someone, but what commands can I put in to automatically unjail them after say, 1 minute?




if(strcmp(cmd, "/jail", true) == 0) // Jails a player
{
if (AccountInfo[playerid][AdminLevel] >= 2)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, ORANGE, "USAGE: /jail [playername/id] [reason]");
return 1;
}
new targetid = ReturnUser(tmp);
if(IsPlayerConnected(targetid))
{
if(targetid != INVALID_PLAYER_ID)
{
if(AccountInfo[giveplayerid][Jail] == 0)
{
GetPlayerName(targetid, giveplayername, sizeof(giveplayername));
GetPlayerName(playerid, sendername, sizeof(sendername));
new reason[128];
reason = bigstrtok(cmdtext, idx);
if(!strlen(reason)) return SendClientMessage(playerid, ORANGE, "USAGE: /jail [playername/id] [reason]");
format(string, sizeof(string), "You got jailed by Admin %s. Reason: %s", sendername, reason);
SendClientMessage(targetid, ADMIN_RED, string);
format(string, sizeof(string), "-| Administrator %s jailed %s. [ Reason: %s ] |-",sendername,giveplayername, reason);
SendClientMessageToAll(ADMIN_RED,string);
AccountInfo[targetid][Jail] = 1;
OnPlayerJailed(targetid);
return 1;
}
else SendClientMessage(playerid, RED, "Player is already jailed!");
}
else
{
format(string, sizeof(string), "%d is not an active player.", targetid);
SendClientMessage(playerid, RED, string);
}
}
else
{
format(string, sizeof(string), "%d is not an active player.", targetid);
SendClientMessage(playerid, RED, string);
}
}
else SendClientMessage(playerid, RED, "Your admin level is too low to use this command.");
return 1;
}



Thanks in advance for ur help


Re: How to unjail automatically after period of time - Antonio [G-RP] - 07.08.2009

You need to add a timer, meaning the command would be...

/jail [playerid] [reason] [time]

Then create a timer


Re: How to unjail automatically after period of time - ThePS3Guy - 07.08.2009

sorry.. can you please tell me the specific code? I know enough about code to go through the admin script, delete some commands, add some commands, modify commands, but when it comes to countdowns... i'm lost. Thanks soo much it helps a lot.


Re: How to unjail automatically after period of time - [GM]The_Don - 07.08.2009

Man ... you could use the Jail Function from the Godfather, and just rewrite the code...
No Offensive