warning 213: tag mismatch on custom function
#1

Hello, I am creating a anti-hack system, and of course I had to create a new way to set armor.

This is my function:

pawn Код:
stock SetCutArmor(playerid, amount)
{
    PlayerInfo[playerid][pArmor] = amount;
    return 1;
}
In my tazer command, I added this to replenish armor if hit by a tazer:
pawn Код:
SetCutArmor(Target, ArmourLost+Armor);
However, on that line I got this warning:
Код:
warning 213: tag mismatch
Any ideas on how to fix this?
Reply
#2

Actually, you get armour as a floating point value. In your function, however, you use an integer. You have to floatround that lostarmour to an integer first.
Reply
#3

Quote:
Originally Posted by Grand_Micha
Посмотреть сообщение
Actually, you get armour as a floating point value. In your function, however, you use an integer. You have to floatround that lostarmour to an integer first.
How would I go about doing that?
Reply
#4

First off, post the code with ArmourLost. What exactly is it?
Reply
#5

pawn Код:
if(IsACop(Shooter))
    {
        if(Tazer[Shooter])
        {
            if(GetPlayerWeapon(Shooter) == 23)
            {
                if(!IsPlayerTazed(Target) && !IsPlayerCuffed(Target) && !IsPlayerTied(Target))
                {
                    new Float:HP, Float:Armor;
                    GetPlayerHealth(Target, HP);
                    GetPlayerArmour(Target, Armor);
                    SetPlayerHealth(Target, HealthLost+HP);
                    SetCutArmor(Target, ArmourLost+Armor);
                    if(!IsPlayerNearPlayer(Shooter, Target, 8)) return SendClientMessage(Shooter, COLOR_GREY, "You are too far away from that player.");
                    if(IsHoldingFirearm(Target)) return SendClientMessage(Shooter, COLOR_GREY, "You can't taze someone with a gun in hand.");
                    // Got Tazed
                    format(string, sizeof(string), "* %s aims their tazer on %s and tazes them.", RPN(Shooter), RPN(Target));
                    SendNearbyMessage(Shooter, 15, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
                    GameTextForPlayer(Target, "~r~Tazed", 3500, 3);
                    // Custom Freeze
                    ApplyAnimation(Target,"CRACK","crckdeth2",4.1,0,1,1,1,1,1);
                    TogglePlayerControllable(Target, 0);
                    // Tazed Detecting
                    TogglePlayerTazed(Target, 1);
                    // Tazer Timeout
                    TazeTimeout[Target] = 11;
                    TazeCountDown[Target] = SetTimerEx("TazeTimer", 1000, true, "d", Target);
                }

            }
        }
    }
Reply
#6

Simply use the floatround function on the variable that is causing the issue, as the function will round off the float to an integer, which is what your function requires, I suspect it's the "Armor" variable, so you can fix the warning by simply doing something like this:

pawn Код:
SetCutArmor(Target, ArmourLost + floatround(Armor));
That's assuming ArmourLost is an integer, if it isn't, then you should do this:

pawn Код:
SetCutArmor(Target, floatround(ArmourLost + Armor));
Alternatively, you could just make your function accept float values by adding the Float tag before the parameter.

Hope that helps!
Reply
#7

stock SetCutArmor(playerid, Float:amount)

Try this first; if it doesn't work, ask.

If you are using the code of the gentleman here, please ignore the float.
Reply
#8

Thanks to both of you for your help, greatly appreciated.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)