Question - 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: Question (
/showthread.php?tid=476563)
Question -
DarkLored - 18.11.2013
Guys i made a jail command but i cant figure how to make that a admin can jail how much time he wants
and the command will read it like if i type /jail 0 25 it will jail the player for 25 sec or other that i pick
Here is my code:
pawn Код:
CMD:jail(playerid,params[])
{
new ID;
if(pInfo[playerid][Adminlevel] >= 2)
{
new rnd = random(sizeof(PrisonSpawn));
SetPlayerPos(ID, PrisonSpawn[rnd][0], PrisonSpawn[rnd][1], PrisonSpawn[rnd][2]);
SetPlayerInterior(ID,10);
SetPVarInt(ID,"JailTime",-1);
@Release(ID);
return 1;
}
return 1;
}
Re: Question - Emmet_ - 18.11.2013
pawn Код:
CMD:jail(playerid, params[])
{
if(pInfo[playerid][Adminlevel] < 2) {
return 1;
}
new
iTargetID,
iJailSeconds
;
if (!sscanf(params, "ud", iTargetID, iJailSeconds))
{
if (!IsPlayerConnected(iTargetID)) {
return SendClientMessage(playerid, -1, "Player is not connected.");
}
else if (iJailSeconds < 0 || iJailSeconds > 500000) {
return SendClientMessage(playerid, -1, "Invalid amount of time.");
}
new iRandSpawn = random(sizeof(PrisonSpawn));
SetPlayerPos(iTargetID, PrisonSpawn[iRandSpawn][0], PrisonSpawn[iRandSpawn][1], PrisonSpawn[iRandSpawn][2]);
SetPlayerInterior(iTargetID, 10);
SetPVarInt(iTargetID, "JailTime", iJailSeconds);
SetTimerEx("@Release", iJailSeconds * 1000, false, "d", iTargetID);
}
else SendClientMessage(playerid, -1, "USAGE: /jail [playerid] [seconds]");
return 1;
}
Re: Question -
DarkLored - 19.11.2013
Thanks it worked +1REPED
Re: Question -
Pottus - 19.11.2013
I think Emmet_ must have cringed at regurgitating that PVar.