SA-MP Forums Archive
private cars question - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: private cars question (/showthread.php?tid=249846)



private cars question - rekatluos - 20.04.2011

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 ?


Re: private cars question - blackwave - 20.04.2011

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;
    }



Re: private cars question - rekatluos - 20.04.2011

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