18.03.2013, 20:20
Hello, I created a /detain command quickly the other day but, it seems to not be working. Here are the required functions.
OnPlayerExitVehicle
PHP код:
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) &&!IsSASD(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You are not an LSPD 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.");
new vehicle;
vehicle = GetPlayerVehicleID(playerid);
if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER)
{
PutPlayerInVehicle(playerb, LastCar[playerid], seatid);
}
else
{
PutPlayerInVehicle(playerb, vehicle, seatid);
}
format(string, sizeof(string), "* %s grabs %s from their cuffs and throws him inside the LSPD cruiser.", RPN(playerid), RPN(playerb));
SendNearbyMessage(playerid, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
return 1;
}
PHP код:
if(PlayerInfo[playerid][pFac] == 1 && PlayerInfo[playerid][pFac] == 7 && PlayerInfo[playerid][pFac] == 6)
{
LastCar[playerid] = vehicleid;
}'