if and or ( || ) statement help
#1

i made 3 money pickups and instead of making 3 different if statements i decided to use the or (||) function but it made it so everything that i pickup even if its a health pickup, it it makes it a money pickup

heres the code:
Код:
if(pickupid == moneypickup1 || moneypickup2 || moneypickup3)
{
	GivePlayerMoney(playerid,20000);
	GameTextForPlayer(playerid,"Found $20000!",3000,5);
}
anyone know whats wrong?
Reply
#2

You need to keep comparing the variables to each other, or else the compiler will think you mean one thing, when you really don't.

Do this:
pawn Код:
if(pickupid == moneypickup1 || pickupid == moneypickup2 || pickupid == moneypickup3)
~Cueball~
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)