Warning help
#1

hi, I know why the warnings are there but i was wondering if they is a way to remove them?
Proble area
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new X, Y, Z, A;
line 150    GetPlayerPos(playerid, X, Y, Z);
line 151    GetPlayerFacingAngle(playerid, A);
    PlayerInfo[playerid][pSpawnX] = X;
    PlayerInfo[playerid][pSpawnY] = Y;
    PlayerInfo[playerid][pSpawnZ] = Z;
    PlayerInfo[playerid][pSpawnA] = A;
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
    INI_WriteInt(File,"Banned",PlayerInfo[playerid][pBanned]);
    INI_WriteInt(File,"SpawnX",PlayerInfo[playerid][pSpawnX]);
    INI_WriteInt(File,"SpawnY",PlayerInfo[playerid][pSpawnY]);
    INI_WriteInt(File,"SpawnZ",PlayerInfo[playerid][pSpawnZ]);
    INI_WriteInt(File,"SpawnA",PlayerInfo[playerid][pSpawnA]);
    INI_Close(File);
    return 1;
}
Warnings
pawn Код:
Base.pwn(150) : warning 213: tag mismatch
Base.pwn(150) : warning 213: tag mismatch
Base.pwn(150) : warning 213: tag mismatch
Base.pwn(151) : warning 213: tag mismatch
4 Warnings.
Reply
#2

pawn Код:
INI_WriteFloat(File,"SpawnX",PlayerInfo[playerid][pSpawnX]);
INI_WriteFloat(File,"SpawnY",PlayerInfo[playerid][pSpawnY]);
INI_WriteFloat(File,"SpawnZ",PlayerInfo[playerid][pSpawnZ]);
INI_WriteFloat(File,"SpawnA",PlayerInfo[playerid][pSpawnA]);
Reply
#3

Alongside Viniborn's code:

new X, Y, Z, A;
should be...
new Float:X, Float:Y, Float:Z, Float:A;

Certain data values like coordinates, rotations, health, armour, and speed are using 'float' numbers (with decimals), and you defined them as integers.
Reply
#4

I still get the warnings and the code works except it don't save the cords right with the "." after the main numbers so when i spawn it puts me out of bounds
Reply
#5

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    GetPlayerPos(playerid, PlayerInfo[playerid][pSpawnX], PlayerInfo[playerid][pSpawnY], PlayerInfo[playerid][pSpawnZ]);
    GetPlayerFacingAngle(playerid, PlayerInfo[playerid][pSpawnA]);
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(File,"Skin",GetPlayerSkin(playerid));
    INI_WriteInt(File,"Banned",PlayerInfo[playerid][pBanned]);
    INI_WriteFloat(File,"SpawnX",PlayerInfo[playerid][pSpawnX]);
    INI_WriteFloat(File,"SpawnY",PlayerInfo[playerid][pSpawnY]);
    INI_WriteFloat(File,"SpawnZ",PlayerInfo[playerid][pSpawnZ]);
    INI_WriteFloat(File,"SpawnA",PlayerInfo[playerid][pSpawnA]);
    INI_Close(File);
    return 1;
}
Reply
#6

still get the same warning
Reply
#7

post your
PlayerInfo enum

you need to add the float tag to
pawn Код:
Float:pSpawnX,
Float:pSpawnY,
Float:pSpawnZ,
Float:pSpawnA,
Reply
#8

Float is not integer

Why you using INI_WriteInt if you can use INI_WriteFloat
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)