Need help with my /detain CMD. - 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: Need help with my /detain CMD. (
/showthread.php?tid=449623)
Need help with my /detain CMD. -
stundje - 09.07.2013
Код:
CMD:detain(playerid, params[])
{
new playerb, seatid, string[128];
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!IsACop(playerid) && !IsFBI(playerid) && !IsAGov(playerid) && !IsNG(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an SAPD Oficer/FBI Agent.");
if(sscanf(params, "ui", playerb, seatid)) return SendClientMessage(playerid, COLOR_WHITE, "[Usage]: /detain [playerid] [seatid]");
if(!IsPlayerLoggedIn(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Invalid player id.");
if(!IsPlayerNearPlayer(playerid, playerb, 2)) return SendClientMessage(playerid, COLOR_GREY, "You can't detain someone from this disatance.");
if(!IsPlayerCuffed(playerb)) return SendClientMessage(playerid, COLOR_GREY, "Player is not cuffed.");
if(seatid < 2 || seatid > 3) return SendClientMessage(playerid, COLOR_GREY, "You can only detain people in seats 2 and 3.");
PutPlayerInVehicle(playerb, LastCar[playerid], seatid);
format(string, sizeof(string), "* %s grabs %s from their cuffs and throws him inside the car.", RPN(playerid), RPN(playerb));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
return 1;
}
This is my /detain command, the only problem is that the person that has to be detained won't get in the car I've been in or any other cars.
It will only show the "* %s grabs %s from their cuffs and throws him inside the car." message.
Please help me how to fix this.
Re: Need help with my /detain CMD. -
Calabresi - 09.07.2013
Show us how do you get the LastCar[playerid] variable. It seems like coming from out of this code block.
Re: Need help with my /detain CMD. -
stundje - 09.07.2013
What do you mean with the variable? It's defined yes. I copied this from another script but it still won't work after editting it multiple times.