29.01.2013, 00:02
I added this eject command but i use it , so i can eject any player in any other vehicle , but i want the command to know if this player in my vehicle or no
PHP код:
dcmd_eject(playerid,params[])
{
new string[128];
new ID;
if(sscanf(params, "u", ID))
{
SendClientMessage(playerid,COLOR_ERROR,"USAGE: /eject (Player Name/ID)");
return 1;
}
if(!IsPlayerInAnyVehicle(ID))
{
SendClientMessage(playerid,COLOR_ERROR,"This player isn't in any vehicle.");
return 1;
}
if(!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid,COLOR_ERROR,"You aren't in any vehicle.");
return 1;
}
if(GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid,COLOR_ERROR,"You must be the Driver");
return 1;
}
if(!IsPlayerConnected(ID))
{
SendClientMessage(playerid,COLOR_ERROR,"This player isn't connected");
return 1;
}
if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
format(string,sizeof(string),"You have ejected %s(%d) from your vehicle!",PlayerName(ID),ID);
SendClientMessage(playerid,COLOR_YELLOW,string);
format(string,sizeof(string),"%s(%d) has ejected %s(%d) from his vehicle.",PlayerName(playerid),playerid,PlayerName(ID),ID);
SendClientMessageToAll(COLOR_YELLOW,string);
RemovePlayerFromVehicle(ID);
return 1;