Tag Mismatch? How... - 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: Tag Mismatch? How... (
/showthread.php?tid=483445)
Tag Mismatch? How... -
MsgtHill - 26.12.2013
So I decided to make getting the player's health a little quicker with this stock:
Код:
stock GetHealth(playerid)
{
new Float:x;
GetPlayerHealth(playerid, x);
return x;
}
But when I compile it says I have a tag mismatch on the 'return' line. I am not seeing the tag mismatch here.
Re: Tag Mismatch? How... -
Hansrutger - 26.12.2013
Can't be right haha, I don't see anything wrong with the code. On which line of the ones you've shown does it say that?
Re: Tag Mismatch? How... -
MsgtHill - 26.12.2013
Код:
(292) : warning 213: tag mismatch
Line 292 is where I return 'x'.
Re: Tag Mismatch? How... -
MsgtHill - 26.12.2013
Alright, figured it out.
Correct way:
Код:
forward Float:GetHealth(playerid);
public Float:GetHealth(playerid)
{
new Float:x;
GetPlayerHealth(playerid, x);
return x;
}
The reason for this, correct me if I'm wrong, is that functions which return a tag, such as a float, need to be forwarded and tagged.