Ternary operator - Variable not used?
#1

pawn Код:
new bool:autos = (IsPlayerInAnyVehicle(playerid) && !IsABike(vid) && !AutoInfo[vid][vAken]);
    LimiteeritudKaugus((autos ? 5 : 20), playerid, COLOR_WHITE, string)
    SetPlayerChatBubble(playerid, text, COLOR_WHITE, (autos ? 5 : 20), aeg);
As you can see, I have used the variable "autos" twice but I still get this warning:

C:\Users\Kristo\Dropbox\Server (2)\IMPO\Server\gamemodes\imperial.pwn(3389) : warning 204: symbol is assigned a value that is never used: "autos"

What should I do?
Reply
#2

Try putting on the top of your script
pawn Код:
new autos;
Reply
#3

Booleans are automaticly false .. should use

pawn Код:
new bool:autos = true;
pawn Код:
if(autos == true) { /* do whatever you want */ }
Reply
#4

Please... Just don't... Those answers were terrible.
There actually was another variable called "autos" and that one wasn't used.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)