[Ajuda] Warning: local variable "playermoney"
#1

Olв pessoal do forum-samp, hoje vou querer ajuda de vocкs pois minha GM esta dando este seguinte warning:

Код HTML:
C:\Documents and Settings\P. Henrique\Desktop\The New Life\gamemodes\BUL.pwn(12445) : warning 219: local variable "playermoney" shadows a variable at a preceding level
Tentei, tentei mais nгo tirei este warning!
Reply
#2

Significa que a variбvel foi definida dentro de uma callback e outra fora da callback.
Reply
#3

Olha ae, ta dando erro no "new playermoney;" e o que esta "Fim da GM toda!" acho que esta bugado.

Код HTML:
// Comeзo do OnPlayerCommandText.

public OnPlayerCommandText(playerid,cmdtext[])
{
	new string[256];
        new playermoney;
	new sendername[MAX_PLAYER_NAME];
	new giveplayer[MAX_PLAYER_NAME];
	new playername[MAX_PLAYER_NAME];
	new cmd[256];
	new tmp[256];
	new giveplayerid,moneys,idx;
	cmd = strtok(cmdtext,idx);

...

... 

...

}

stock GivePlayerMoneyEx(playerid,ammount)return playermoney[playerid] += ammount;
GetPlayerMoneyEx(playerid)return playermoney[playerid];
ResetPlayerMoneyEx(playerid)return playermoney[playerid] = 0;

// Fim da GM toda!
O'que vocкs acham?
Reply
#4

PHP код:
new playermoney[MAX_PLAYERS]; 
Reply
#5

Nгo estб no fim do Gm.
Olha este exemplo:

Se eu colocar:
pawn Код:
new Exemplo;
E devolta dentro de uma callnack
pawn Код:
public Exemplo(playerid)
{
    new Exemplo;
    return 1;
}
Vai dar esse aviso se eu fazer isso logo acima.
Entгo apague a variбvel playermoney que estб na callback OnPlayerCommandText.
Reply
#6

Okay, tentar aqui.
Reply
#7

Entгo tб faltando uma 'return 1;' ?
Reply
#8

Como assim?
Reply
#9

Quote:
Originally Posted by SkullGamer
Посмотреть сообщение
PHP код:
new playermoney[MAX_PLAYERS]; 
Jб tentei e o warning continua...
Reply
#10

Valeu, deu tudo certo!

Код HTML:
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase

Header size:           9088 bytes
Code size:          1592760 bytes
Data size:          4768948 bytes
Stack/heap size:      16384 bytes; estimated max. usage=5643 cells (22572 bytes)
Total requirements: 6387180 bytes
++rep
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)