[HELP]OnVehicleSpawn[+3REP]
#1

I all
i esplain my problem
i have created some VIP vehicles
with
Код:
vipcars[MAX_VEHICLES];
and i gave the ids to the vehicles at OnGameModIni
nvm the problem is on OnVehicleSpawn
i want to make something that will detecte all the vipcars[] in order continu my work
i've tryed this but not working
Код:
	for(new i = 1;i<MAX_VEHICLES;i++)
	{
		if(vehicleid == vipcars[i])
		{
			VehicleFuel[i] = 500;
			SetVehicleHealth(i, 1000);
			return 1;
		}
        {
any solution ? buy the wat i have 28 cars with vipcars[1] vipcars[2] ...
Reply
#2

Create a public with vip cars..
pawn Код:
public IsAVipCar(carid)
{
    if(carid >= YourID && carid <=YourID)
    {
        return 1;
    }
    return 0;
}
And then use it like
Код:
if(IsAVipCar(carid)
Reply
#3

? why creating a public ? and even if i do it the problem will be the same
i'm looking for a way to check if the the vehicle is vipcars[MAX_VEHICLES]
Reply
#4

If you run your gamemode and your VIP vehicles are spawned.. respawn them again.
Reply
#5

the problem is not about respaning
i have errors when i compile! there is a way to get what i want but it's too long ! i know there is an other way but i don't have an idea about how to make it
i could make
Код:
if(vehicleid == vipcars[0]||vehicleid == vipcars[1]||vehicleid == vipcars[2]||vehicleid == vipcars[3] blablabla)
but i'm sure there is an other posibility
for example i made that in OnPlayerKeyStateChange
Код:
for(new i = 1;i<MAX_VEHICLES;i++)
			{
			    if(vehicleid == vipcars[i]){
					format(file, sizeof(file), USER_FILE, GetPName(playerid));
					if(dini_Int(file, "VIP")< 1){
			            return SendClientMessage(playerid,YELLOW,"You are not a Gold Member");
					}
			    }
			}
i want the samething for onvehspawn
something like
If the vehicle respawning is one of the VIPCARS blz bla bla
Reply
#6

ONPlayerStateChange.. .Put that in there and RemovePlayerFromVehicle if Hes not vip
Reply
#7

You tried something like
pawn Код:
for(new i; i < sizeof vipcars; i++)
{
    //Functions only for vipcars
}
Reply
#8

yes vinibor i did this
Код:
	for(new i = 1;i<MAX_VEHICLES;i++)
	{
		if(vehicleid == vipcars[i])
		{
			//blablabla
			return 1;
		}
         }
and this too
(this one i should work but idk why it's nat)
Код:
	for(new i = 1;i<MAX_VEHICLES;i++)
	{
		if(i == vipcars[i])
		{
			//blablabla
			return 1;
		}
         }
Reply
#9

OnVehicleSpawn is actually not called when they're first created. It's called when the vehicle RESPAWNS. It's a typo, I've heard multiple times.
Reply
#10

... i know all that and what i'm looking for ! is to use this WHEN A VEHICLE RESPAWN ! Who talked about calling this function when a vehicle is created ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)