Only i can drive a car
#1

Hello i need help or tutorial, I just wanna make that I can only drive car and nobody else!
I want some cars front of my haouse if somebody else sit in the car, then kust eject him from car
TnX sry for my english
Reply
#2

Top of script:
pawn Код:
new myCar;
Under OnGameModeInit() or OnFilterScriptInit():
pawn Код:
myCar = CreateVehicle(Parameters here);
Under OnPlayerEnterVehicle() or OnPlayerStateChange()

OnPlayerEnterVehicle()
pawn Код:
if(strcmp(sendername, "YOUR_NAME_HERE", false) == 0) // Replace your in game name with "YOUR_NAME_HERE".
    {
        if(!ispassenger && vehicleid == myCar)
        {
            new Float: x, Float: y, Float: z;
            GetPlayerPos(playerid, x, y, z); // I grab his position and set it to what it was because...
            SetPlayerPos(playerid, x, y, z); // RemovePlayerFromVehicle() doesn't function properly in this.
            SendClientMessage(playerid, -1, "This car is off limits.");
        }
    }
OnPlayerStateChange()
pawn Код:
if(oldstate == PLAYER_STATE_ONFOOD && newstate == PLAYER_STATE_DRIVER)
    {
        new vehicleid = GetPlayerVehicleID(playerid);
        if(vehicleid == myCar)
        {
            RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, -1, "This car is off limits.");
        }
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)