SA-MP Forums Archive
Using timer for unjail - 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)
+--- Thread: Using timer for unjail (/showthread.php?tid=311286)



Using timer for unjail - milanosie - 15.01.2012

Hello everybody! I made this /arrest cmd where cops can arrest people, they will be teleported into jail. Now how do I set it that after a custom amount of time the player will be teleported to infront of the lspd?

With custom ammount of time I mean like /arrest [playername/ID] [time in minuts]

Any idea?

Code so far:

Код:
CMD:arrest(playerid, params[])
{
	if(PlayerInfo[playerid][Fmember] == 1)
	{
		new toplayer;
                new time;
		if(!sscanf(params, "uis", toplayer, time))
		{
			if(IsPlayerConnected(toplayer))
			{
				if(IsPlayerInRangeOfPoint(toplayer, 20.0, 221.9771, 121.3747, 999.0156))
				{
					if(IsPlayerInRangeOfPoint(playerid, 20.0, 221.9771, 121.3747, 999.0156))
					{
						new string[64];
						new name[MAX_PLAYER_NAME], PlayerName[MAX_PLAYER_NAME], time[256];
						GetPlayerName(playerid, name, sizeof(name));
						GetPlayerName(toplayer, PlayerName, sizeof(PlayerName));
						format(string, sizeof(string), "[LAW ENFORCEMENT] Police Officer %s has just arrested %s for % minutes!", name, PlayerName, time);
						SendClientMessage(playerid, COLOR_NEUTRALBLUE, string);
						format(string, sizeof(string), "You Jailed %s", PlayerName);
						SendClientMessage(playerid, 0x2641FEAA, string);
						SetPlayerPos(toplayer, 219.3402, 110.0057, 999.0156);
						SetPlayerInterior(toplayer, 10);
						jailed[toplayer] = 1;
						return 1;
					}
					else return SendClientMessage(playerid, 0x2641FEAA, "You are not near the jail!");
				}
				else return SendClientMessage(playerid, 0x2641FEAA, "No suspect near the jail!");
			}
			else return SendClientMessage(playerid, 0x2641FEAA, "Player Is Not Connected.");
		}
		else return SendClientMessage(playerid, 0x2641FEAA, "USAGE: /arrest [Playername]");
	}
	else return SendClientMessage(playerid, COLOR_RED, "You are not a cop!");
}



Re: Using timer for unjail - jamesbond007 - 15.01.2012

SetTimerEx("unjail", 60000, false, "i", toplayer);//set timer to unjail to 60 seconds

whats the problem ?

then

forward unjail(i);
public unjail(i)
{
//set player pos.... to outside jail
jailed[i] = false;
}