SA-MP Forums Archive
/detain command - 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: /detain command (/showthread.php?tid=526970)



/detain command - mrkemal70 - 20.07.2014

Hey, uhmm i need help with the /detain command. There are no compilation errors, but when i try In Game it says
"You need an LSPD crusier to detain someone in."
And i do have a LSPD cruiser, but its just not detaining him..
Here is the 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 LSPD 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 id.");
    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(!
IsCruiser(LastCar[playerid])) return SendClientMessage(playeridCOLOR_GREY"You need an LSPD cruiser to detain someone in.");
    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 LSPD cruiser."RPN(playerid), RPN(playerb));
    
SendNearbyMessage(playerid15stringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
    return 
1;




Re: /detain command - GeekSiMo - 20.07.2014

Are you in The Cruiser when using it and what is the id of the cruiser !?


Re: /detain command - mrkemal70 - 20.07.2014

I'm not in the cruiser, when im in the cruiser it says i need to be outside of the vehicle, and what do you mean with what is the ID?


Re: /detain command - GeekSiMo - 20.07.2014

The Last Car You Entered Must be a Cruiser !?


Re: /detain command - mrkemal70 - 20.07.2014

It is, sir.


Re: /detain command - GeekSiMo - 20.07.2014

Remove This Line
if(!IsCruiser(LastCar[playerid])) return SendClientMessage(playerid, COLOR_GREY, "You need an LSPD cruiser to detain someone in.");
and check if it works normaly ? ok


Re: /detain command - mrkemal70 - 20.07.2014

I did that already, but it doesnt detain then, i removed the line, did the /detain command and it said i detained him inside, but i didn't.


Re: /detain command - GeekSiMo - 20.07.2014

Send me OnPlayerEnterVehicle ok


Re: /detain command - mrkemal70 - 20.07.2014

What do you mean?


Re: /detain command - GeekSiMo - 20.07.2014

All The CallBack OnPlayerEnterVehicle!!
Use Ctrl + F To Search it!