warning 204: symbol is assigned a value that is never used
#1

Код:
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"
Reply
#2

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

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

Then just try to delete it because it's never used just delete it
Reply
#5

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);
Reply
#6

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?
Reply
#7

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)