SA-MP Forums Archive
Question - 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: Question (/showthread.php?tid=176546)



Question - [LSB]TheGame - 13.09.2010

How to make this work for 5, 6 and 7?

if(PlayerData[playerid][groverank] != 5 | 6 | 7) return SendClientMessage(playerid, RED, "SERVER MESSAGE: You cannot buy this weapon because of your Street Credit");


Re: Question - [LSB]TheGame - 13.09.2010

B2K - bump bump bump


Re: Question - Nero_3D - 13.09.2010

use || instead of |

|| logical or
| bitwise or


Re: Question - RoBo - 13.09.2010

if(PlayerData[playerid][groverank] != 5 || PlayerData[playerid][groverank] != 6 || PlayerData[playerid][groverank] != 7)


Re: Question - [LSB]TheGame - 13.09.2010

ok thanks


Re: Question - CuervO - 13.09.2010

pawn Код:
if(PlayerData[playerid][groverank] < 5 && PlayerData[playerid][groverank] > 7)
{
//your code
}
this would make the code work for anyone with a rank below 5 and above 7


Re: Question - [LSB]TheGame - 13.09.2010

yeah but the code only suppose to work for 5, 6 and 7


Re: Question - stix - 13.09.2010

this is a bump


Re: Question - [LSB]TheGame - 13.09.2010

Код:
if(PlayerColour == TEAM_GROVE)
	{
    if(PlayerData[playerid][groverank] != 5 || PlayerData[playerid][groverank] != 6 || PlayerData[playerid][groverank] != 7)
 	return SendClientMessage(playerid, RED, "SERVER MESSAGE: You cannot buy this weapon because of your Street Credit");
	}
isnt working


Re: Question - Mauzen - 13.09.2010

Its just a simple problem. If you use '||' ('or') it goes like this: Is the variable not 5 OR not 6 OR not 7 will always be true, because the variable would need to be 5, 6 and 7 at the same time to return true here. Use && (AND) instead (not 5 AND not 6 AND not 7)

@Cuervo: You made a similar mistake. Swap the '<' and '>'. Your check will never be true, because a variable cant be smaller than 5 and bigger than 7 at the same time