Tag Mismatch? How...
#1

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.
Reply
#2

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?
Reply
#3

Код:
(292) : warning 213: tag mismatch
Line 292 is where I return 'x'.
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)