/arrest CMD help!
#1

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

This would be in a different section of your GM.
Reply
#3

Sorry, what do you mean? Can you explain it more better?
Reply
#4

Set a timer or set a countdown variable, when it reaches 0 set their position to where ever you want it to go.
Reply
#5

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

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

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?
Reply
#8

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

Thank you! rep'd
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)