SA-MP Forums Archive
Dini Warnings - 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: Dini Warnings (/showthread.php?tid=186494)



Dini Warnings - cre8ticity - 29.10.2010

Код:
C:\Documents and Settings\Joe\Desktop\London Roleplay\gamemodes\londonrp-fromscratch.pwn(129) : warning 213: tag mismatch
C:\Documents and Settings\Joe\Desktop\London Roleplay\gamemodes\londonrp-fromscratch.pwn(130) : warning 213: tag mismatch
C:\Documents and Settings\Joe\Desktop\London Roleplay\gamemodes\londonrp-fromscratch.pwn(131) : warning 213: tag mismatch
C:\Documents and Settings\Joe\Desktop\London Roleplay\gamemodes\londonrp-fromscratch.pwn(381) : warning 213: tag mismatch
C:\Documents and Settings\Joe\Desktop\London Roleplay\gamemodes\londonrp-fromscratch.pwn(382) : warning 213: tag mismatch
C:\Documents and Settings\Joe\Desktop\London Roleplay\gamemodes\londonrp-fromscratch.pwn(383) : warning 213: tag mismatch
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


6 Warnings.
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    new name[MAX_PLAYER_NAME], file[256];
    GetPlayerName(playerid, name, sizeof(name));
    format(file, sizeof(file), SERVER_USER_FILE, name);
    GetPlayerPos(playerid, PlayerInfo[playerid][pPosX], PlayerInfo[playerid][pPosY], PlayerInfo[playerid][pPosZ]);
    PlayerInfo[playerid][pInterior] = GetPlayerInterior(playerid);
    if(gPlayerLogged[playerid] == 1)
    {
        dini_IntSet(file, "Money", PlayerInfo[playerid][pCash]);
        dini_IntSet(file, "Level",PlayerInfo[playerid][pLevel]);
        dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdmin]);
        dini_IntSet(file, "Skin",PlayerInfo[playerid][pSkin]);
        dini_IntSet(file, "Gender",PlayerInfo[playerid][pGender]);
        dini_IntSet(file, "Age",PlayerInfo[playerid][pAge]);
        dini_IntSet(file, "Origin",PlayerInfo[playerid][pOrigin]);
        dini_IntSet(file, "Interior",PlayerInfo[playerid][pInterior]);
        dini_IntSet(file, "PosX",PlayerInfo[playerid][pPosX]); // 129
        dini_IntSet(file, "PosY",PlayerInfo[playerid][pPosY]); // 130
        dini_IntSet(file, "PosZ",PlayerInfo[playerid][pPosZ]); // 131
       
    }
    gPlayerLogged[playerid] = 0;
    return 1;
}

pawn Код:
if (dialogid == 1)
        {
            new name[MAX_PLAYER_NAME], file[256], string[128];
            GetPlayerName(playerid, name, sizeof(name));
            format(file, sizeof(file), SERVER_USER_FILE, name);
            if(!response) return Kick(playerid);
            if (!strlen(inputtext)) return
            ShowPlayerDialog(playerid, 1, DIALOG_STYLE_INPUT, "Registration", "Welcome to London Roleplay, Please enter a password below to register.", "Register", "Leave");
            dini_Create(file);
            dini_IntSet(file, "Password", udb_hash(inputtext));
            dini_IntSet(file, "AdminLevel",PlayerInfo[playerid][pAdmin] = 0);
            dini_IntSet(file, "Level",PlayerInfo[playerid][pLevel] = 1);
            dini_IntSet(file, "Money",PlayerInfo[playerid][pCash] = 500);
            dini_IntSet(file, "Tut",PlayerInfo[playerid][pTut] = 0);
            dini_IntSet(file, "Interior",PlayerInfo[playerid][pInterior] = 1);
            dini_IntSet(file, "PosX",PlayerInfo[playerid][pPosX] = 1.808619); // 381
            dini_IntSet(file, "PosY",PlayerInfo[playerid][pPosY] = 32.384357); // 382
            dini_IntSet(file, "PosZ",PlayerInfo[playerid][pPosZ] = 1199.593750); // 383
            format(string, 128, "You succesfully registered the nickname %s, password %s. You have automatically been logged in.", name, inputtext);
            SendClientMessage(playerid, COLOR_WHITE, string);
            gPlayerLogged[playerid] = 1;
        }



Re: Dini Warnings - pater - 29.10.2010

You should really use dini_set (which means string) for coords, and than use floatstr() to make a float from the string again, otherwise, which means using integer for floats, it will fail like hell:

Here you got good code though:
pawn Код:
new Float:coordx, Float:coordy, Float:coordz;
coordx = floatstr(PlayerInfo[playerid][pPosX]);
coordy = floatstr(PlayerInfo[playerid][pPosY]);
coordz = floatstr(PlayerInfo[playerid][pPosZ]);
GetPlayerPos(playerid, coordx, coordy, coordz);
best regards


Re: Dini Warnings - Jeffry - 29.10.2010

pawn Код:
dini_FloatSet(file, "PosX",PlayerInfo[playerid][pPosX]); // 129
dini_FloatSet(file, "PosY",PlayerInfo[playerid][pPosY]); // 130
dini_FloatSet(file, "PosZ",PlayerInfo[playerid][pPosZ]); // 131
pawn Код:
dini_FloatSet(file, "PosX",PlayerInfo[playerid][pPosX] = 1.808619); // 381
dini_FloatSet(file, "PosY",PlayerInfo[playerid][pPosY] = 32.384357); // 382
dini_FloatSet(file, "PosZ",PlayerInfo[playerid][pPosZ] = 1199.593750); // 383
You have used dini_IntSet, which means you set an Integer. But as the 1199.59 is a Float, you have to use dini_FloatSet. Easy eh^^.

Greetz!


Re: Dini Warnings - pater - 29.10.2010

OMG, i am stupid
i didn't even know there was a dini_FloatSet