/arrest CMD help! - 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: /arrest CMD help! (
/showthread.php?tid=383548)
/arrest CMD help! -
RLGaming - 07.10.2012
Quote:
CMD:arrest(playerid, params[])
{
new rank = arrFaction[playerid][p_iMember] > -1 && arrFaction[playerid][g_iFactionType] == 1, giveplayerid, amount;
if(rank < 1) return SendClientMessage(playerid, COLOR_WHITE, "You are not authorized to use this command.");
{
if(IsAtArrestPoint(playerid))
{
if(sscanf(params, "ud", giveplayerid, amount)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /arrest [playerid] [amount]");
if(amount > 30000)
{
SendClientMessage(playerid, COLOR_WHITE, "The charge cannot be more than $30000!");
}
if(amount < 30000)
{
if(IsPlayerConnected(giveplayerid))
{
PlayerInfo[giveplayerid][pArrests]++;
GivePlayerMoney(giveplayerid, -amount);
SendClientMessage(playerid, COLOR_YELLOW, "You succesfully arrested the suspect, you were awarded $5000 for your hard work.");
SetPlayerPos(giveplayerid, 227.6157,110.7703,999.0156);
SetPlayerInterior(giveplayerid, 10);
SendClientMessage(giveplayerid, COLOR_BLUE, "You were arrested, you are now in jail.");
GivePlayerCash(playerid, 5000);
}
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "You are not in range of an arrest point!");
}
}
return 1;
}
|
So I have that cmd for police but how can I make it so when they arrest them they are in there for 15 minutes and after thats up they get released and TP'd to co-ordinates
Re: /arrest CMD help! -
rbush12 - 07.10.2012
This would be in a different section of your GM.
Re: /arrest CMD help! -
Riddick94 - 07.10.2012
Sorry, what do you mean? Can you explain it more better?
Re: /arrest CMD help! -
Kyle - 07.10.2012
Set a timer or set a countdown variable, when it reaches 0 set their position to where ever you want it to go.
Re: /arrest CMD help! -
RLGaming - 07.10.2012
Like when you arrest somebody it teleports them to co-ordinates like I already have but when they do get arrested a timer sets and after the timer is up(15 mins) they get teleported out
Re: /arrest CMD help! -
Riddick94 - 07.10.2012
SetTimerEx for a player which is arrested with countdown to 0 from 15 minutes. Then if timer count is equals to 0 - teleport them where you want.
Re: /arrest CMD help! -
RLGaming - 07.10.2012
Quote:
forward ArrestSpawn(giveplayerid);
public ArrestSpawn(giveplayerid)
{
SendClientMessage(giveplayerid, COLOR_WHITE, "You have served your time, you have been released!");
SetPlayerPos(giveplayerid, 1543.8929,-1675.5627,13.5573);
SetPlayerInterior(giveplayerid, 0);
SetPlayerVirtualWorld(giveplayerid, 0);
PlayerInfo[giveplayerid][pIsArrested] = 0;
}
|
Quote:
SetTimerEx("ArrestSpawn", 2000000, false, "i", giveplayerid);
|
Would that work?
Re: /arrest CMD help! -
Riddick94 - 07.10.2012
Yeah, but for more security you should save your timer to variable and then destroy it. You never know when your server going to shut down.. if you know what i mean. And yes, it should work. Just put the timer in the command and this callback anywhere in your GM.
Re: /arrest CMD help! -
RLGaming - 07.10.2012
Thank you! rep'd