symbol is assigned a value that is never used - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: symbol is assigned a value that is never used (
/showthread.php?tid=405624)
symbol is assigned a value that is never used -
OTACON - 07.01.2013
What Happens?
EJEMPLE:
pawn Code:
#include <a_samp>
#define valor (20)
new valores;
public OnFilterScriptInit()
{
valores = valor; //warning 204: symbol is assigned a value that is never used: "valores"
return 1;
}
public OnPlayerConnect(playerid) //Ejemple
{
GivePlayerMoney(playerid, 2*valor); //Ejemple
return 1;
}
Thanks in advance
sorry for my English.
Re: symbol is assigned a value that is never used -
Konstantinos - 07.01.2013
You assign to valores a value of 20, but you don't use it anywhere to your script. Use it somewhere or just delete it becasue it's pointless.
Respuesta: symbol is assigned a value that is never used -
OTACON - 07.01.2013
pawn Code:
#include <a_samp>
#define valor (20)
new valores;
public OnFilterScriptInit()
{
valores = valor; //warning 204: symbol is assigned a value that is never used: "valores"
return 1;
}
public OnPlayerConnect(playerid) //Ejemple
{
GivePlayerMoney(playerid, 2*valores); //<------
return 1;
}
I was getting bad XD
Re: symbol is assigned a value that is never used -
Konstantinos - 07.01.2013
In my opinion, it's still pointless though. You can just do.
pawn Code:
#include <a_samp>
#define valores 20
public OnFilterScriptInit()
{
return 1;
}
public OnPlayerConnect(playerid)
{
GivePlayerMoney(playerid, 2*valores);
return 1;
}
And you don't need to define a new variable or that.
Respuesta: Re: symbol is assigned a value that is never used -
OTACON - 07.01.2013
Quote:
Originally Posted by Dwane
In my opinion, it's still pointless though. You can just do.
pawn Code:
#include <a_samp>
#define valores 20
public OnFilterScriptInit() { return 1; }
public OnPlayerConnect(playerid) { GivePlayerMoney(playerid, 2*valores); return 1; }
And you don't need to define a new variable or that.
|
not because I want to create a command to change the value of 'values' and 'define' does not work.
Re: Respuesta: Re: symbol is assigned a value that is never used -
u3ber - 07.01.2013
Quote:
Originally Posted by bytytus
not because I want to create a command to change the value of 'values' and 'define' does not work.
|
because all the define does is replace any occurrences of the identifier (valores) with 20. and the reason why you can't change the value is because valores is treated as a const value (plus it doesn't exist in memory, how are you expecting to access it?)
just create a variable, initialize it with what-ever value and then use it.