private cars question
#1

ok so i made this part of script to restrict player to get into a car

pawn Код:
new newcar = GetPlayerVehicleID(playerid);
    if(newcar == carname1)
    {
        new PlayerName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
        if(strcmp(PlayerName, "playername", true) == 0)
        {
            SendClientMessage(playerid, COLOR_1BLUE,"* this is your car.");
        }
        else
        {
            RemovePlayerFromVehicle(playerid);
            new Float:cx, Float:cy, Float:cz;
            GetPlayerPos(playerid, cx, cy, cz);
            SetPlayerPos(playerid, cx,  cy, cz);
            SendClientMessage(playerid, COLOR_RED,"* this car belongs to..");
        }
        return 1;
    }

but using this players cant even get into the car as passenger ,how can i make it so only if the driver name's different the player gets removed so passengers can enter ?
Reply
#2

pawn Код:
new newcar = GetPlayerVehicleID(playerid);
    if(newcar == carname1)
    {
        new PlayerName[MAX_PLAYER_NAME];
        GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
        if(strcmp(PlayerName, "playername", true) == 0 && GetPlayerState(playerid) != PLAYER_STATE_PASSENGER)
        {
            SendClientMessage(playerid, COLOR_1BLUE,"* this is your car.");
        }
        else
        {
            RemovePlayerFromVehicle(playerid);
            new Float:cx, Float:cy, Float:cz;
            GetPlayerPos(playerid, cx, cy, cz);
            SetPlayerPos(playerid, cx,  cy, cz);
            SendClientMessage(playerid, COLOR_RED,"* this car belongs to..");
        }
        return 1;
    }
Reply
#3

nope doesnt seem to work,i cant even enter my own car as a passenger ,only as driver .

edit : i did smthn else , added new playerState = GetPlayerState(playerid); and then else if (playerState == PLAYER_STATE_PASSENGER) send message


thx for your help,u gave me the idea with playerstate
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)