SA-MP Forums Archive
[Help] Spam of warnings, tuuuhhh... - 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: [Help] Spam of warnings, tuuuhhh... (/showthread.php?tid=258165)



[Help] Spam of warnings, tuuuhhh... - LetsOWN[PL] - 29.05.2011

Hello.
T'day I was working with random spawns.
Everything's okey, but I receiving the following warning:
warning 213: tag mismatch

It's in lines 1131 -> 1135

Here are these lines:

pawn Код:
// {posX, posY, posZ, rot}
new Float:BattleFieldSpawns[4][4] = {
{-1132.9099, 1051.1733, 1346.1875, 90},
{-1130.3378, 1059.2005, 1346.1573, 90},
{-1126.56713867, 1092.78271484, 1345.50048828, 90},
{-1129.30297852, 1052.89721680, 1345.47644043, 90}};
Any suggestions?


Re: [Help] Spam of warnings, tuuuhhh... - MetalScript - 29.05.2011

Try this way:

pawn Код:
new Float:BattleFieldSpawns[][4] =
{
{-1132.9099, 1051.1733, 1346.1875, 90},
{-1130.3378, 1059.2005, 1346.1573, 90},
{-1126.56713867, 1092.78271484, 1345.50048828, 90},
{-1129.30297852, 1052.89721680, 1345.47644043, 90}
};
and then

pawn Код:
new rand = random(sizeof(BattleFieldSpawns));
SetPlayerPos(playerid, BattleFieldSpawns[rand][0], BattleFieldSpawns[rand][1],BattleFieldSpawns[rand][2]);
SetPlayerFacingAngle(playerid, BattleFieldSpawns[rand][3]);



Re: [Help] Spam of warnings, tuuuhhh... - LetsOWN[PL] - 29.05.2011

pawn Код:
new rand = random(sizeof(BattleFieldSpawns));
SetPlayerPos(playerid, BattleFieldSpawns[rand][0], BattleFieldSpawns[rand][1],BattleFieldSpawns[rand][2]);
SetPlayerFacingAngle(playerid, BattleFieldSpawns[rand][3]);
I did it already, before posting Anyway thanks. Well, everything is fine, even with these warnings, but.. warnings are annoying.. Thanks, I'll try this.


Re: [Help] Spam of warnings, tuuuhhh... - blewert - 29.05.2011

The 4th variable was an untagged integer in a Float tagged array. You need to convert the untagged integer to a tagged Float. I imagine if you're setting the players rotation, it needs to be a float anyways so just add '.0' to the end of it:

PHP код:
new Float:BattleFieldSpawns][ ] =
{
    { -
1132.90991051.17331346.187590.0 },
    { -
1130.33781059.20051346.157390.0 },
    { -
1126.567138671092.782714841345.5004882890.0 },
    { -
1129.302978521052.897216801345.4764404390.0 }
    
}; 
or change the tag:

PHP код:
new Float:BattleFieldSpawns][ ] =
{
    { -
1132.90991051.17331346.1875Float:90 },
    { -
1130.33781059.20051346.1573Float:90 },
    { -
1126.567138671092.782714841345.50048828Float:90 },
    { -
1129.302978521052.897216801345.47644043Float:90 }
    
}; 
.. or even use float():

PHP код:
new Float:BattleFieldSpawns][ ] =
{
    { -
1132.90991051.17331346.1875float(90) },
    { -
1130.33781059.20051346.1573float(90) },
    { -
1126.567138671092.782714841345.50048828float(90) },
    { -
1129.302978521052.897216801345.47644043float(90) }
    
}; 
All are valid and should work.

If you really need to convert it to an integer again, use floatround.


Re: [Help] Spam of warnings, tuuuhhh... - LetsOWN[PL] - 29.05.2011

Works Thank you.