SA-MP Forums Archive
Tag mismatching? - 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 mismatching? (/showthread.php?tid=463480)



Tag mismatching? - Swyft™ - 12.09.2013

I am trying to script stuff for my server but I keep getting these random tag mismatch errors

pawn Код:
if(Octane[playerid] == 1) return GiveDodMoney(playerid, -(Refill[playerid]*4*2.10));
        if(Octane[playerid] == 2) return GiveDodMoney(playerid, -(Refill[playerid]*4*2.16));
        if(Octane[playerid] == 3) return GiveDodMoney(playerid, -(Refill[playerid]*4*2.32));
        if(Octane[playerid] == 4) return GiveDodMoney(playerid, -(Refill[playerid]*4*2.99));
Now, this gives me these errors

pawn Код:
C:\Users\KiNG3\Desktop\Pengu1n\Gameservers\SA-MP\zGaming\gamemodes\URSP.pwn(39088) : warning 213: tag mismatch
C:\Users\KiNG3\Desktop\Pengu1n\Gameservers\SA-MP\zGaming\gamemodes\URSP.pwn(39089) : warning 213: tag mismatch
C:\Users\KiNG3\Desktop\Pengu1n\Gameservers\SA-MP\zGaming\gamemodes\URSP.pwn(39090) : warning 213: tag mismatch
C:\Users\KiNG3\Desktop\Pengu1n\Gameservers\SA-MP\zGaming\gamemodes\URSP.pwn(39091) : warning 213: tag mismatch
But I used the exact same thing for my other ones, and they don't give me warnings.

Lines: 39099-39102

pawn Код:
if(Octane[playerid] == 1) { FamInfo[idx][fMoney] += Refill[playerid]*4/2.10; }
            else if(Octane[playerid] == 2) { FamInfo[idx][fMoney] += Refill[playerid]*4/2.16; }
            else if(Octane[playerid] == 3) { FamInfo[idx][fMoney] += Refill[playerid]*4/2.32; }
            else if(Octane[playerid] == 4) { FamInfo[idx][fMoney] += Refill[playerid]*4/2.99; }
Any idea what's up?


Re: Tag mismatching? - AaronKillz - 12.09.2013

-= with an equal symbol at the end of ' - ', not just -


Re: Tag mismatching? - Swyft™ - 12.09.2013

Nope, that is not correct because it gives me these errors now

pawn Код:
C:\Users\KiNG3\Desktop\Pengu1n\Gameservers\SA-MP\zGaming\gamemodes\URSP.pwn(39088) : error 022: must be lvalue (non-constant)
C:\Users\KiNG3\Desktop\Pengu1n\Gameservers\SA-MP\zGaming\gamemodes\URSP.pwn(39089) : error 022: must be lvalue (non-constant)
C:\Users\KiNG3\Desktop\Pengu1n\Gameservers\SA-MP\zGaming\gamemodes\URSP.pwn(39090) : error 022: must be lvalue (non-constant)
C:\Users\KiNG3\Desktop\Pengu1n\Gameservers\SA-MP\zGaming\gamemodes\URSP.pwn(39091) : error 022: must be lvalue (non-constant)



Re: Tag mismatching? - Misiur - 12.09.2013

pawn Код:
if(Octane[playerid] == 1) return GiveDodMoney(playerid, -floatround(Refill[playerid]*4*2.10, floatround_ceil));
if(Octane[playerid] == 2) return GiveDodMoney(playerid, -floatround(Refill[playerid]*4*2.16, floatround_ceil));
if(Octane[playerid] == 3) return GiveDodMoney(playerid, -floatround(Refill[playerid]*4*2.32, floatround_ceil));
if(Octane[playerid] == 4) return GiveDodMoney(playerid, -floatround(Refill[playerid]*4*2.99, floatround_ceil));
Also why not simplify that code?

pawn Код:
new
    Float:multiplier = 2.10;
switch(Octane[playerid]) {
    case 2: multiplier = 2.16;
    case 3: multiplier = 2.32;
    case 4: multiplier = 2.99;
    default: multiplier = 2.10;
}
return GiveDodMoney(playerid, -floatround(Refill[playerid] * 4 * multiplier, floatround_ceil));



Re: Tag mismatching? - Swyft™ - 12.09.2013

Well I just want to make my system, what I do is... I build what I want to build, then I go back and find a better more efficient way of creating it.


Re: Tag mismatching? - Misiur - 12.09.2013

There's nothing wrong with that, but when you'll have to go back in future to fix/add something, then eyes tend to bleed

This version isn't more efficient, but it won't cause any problems to add some new values in future using half the code from first version.


Re: Tag mismatching? - Swyft™ - 12.09.2013

Nah, your way wouldn't hurt at all.... I actually never thought of doing simple ways of *2/2.10 (etc). I will think of it next time though


Off-topic: 400th post