Locking Vehicles
#3

Quote:
Originally Posted by Divergent
Посмотреть сообщение
Here you go man.

Код:
stock IsACopCar(vehicleid)
{
    switch(GetVehicleModel(vehicleid))
    {
        case 523,427,528,596,598,597,599,601,497,430: return 1;
    }
    return 0;
}


public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	if(IsACopCar(vehicleid) && !ispassenger)
	{
             if(Groups[Player[playerid][Group]][CommandTypes] == 1)
	    {
                        SendClientMessage(playerid, -1, "You are not a cop!");
			ClearAnimations(playerid);
		}
	}
}
This isn't actually "locking" them, but disabling them for use. If you wanted to lock them and only allow cops to unlock it that's a pretty simple function just use GetVehicleParamsEx and SetVehicleParamsEx but players will be able to drive the vehicle if it's unlocked.
Firstly, thankyou very much for helping me here. I appreciate it a lot.
Next I have a couple questions as I'm very new to pawno scripting.

1. Where do I put the stock IsACopCar(vehicleid) etc..?
2. How do I add the OnPlayerEnterVehicle... etc to my current one which is this:
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    if (GetPlayerSurfingVehicleID(playerid) == vehicleid)
    {
        ClearAnimations(playerid);
    }

    new model = GetVehicleModel(vehicleid);
    if(model == 596)
    {
        Player[playerid][GotInCopCar]++;
        ResetPlayerWeapons(playerid);
        GivePlayerSavedWeapons(playerid);
    }
    return 1;
}
Reply


Messages In This Thread
Locking Vehicles - by Kalkor - 15.12.2014, 04:40
Re: Locking Vehicles - by Divergent - 15.12.2014, 04:56
Re: Locking Vehicles - by Kalkor - 15.12.2014, 05:07
Re: Locking Vehicles - by Divergent - 15.12.2014, 05:16
Re: Locking Vehicles - by Kalkor - 15.12.2014, 05:45
Re: Locking Vehicles - by Divergent - 15.12.2014, 05:47

Forum Jump:


Users browsing this thread: 1 Guest(s)