SA-MP Forums Archive
Tag mismatch, where? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Tag mismatch, where? (/showthread.php?tid=277559)



Tag mismatch, where? - Gemini - 18.08.2011

: warning 213: tag mismatch

PHP код:
public OnBombExplode(playeridnumFloat:xFloat:yFloat:z)
{
        
//is called everytime a bomb explodes
        
for(new 0MAX_PLAYERS++) {
            if(
GetPlayerDistanceToPoint(ixyz) < gBombTypes[btype[playerid][num]][2]) {
                
SetPVarInt(i"nearExp"playerid);
                
SetTimerEx("ResetNearExp"150000"i"i);
            }
        }
        return 
1;

in the line with "if(GetPlayerDistance etc" should be a mistag, what is it? :S


Re: Tag mismatch, where? - Pinguinn - 18.08.2011

You are using GetPlayerDistanceToPoint which is 2D. That means it isn't using the z-float
If you want to use the z-float, you need to get GetPlayerDistanceToPointEx
So I fixed it

pawn Код:
public OnBombExplode(playerid, num, Float:x, Float:y, &Float:z)
{
        //is called everytime a bomb explodes
        for(new i = 0; i < MAX_PLAYERS; i ++) {
            if(GetPlayerDistanceToPoint(i, x, y) < 2 * gBombTypes[btype[playerid][num]][2]) {
                SetPVarInt(i, "nearExp", playerid);
                SetTimerEx("ResetNearExp", 15000, 0, "i", i);
            }
        }
        return 1;
}
If you still get a tag mismatch, remove &Float:z in OnBombExplode

Or if you use GetPlayerDistanceToPointEx, you can simply edit the line to
pawn Код:
if(GetPlayerDistanceToPointEx(i, x, y) < 2 * gBombTypes[btype[playerid][num]][2]) {



Re: Tag mismatch, where? - MadeMan - 18.08.2011

Show
pawn Код:
new gBombTypes
and
pawn Код:
new btype



Re: Tag mismatch, where? - RyDeR` - 18.08.2011

pawn Код:
public OnBombExplode(playerid, num, Float:x, Float:y, Float:z)
{
        //is called everytime a bomb explodes
        for(new i = 0; i < MAX_PLAYERS; i ++) {
            if(GetPlayerDistanceToPoint(i, x, y, z) < float(2 * gBombTypes[btype[playerid][num]][2])) {
                SetPVarInt(i, "nearExp", playerid);
                SetTimerEx("ResetNearExp", 15000, 0, "i", i);
            }
        }
        return 1;
}