16.04.2014, 20:30
When a paramedic types : "/loadpt"
It will recieve this message : "That seat is occupied."
Can someone explain to me please how to fix it?
It will recieve this message : "That seat is occupied."
Can someone explain to me please how to fix it?
pawn Код:
CMD:loadpt(playerid, params[])
{
if(PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pFaction] == 3)
{
if(IsPlayerInAnyVehicle(playerid))
{
SendClientMessageEx(playerid, COLOR_GREY, " Cannot use this while you're in a car!");
return 1;
}
new string[128], giveplayerid, seat;
if(sscanf(params, "ud", giveplayerid, seat)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /loadpt [player] [seatid]");
if(IsPlayerConnected(giveplayerid))
{
if(giveplayerid != INVALID_PLAYER_ID)
{
if(!(2 <= seat <= 3))
{
SendClientMessageEx(playerid, COLOR_GRAD1, "The seat ID cannot be above 3 or below 2.");
return 1;
}
if(GetPVarInt(giveplayerid, "Injured") != 1)
{
SendClientMessageEx(playerid, COLOR_GREY, "That patient not injured - you can't load them.");
return 1;
}
if(IsPlayerInAnyVehicle(giveplayerid))
{
SendClientMessageEx(playerid, COLOR_GREY, "That patient is inside a car - you can't load them.");
return 1;
}
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
if(giveplayerid == playerid) { SendClientMessageEx(playerid, COLOR_GREY, "You cannot load yourself!"); return 1; }
if(PlayerInfo[giveplayerid][pJailTime] > 0) return SendClientMessageEx(playerid, COLOR_GRAD2, "You can't use this command on jailed players.");
new carid = gLastCar[playerid];
if(IsAnAmbulance(carid))
{
if(IsVehicleOccupied(carid))
{
SendClientMessageEx(playerid, COLOR_GREY, "That seat is occupied.");
return 1;
}
if(IsPlayerInRangeOfVehicle(giveplayerid, carid, 10.0) && IsPlayerInRangeOfVehicle(playerid, carid, 10.0)) {
format(string, sizeof(string), "* You were loaded by paramedic %s.", GetPlayerNameEx(playerid));
SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* You loaded patient %s.", GetPlayerNameEx(giveplayerid));
SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s loads %s in the ambulance.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetPVarInt(giveplayerid, "EMSAttempt", 3);
ClearAnimations(giveplayerid);
PutPlayerInVehicle(giveplayerid,carid,seat);
TogglePlayerControllable(giveplayerid, false);
}
else SendClientMessageEx(playerid, COLOR_GREY, "Both you and your patient must be near the ambulance.");
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD2, "Your last car needs to be an ambulance!");
}
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, " You're not close enough to the person or your car!");
return 1;
}
}
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
return 1;
}
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD2, " You are not a Cop / FBI / Coastguard!");
}
return 1;