06.03.2014, 12:05
How to eject passanger not specefic id but only passangers in player car , for example if player dont like to have passangers in his car just write /eject , and its working with ZCMD?
CMD:eject(playerid,params[])
{
new vehicleid;
new pid;
new playerstate = GetPlayerState(playerid);
tmp = strtok(cmdtext,idx);
if (!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid,COLOR_YELLOW,"You're not in a vehicle");
return 1;
}
if (playerstate == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid,COLOR_RED,"Passengers can't use This!");
return 1;
}
vehicleid = GetPlayerVehicleID(playerid);
if (!strlen(tmp))
{
SendClientMessage(playerid,COLOR_WHITE,"USAGE: /eject [playerid]");
return 1;
}
pid = strval(tmp);
if (!IsPlayerConnected(pid))
{
SendClientMessage(playerid,COLOR_RED,"That Player Is Not Connected...");
return 1;
}
if (!IsPlayerInVehicle(pid,vehicleid))
{
SendClientMessage(playerid,COLOR_RED,"That Player Is Not In Your Vehicle...");
return 1;
}
else
{
RemovePlayerFromVehicle(pid);
GameTextForPlayer(pid,"~r~YOU'VE BEEN EJECTED!",3000,5);
return 1;
}
return 1;
}
CMD:eject(playerid,params[])
{
new vehicleid;
new playerstate = GetPlayerState(playerid);
if(!IsPlayerInAnyVehicle(playerid))
{
SendClientMessage(playerid,COLOR_YELLOW,"You're not in a vehicle");
return 1;
}
if(playerstate == PLAYER_STATE_PASSENGER)
{
SendClientMessage(playerid,COLOR_RED,"Passengers can't use This!");
return 1;
}
vehicleid = GetPlayerVehicleID(playerid);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerInVehicle(i,vehicleid))
{
RemovePlayerFromVehicle(i);
return 1;
}
}
return 1;
}