SA-MP Forums Archive
warning 204: 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: warning 204: symbol is assigned a value that is never used (/showthread.php?tid=587149)



warning 204: symbol is assigned a value that is never used - ax1 - 28.08.2015

Код:
CMD:tree(playerid, params[])
{
new Float:x[200], Float:y[200], Float:z[200];
new randomtree[][3]=
{
{697}, {704}, {731}
};
new randomtree1=random(sizeof(randomtree));
for(new i; i<sizeof(treeobject); i++)
{
if(!IsValidDynamicObject(treeobject[i]))
{
GetPlayerPos(playerid, x[i], y[i], z[i]);
treeobject[i]=CreateDynamicObject(randomtree1, x[i], y[i],z[i]+10, 0, 0, 0.00);
}
}
return 1;
}
Код:
warning 204: symbol is assigned a value that is never used: "randomtree"



Re: warning 204: symbol is assigned a value that is never used - Karlasx - 28.08.2015

Try to change it to new randomtree1[][3]=


Re: warning 204: symbol is assigned a value that is never used - ax1 - 28.08.2015

Quote:
Originally Posted by Karlasx
Посмотреть сообщение
Try to change it to new randomtree1[][3]=
Didn't helped.


Re: warning 204: symbol is assigned a value that is never used - Karlasx - 28.08.2015

Then just try to delete it because it's never used just delete it


Re: warning 204: symbol is assigned a value that is never used - Vince - 28.08.2015

sizeof(randomtree) is 3. Hence, randomtree1 can be 0, 1 or 2. this is the index, not the object model obviously. You need to access the array with the index to get the object model. On another note, you don't need a 2D array for this. Makes everything needlessly complicated.

pawn Код:
new randomtree[] = {697, 704, 731};
// ...
new randomIndex = random(sizeof(randomtree));
CreateDynamicObject(randomtree[randomIndex], x[i], y[i],z[i]+10, 0, 0, 0.00);



Re: warning 204: symbol is assigned a value that is never used - ax1 - 28.08.2015

Quote:
Originally Posted by Karlasx
Посмотреть сообщение
Then just try to delete it because it's never used just delete it
In that case could you tell me how to create variable that randomly 697 or 704 or 731?


Re: warning 204: symbol is assigned a value that is never used - ax1 - 28.08.2015

Quote:
Originally Posted by Vince
Посмотреть сообщение
sizeof(randomtree) is 3. Hence, randomtree1 can be 0, 1 or 2. this is the index, not the object model obviously. You need to access the array with the index to get the object model. On another note, you don't need a 2D array for this. Makes everything needlessly complicated.

pawn Код:
new randomtree[] = {697, 704, 731};
// ...
new randomIndex = random(sizeof(randomtree));
CreateDynamicObject(randomtree[randomIndex], x[i], y[i],z[i]+10, 0, 0, 0.00);
That's what I needed, thank you.