SA-MP Forums Archive
Why this /detain CMD dont work ? - 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: Why this /detain CMD dont work ? (/showthread.php?tid=507619)



Why this /detain CMD dont work ? - bustern - 18.04.2014

Under onplayerstate change:
PHP код:
if(newstate == PLAYER_STATE_DRIVER)
    {
     
LastCar[playerid] = GetPlayerVehicleID(playerid);
     } 
Command:
PHP код:
CMD:detain(playeridparams[])
{
    new 
playerbseatidstring[128];
    if(!
IsPlayerLoggedIn(playerid)) return SendClientMessage(playeridCOLOR_GREY"You need to login first before using any command.");
    if(!
IsACop(playerid) && !IsFBI(playerid)) return SendClientMessage(playeridCOLOR_GREY"You are not an BCPD Oficer/FBI Agent.");
    if(
sscanf(params"ui"playerbseatid)) return SendClientMessage(playeridCOLOR_WHITE"[Usage]: /detain [playerid] [seatid]");
    if(!
IsPlayerLoggedIn(playerb)) return SendClientMessage(playeridCOLOR_GREY"Invalid player specified.");
    if(!
IsPlayerNearPlayer(playeridplayerb2)) return SendClientMessage(playeridCOLOR_GREY"You can't detain someone from this disatance.");
    if(!
IsPlayerCuffed(playerb)) return SendClientMessage(playeridCOLOR_GREY"Player is not cuffed.");
    if(
seatid || seatid 3) return SendClientMessage(playeridCOLOR_GREY"You can only detain people in seats 2 and 3.");
    
PutPlayerInVehicle(playerbLastCar[playerid], seatid);
    
format(stringsizeof(string), "* %s grabs %s from their cuffs and throws him inside the cruiser."RPN(playerid), RPN(playerb));
    
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
    return 
1;




Re: Why this /detain CMD dont work ? - PrivatioBoni - 18.04.2014

What "don't work" about it?


Re: Why this /detain CMD dont work ? - bustern - 18.04.2014

It shows the message but the player is still out of the car


Re: Why this /detain CMD dont work ? - PrivatioBoni - 18.04.2014

You know the playerid (executer of command) has to be in the vehicle as a driver for this to work?
Also, are there any errors in the script, or even warnings?


Re: Why this /detain CMD dont work ? - bustern - 18.04.2014

i know and there arent errors


Re: Why this /detain CMD dont work ? - bustern - 19.04.2014

bump