Only i can drive a car
#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


Messages In This Thread
Only i can drive a car - by smiljun123 - 19.04.2013, 20:06
Re: Only i can drive a car - by zDivine - 19.04.2013, 20:16

Forum Jump:


Users browsing this thread: 2 Guest(s)