[Ajuda] Nao estou conseguindo tirar esses avisos
#1

Me perdoem por ser muito novato em pawno, mas quero aprender com meus erros e ver o que vocкs acham sobre esse erro
DOF2_SetFloat(gfile, "Vida", GetPlayerHealth(playerid));
DOF2_SetFloat(gfile, "Colete", GetPlayerArmour(playerid));


esta dando essas duas warnings :
C:\Users\user\Desktop\server\gamemodes\GM.pwn(81) : warning: 202: number of arguments does not match definition
C:\Users\user\Desktop\server\gamemodes\GM.pwn(81) : warning: 202: number of arguments does not match definition


Como disse, sou muito novato e tenho uma longa jornada para aprender ai o pawno, se alguem se dispor a me dar uns conselhos:

skype: victorhugoloko345

Se nгo acharem me chame por aqui mesmo e me passem os de Vcs!
obrigado pela atenзгo !
Reply
#2

O problema estб nas duas funзхes, vocк estб passando 1 argumento em uma funзгo que deve passar 2.
https://sampwiki.blast.hk/wiki/GetPlayerHealth
https://sampwiki.blast.hk/wiki/GetPlayerArmour
Reply
#3

Continuo sem entender, para ver como eu sou lerdo nessas coisas, poderia me explicar de uma forma que eu aprenda e nao esqueзa mais ?
Reply
#4

Quote:
Originally Posted by vitinhosamp
Посмотреть сообщение
Continuo sem entender, para ver como eu sou lerdo nessas coisas, poderia me explicar de uma forma que eu aprenda e nao esqueзa mais ?
A prуpria wiki explica, mas vamos lб.

O warning lhe informou o problema "number of arguments does not match definition" isso significa que vocк nгo colocou o nъmero de argumentos necessбrios da funзгo.

Quando eu crio uma funзгo, exemplo:

PHP код:
Soma(a,b)
    return 
b
e uso:

PHP код:
Soma(1); 
Isso vai me gerar este aviso: "number of arguments does not match definition".

O correto seria passar dois argumentos:
PHP код:

Soma
(1,2); 
Estas 2 funзхes que vocк usou:

pawn Код:
GetPlayerHealth
GetPlayerArmour
Necessitam de 2 argumentos e vocк sу passou um, veja a diferenзa:

Errado (modo que vocк fez):

PHP код:
GetPlayerHealth(playerid);
GetPlayerArmour(playerid); 
Correto:

PHP код:
 new Float:healthFloat:armour;
 
GetPlayerHealth(playeridhealth);
 
 
GetPlayerArmour(playeridarmour); 
Reply
#5

@Edit
Jб responderam.
Reply
#6

Acho que agora esta mais certo
public OnPlayerDisconnect(playerid, reason)
{
new string[64], Float:health, Float:armour;
format(string, sizeof(string), "O player %s se conectou ao servidor!", Pname(playerid));
SendClientMessageToAll(-1, string);
format(gfile, sizeof(gfile), "Contas/%s.txt", Pname(playerid));
if(DOF2_FileExists(gfile))
{
DOF2_SetInt(gfile, "Dinheiro", GetPlayerMoney(playerid));
DOF2_SetFloat(gfile, "Vida", GetPlayerHealth(playerid, health));
DOF2_SetFloat(gfile, "Colete", GetPlayerArmour(playerid, armour));
DOF2_SetInt(gfile, "Level", GetPlayerScore(playerid));
DOF2_SetInt(gfile, "Ajudante", aInfo[playerid][Ajudante]);
DOF2_SetInt(gfile, "Moderador", aInfo[playerid][Moderador]);
DOF2_SetInt(gfile, "Corregedor", aInfo[playerid][Corregedor]);
DOF2_SetInt(gfile, "Administrador", aInfo[playerid][Administrador]);
DOF2_SetInt(gfile, "Master", aInfo[playerid][Master]);
DOF2_SaveFile();
}
return 1;
}

vlw mesmo <3, se quiser me chamar no skype pra me dar mais umas ajudadas la,
skype: victorhugoloko345
Reply
#7

Quote:
Originally Posted by vitinhosamp
Посмотреть сообщение
Acho que agora esta mais certo
public OnPlayerDisconnect(playerid, reason)
{
new string[64], Float:health, Float:armour;
format(string, sizeof(string), "O player %s se conectou ao servidor!", Pname(playerid));
SendClientMessageToAll(-1, string);
format(gfile, sizeof(gfile), "Contas/%s.txt", Pname(playerid));
if(DOF2_FileExists(gfile))
{
DOF2_SetInt(gfile, "Dinheiro", GetPlayerMoney(playerid));
DOF2_SetFloat(gfile, "Vida", GetPlayerHealth(playerid, health));
DOF2_SetFloat(gfile, "Colete", GetPlayerArmour(playerid, armour));
DOF2_SetInt(gfile, "Level", GetPlayerScore(playerid));
DOF2_SetInt(gfile, "Ajudante", aInfo[playerid][Ajudante]);
DOF2_SetInt(gfile, "Moderador", aInfo[playerid][Moderador]);
DOF2_SetInt(gfile, "Corregedor", aInfo[playerid][Corregedor]);
DOF2_SetInt(gfile, "Administrador", aInfo[playerid][Administrador]);
DOF2_SetInt(gfile, "Master", aInfo[playerid][Master]);
DOF2_SaveFile();
}
return 1;
}

vlw mesmo <3, se quiser me chamar no skype pra me dar mais umas ajudadas la,
skype: victorhugoloko345
Nada, sу pra nгo passar em branco, existe diferenзa entre warning e erro. O seu caso foi um warning ou seja o amx foi gerado e vocк vai conseguir jogar no servidor, mas irб ocorrer problemas indesejбveis por conta do warning, O erro jб nгo gera o amx. Nгo uso skype faz um bom tempo, eu uso discord, caso queira adicionar: FerrariL
#5104
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)