SA-MP Forums Archive
/arrest - 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 (/showthread.php?tid=605242)



/arrest - CSLangdale - 16.04.2016

Код:
CMD:arrest(playerid, params[])
{
    if(pInfo[playerid][Faction] == 1)
        {
        if(IsPlayerInRangeOfPoint(playerid, 9.0, 49.6361,-201.6498,-5.7678 ))
        {
       	new ID;
        if(sscanf(params,"i", ID)) return SendClientMessage(playerid,-1,"{FF0000}USAGE: {15FF00}/Arrest [ID]");
        SetPlayerPos(ID, 264.4282,82.2066,1001.0391);
        SetPlayerFacingAngle(ID, 344.0042);
        SendClientMessage(ID, -1, "{FF0000}You got arrested !");
        SendClientMessage(playerid, -1, "{0066CC}[POLICE]: {15FF00}You arrested specified player !");
        }
        }
        else
        {
        SendClientMessage(playerid, -1, "{FF0000}ERROR: {15FF00}You aren't Police !");
        }
    return 1;
}
How would i put a timer for how long a person is in jail for?


Re: /arrest - Prokill911 - 16.04.2016

Do you mean a timer for them to use /time an see how long they have
Do you mean a timer for when the server is to release them
Elaborate


Re: /arrest - BiosMarcel - 16.04.2016

this is not the we script for you section hire a scripter or put some effort into it , try it yourself ****** a bit it is so easy


Re: /arrest - Prokill911 - 16.04.2016

Here's a simple example.
PHP код:
CMD:arrest(playeridparams[]) {
    new 
IDtime;
    if(
pInfo[playerid][Faction] == 1) {
        if(
IsPlayerInRangeOfPoint(playerid9.049.6361,-201.6498,-5.7678 )) {           
            if(!
sscanf(params,"ii"IDtime)) {
                
SetPlayerPos(ID264.4282,82.2066,1001.0391);
                
SetPlayerFacingAngle(ID344.0042);
                
SendClientMessage(ID, -1"{FF0000}You got arrested !");
                
SendClientMessage(playerid, -1"{0066CC}[POLICE]: {15FF00}You arrested specified player !");
                
SetTimerEx("releasePlayer",time*60false"d",id);
            } else {
                
SendClientMessage(playerid,-1,"{FF0000}USAGE: {15FF00}/Arrest [ID] [Time]");
                return 
1;
            }
        } 
    }
    return 
1;
}
releasePlayer() {
        
//releasehere
    
return 1;




Re: /arrest - BiosMarcel - 16.04.2016

Prokill that is the wrong approach what if he reconnects after 1 second, will he be free
Prokill or what is if he sets the timer to 10 minutes and the user reconnects at 9 minutes, will he have to wait 19? ^^


Re: /arrest - Prokill911 - 16.04.2016

Quote:
Originally Posted by [Bios]Marcel
Посмотреть сообщение
Prokill that is the wrong approach what if he reconnects after 1 second, will he be free
Prokill or what is if he sets the timer to 10 minutes and the user reconnects at 9 minutes, will he have to wait 19? ^^
Lol
As stated above.
It's an example
I'm not going to write the whole thing for him lol...

Obviously I never added checks etc - To block relog etc
Saving the time to a pinfo or SQL etc etc etc