when i use /detain he won't be detained. -
stundje - 29.06.2013
Hello, whenever i use /detain as a police officer the person won't be detained into the car.
It only gives me the message that i detained him.
Can somebody help me fix this?
pawn Код:
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)) 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 SAPD cruiser.", RPN(playerid), RPN(playerb));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
return 1;
}
Re: when i use /detain he won't be detained. -
Goldilox - 29.06.2013
Who not try something like this:
pawn Код:
new vehicle;
vehicle = GetPlayerVehicleID(playerid);
PutPlayerInVehicle(playerb,vehicle, seatid);
Gets vehicle id of the player who typed the command and puts the other player in the vehicle of the playerid to whatever seat the player types.
Re: when i use /detain he won't be detained. -
stundje - 29.06.2013
I don't think thats the solution
Re: when i use /detain he won't be detained. -
Goldilox - 29.06.2013
I just made the command for my server and it works for me. Maybe compare it with yours.
Make sure you have the four door vehicle.
pawn Код:
// somewhere after includes.
new LastCar[MAX_PLAYERS];
//OnPlayerExitVehicle
LastCar[playerid] = vehicleid;
CMD:grab(playerid,params[])
{
new pID,string[128],seat,officername[MAX_PLAYER_NAME],name[MAX_PLAYER_NAME];
if(sscanf(params,"ud",pID,seat)) return SendClientMessage(playerid,COLOR_GREY,"/grab [playerid] [seat]");
if(!IsPlayerConnected(pID)) return SendClientMessage(playerid,COLOR_GREY,"Player is not connected.");
if(pID == INVALID_PLAYER_ID) return SendClientMessage(playerid,COLOR_GREY,"Invalid ID");
if(seat < 2 || seat > 3) return SendClientMessage(playerid,COLOR_GREY,"You can't put a suspect in that seat.");
PutPlayerInVehicle(pID, LastCar[playerid], seat);
GetPlayerName(playerid,officername,sizeof(officername));
GetPlayerName(pID,name,sizeof(name));
format(string,sizeof(string),"You've been grabbed into the vehicle by {0101DF}Officer %s",officername);
SendClientMessage(pID,COLOR_ORANGE,string);
format(string,sizeof(string),"You've grabbed %s to the car.",name);
SendClientMessage(playerid,COLOR_WHITE,string);
return 1;
}
Re: when i use /detain he won't be detained. -
stundje - 09.07.2013
Oh sorry, i had no replies so i just ignored it..
But i will give it a try.
Edit: I gave it a try but it won't detain the person i'm trying to detain.
But it does say the message i wrote.