Eject passanger [REPS]
#1

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?
Reply
#2

try this
pawn Код:
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;
}
Reply
#3

he said he doesnt want it to be with ids,he wants it like if i do /eject and everyone in the car gets ejected...
pawn Код:
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;
}
Reply
#4

For both rep and thanks !
Reply
#5

Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)