Question
#1

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");
Reply
#2

B2K - bump bump bump
Reply
#3

use || instead of |

|| logical or
| bitwise or
Reply
#4

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

ok thanks
Reply
#6

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
Reply
#7

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

this is a bump
Reply
#9

Код:
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
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)