SA-MP Forums Archive
/eject command - 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: /eject command (/showthread.php?tid=411440)



/eject command - nor15 - 29.01.2013

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



Re: /eject command - Kirollos - 29.01.2013

add this;

pawn Код:
if(GetPlayerVehicleID(playerid) != GetPlayerVehicleID(ID))
{
    SendClientMessage(playerid, COLOR_ERROR, "That player isn't in your vehicle");
    return 1;
}



Re: /eject command - nor15 - 29.01.2013

Quote:
Originally Posted by kirollos
Посмотреть сообщение
add this;

pawn Код:
if(GetPlayerVehicleID(playerid) != GetPlayerVehicleID(ID))
{
    SendClientMessage(playerid, COLOR_ERROR, "That player isn't in your vehicle");
    return 1;
}
Thanks man , it works +Rep