local variable "Pos" shadows a variable at a preceding level
#1

http://forum.sa-mp.com/showpost.php?...2&postcount=52

pleas help
Reply
#2

Change the name of the variable?
Reply
#3

what value ?
Reply
#4

What value what?

Rename the variable

PHP код:
 new Float:Pos[3]; 
to
PHP код:
 new Float:fPos[3]; 
or whatever you want and make sure the rest of the code that involves that variable gets its name changed aswell, like the following code:
PHP код:
GetPlayerPos(playeridPos[0], Pos[1], Pos[2]); 
would be
PHP код:
GetPlayerPos(playeridfPos[0], fPos[1], fPos[2]); 
Reply
#5

Quote:
Originally Posted by Toroi
Посмотреть сообщение
What value what?

Rename the variable

PHP код:
 new Float:Pos[3]; 
to
PHP код:
 new Float:fPos[3]; 
or whatever you want and make sure the rest of the code that involves that variable gets its name changed aswell, like the following code:
PHP код:
GetPlayerPos(playeridPos[0], Pos[1], Pos[2]); 
would be
PHP код:
GetPlayerPos(playeridfPos[0], fPos[1], fPos[2]); 
ichange but probleme still .. now i change Pos to pos and thiis fixed!! thanx
Reply
#6

Quote:
Originally Posted by Toroi
Посмотреть сообщение
What value what?

Rename the variable

PHP код:
 new Float:Pos[3]; 
to
PHP код:
 new Float:fPos[3]; 
or whatever you want and make sure the rest of the code that involves that variable gets its name changed aswell, like the following code:
PHP код:
GetPlayerPos(playeridPos[0], Pos[1], Pos[2]); 
would be
PHP код:
GetPlayerPos(playeridfPos[0], fPos[1], fPos[2]); 
This is really a bad workaround because it implies that there exists a global variable simply named "Pos", which is very bad practice.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)