How to unjail automatically after period of time
#1

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
Reply
#2

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

/jail [playerid] [reason] [time]

Then create a timer
Reply
#3

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.
Reply
#4

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


Forum Jump:


Users browsing this thread: 1 Guest(s)