Ternary operator...
#1

pawn Code:
PlayerData[playerid][E_PLAYER_MONEY] += (money > MAX_PLAYER_MONEY ? MAX_PLAYER_MONEY : money);
Any idea why it's not working? I do not want to exceed some value to the player variable E_PLAYER_MONEY.
Reply
#2

Bump.

edit://
Fixed.
Reply
#3

pawn Code:
PlayerData[playerid][E_PLAYER_MONEY] += (money > MAX_PLAYER_MONEY) ? MAX_PLAYER_MONEY : money;
Only a condition should be parenthesized.
Reply
#4

pawn Code:
PlayerData[playerid][E_PLAYER_MONEY] += ( (money > MAX_PLAYER_MONEY) ? (MAX_PLAYER_MONEY) : (money) );
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)