It says variable isn't used, although it is.
#1

Basically I have set up this variable to tell the script if the game has been started or not

PHP код:
new game=0
0 being game hasn't started
1 game has been started

PHP код:
    if(incc[playerid] == 1)
    {
        if (
copsjoined == 0)
        {
            [
B]game 0;[/B]  //<--- This is the line that is giving me problems
        
}
        else
        {
        
copsjoined--;
        new 
death[128];
        
format(deathsizeof(death), "%s was killed on duty!"PlayerName);
        
SendClientMessageToAll(0xC93E3EFF,death);
        
incc[playerid] = 0;
        }
    }
       return 
1
This is where I am using the code and basically I am trying to say in English:

If the player is in the mini game

IF THE amount of cops left minus one is equal to 0

then end the game (set the game variable to 0)

else

Take a away amount of cops left
Say that the cop has died
The user is set to not being in the game


The error that I am getting:


warning 204: symbol is assigned a value that is never used: "game"



I really want to get into scripting and pawn is my starting area, I really appreciated your help as you are helping me do something I am actually interested in


EDIT: +Rep for all help
Reply
#2

It's nothing to worry about. You set "game" with a value of 0 but other than that you don't use it (like checking its value in a statement).

I'd say ignore that warning (as it won't cause any problems) until you use it in the script or if you just can't:
pawn Код:
new stock game=0;
and the compile will.
Reply
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
It's nothing to worry about. You set "game" with a value of 0 but other than that you don't use it (like checking its value in a statement).

I'd say ignore that warning (as it won't cause any problems) until you use it in the script or if you just can't:
pawn Код:
new stock game=0;
and the compile will.
Do you have Skype?

That worked out thank you.

I need someone that will be a mentor and can answer my questions and help me think how I would do things.

At the moment I am making a very simple minigame and I am willing to pay you Bitcoin or Paypal, I am happy to pay as I am learning
Reply
#4

Just place "#pragma unused game" after "if(incc[playerid] == 1)" & "{". And remove it when you actually use the variable somewhere.
Reply
#5

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
Just place "#pragma unused game" after "if(incc[playerid] == 1)" & "{". And remove it when you actually use the variable somewhere.
I am actually using that variable though arn't I? I using it to tell the script whether the game is in progress or not.

It will be used to tell users that are trying to join whether or not they can join because it is progress or not
Reply
#6

Quote:
Originally Posted by Dinoo
Посмотреть сообщение
I am actually using that variable though arn't I? I using it to tell the script whether the game is in progress or not.

It will be used to tell users that are trying to join whether or not they can join because it is progress or not
Well, technically you are setting it there to 0, which can be considered as being "used". But you aren't actually using the value within in.

Example:
pawn Код:
if(game) // if game is not 0
if(!game) // if game is 0
There's no use in giving it a value, if the value itself isn't going to be used whatsoever.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)