It says variable isn't used, although it is. -
Dinoo - 27.03.2016
Basically I have set up this variable to tell the script if the game has been started or not
0 being game hasn't started
1 game has been started
PHP код:
if(incc[playerid] == 1)
{
if (copsjoined - 1 == 0)
{
[B]game = 0;[/B] //<--- This is the line that is giving me problems
}
else
{
copsjoined--;
new death[128];
format(death, sizeof(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
Re: It says variable isn't used, although it is. -
Konstantinos - 27.03.2016
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:
and the compile will.
Re: It says variable isn't used, although it is. -
Dinoo - 27.03.2016
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:
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
Re: It says variable isn't used, although it is. -
SickAttack - 27.03.2016
Just place "#pragma unused game" after "if(incc[playerid] == 1)" & "{". And remove it when you actually use the variable somewhere.
Re: It says variable isn't used, although it is. -
Dinoo - 27.03.2016
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
Re: It says variable isn't used, although it is. -
SickAttack - 27.03.2016
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.