SA-MP Forums Archive
argument type mismatch (argument 2) - 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: argument type mismatch (argument 2) (/showthread.php?tid=452716)



argument type mismatch (argument 2) - N0FeaR - 22.07.2013

pawn Код:
}
forward vitals(playerid);
public vitals(playerid)
{
    new string[5];
    new Float:pHealth, Float:pArmour;
    GetPlayerHealth(playerid,pHealth);
    GetPlayerArmour(playerid,pArmour);
    format(string, sizeof(string), "%.0f%", pHealth);
    TextDrawSetString(Health[playerid], string);
    format(string, sizeof(string), "%.0f%", pArmour);
    TextDrawSetString(Armour[playerid], string);
}
Error
Код:
C:\Users\N0FeaR\Desktop\PG\gamemodes\PG.PWN(2598) : warning 219: local variable "pHealth" shadows a variable at a preceding level
C:\Users\N0FeaR\Desktop\PG\gamemodes\PG.PWN(2599) : error 035: argument type mismatch (argument 2)
C:\Users\N0FeaR\Desktop\PG\gamemodes\PG.PWN(2598) : warning 203: symbol is never used: "pHealth"
This one
Код:
line 2598 new Float:pHealth, Float:pArmour;
line 2599 GetPlayerHealth(playerid,pHealth);
thanks in advance


Re: argument type mismatch (argument 2) - PrinceKumar - 22.07.2013

it means you have already use new pHealth; find for it in your script


Re: argument type mismatch (argument 2) - Remba031 - 22.07.2013

Код:
public vitals(playerid)
{
    new string[5];
    GetPlayerHealth(playerid,pHealth);
    GetPlayerArmour(playerid,pArmour);
    format(string, sizeof(string), "%.0f%", pHealth);
    TextDrawSetString(Health[playerid], string);
    format(string, sizeof(string), "%.0f%", pArmour);
    TextDrawSetString(Armour[playerid], string);
}



Re: argument type mismatch (argument 2) - N0FeaR - 22.07.2013

Removed this
Код:
new Float:pHealth, Float:pArmour;
Still getting those errors...


Re : argument type mismatch (argument 2) - ShadowMultiGaming - 22.07.2013

pHealth is already define before in the script.