SA-MP Forums Archive
help using "if" with an array - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: help using "if" with an array (/showthread.php?tid=206762)



help using "if" with an array - linuxthefish - 04.01.2011

Can someone tell me if i have set this bit of code out properly?
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	if(gion[playerid] == 1) return 0;
        if(gipassenger[playerid] == 0) return 0;
        PutPlayerInVehicle(playerid, vehicleid, 0);
	if(gipassenger[playerid] == 1) return 0;
	PutPlayerInVehicle(playerid, vehicleid, 15);
	return 1;
}
It works if i do;
Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
	if(gion[playerid] == 1) return 0;
        PutPlayerInVehicle(playerid, vehicleid, 0);
	return 1;
}



Re: help using "if" with an array - linuxthefish - 04.01.2011

*Bump* I NEED this fixing soon!!


Re: help using "if" with an array - Alex_Valde - 04.01.2011

I know that you think it's an emergency but you know there some rules here:
Quote:
Do not bump
Some people apparently think they are important enough to bump their own topic after 10 minutes.
You can bump topics when the last reply is at least 48 hours old, and it needs to have useful information about your problem.

And now you should probably test it and see if it works, and if it doesn't that post what you think it's the problem and then we can help you.
Oh yeah, one more thing, don't use "if" everywhere, first put "if" and then "else if" .

You can look here for more info.