Change car
#6

Quote:
Originally Posted by alibalicharlton
Посмотреть сообщение
Thanks so much EnforcerDon, I not entirely sure if I know what you mean, but the return value of the INVALID_VEHICLE_ID makes sense. I tried the OnPlayerEnterVehicle but it didn't work when changing seats.

I've gotten round it by ensuring the robber is in a vehicle using this, does this look ok to you, or is there a better/more efficient way around it?

Код:
public OnPlayerUpdate(playerid)
{
    if(playerid==robber && IsPlayerInAnyVehicle(playerid))
	{
		switch(GetVehicleModel(GetPlayerVehicleID(playerid)))
		{
			case 592: RestrictedCar(playerid,"Andromada");
		}
	}
	return 1;
}
Could I now safely make the check if they are in a different vehicle, or is that pointless, if I'm going to destroy it if it's banned?

Thanks again
OnPlayerEnterVehicle would still be much more efficient if you could get it to work, but you would have to change your RestrictedCar function to take a vehicleid instead of a playerid, (or just take both) because you would be calling it before the player was actually in it, if you get what I mean, as such. It didn't work because when RestrictedCar calls the DestroyVehicle function, it passes it an invalid vehicle id, due to the player vehicle id being an invalid vehicle.

pawn Код:
public OnPlayerEnterVehicel(playerid, vehicleid)
{
    if(playerid==robber)
    {
        if(GetVehicleModel(vehicleid) == 592)
        {
            RestrictedCar(playerid,vehicleid,"Andromada");
        }
    }
}
** untested
RestrictedCar will be called every time a robber tries to enter an Andromada.

And what exactly do you mean when you say "Could I now safely make the check if they are in a different vehicle", please try to be a little more specific, because I'm missing your point.

If you have any other problems, let me know.

BTW, what kind of server are you working on?
Reply


Messages In This Thread
Change car - by alibalicharlton - 28.09.2014, 11:33
Re: Change car - by EnforcerDon - 28.09.2014, 11:57
Re: Change car - by alibalicharlton - 28.09.2014, 12:01
Re: Change car - by EnforcerDon - 28.09.2014, 12:17
Re: Change car - by alibalicharlton - 28.09.2014, 12:32
Re: Change car - by EnforcerDon - 28.09.2014, 12:50

Forum Jump:


Users browsing this thread: 2 Guest(s)