SA-MP Forums Archive
[HELP]OnVehicleSpawn[+3REP] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [HELP]OnVehicleSpawn[+3REP] (/showthread.php?tid=384208)



[HELP]OnVehicleSpawn[+3REP] - Amine_Mejrhirrou - 10.10.2012

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] ...


Re: [HELP]OnVehicleSpawn[+3REP] - TzAkS. - 10.10.2012

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)



Re : [HELP]OnVehicleSpawn[+3REP] - Amine_Mejrhirrou - 10.10.2012

? 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]


Re: [HELP]OnVehicleSpawn[+3REP] - Riddick94 - 10.10.2012

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


Re : [HELP]OnVehicleSpawn[+3REP] - Amine_Mejrhirrou - 10.10.2012

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


Re: [HELP]OnVehicleSpawn[+3REP] - mastermax7777 - 10.10.2012

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


Re: [HELP]OnVehicleSpawn[+3REP] - ViniBorn - 10.10.2012

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



Re : [HELP]OnVehicleSpawn[+3REP] - Amine_Mejrhirrou - 11.10.2012

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;
		}
         }



Re: [HELP]OnVehicleSpawn[+3REP] - 2KY - 11.10.2012

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.


Re : [HELP]OnVehicleSpawn[+3REP] - Amine_Mejrhirrou - 11.10.2012

... 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 ?