MYSQL Getting and inserting
#5

Hmmm, just tried it out, it dosen't work..at least the first thing i tried to test.
pawn Code:
//----------/setvip-------------------------
//------------------------------------------
CMD:setvip(playerid, params[])
{
    if(PVar[playerid][pLevel] >= 5)
    {
        new pID, Level;
        if(sscanf(params, "ud", pID, Level)) return SendClientMessage(playerid, COLOR_RED, "ERROR: Use /setvip [1/0]");
        if(!IsPlayerConnected(pID)) return SendClientMessage(playerid, COLOR_RED, "* That user is not connected!");

        if(GetPVarInt(pID, "LoggedIN") == 1)
        {
        SendFMessage(playerid, COLOR_RED, "You have given %s VIP status", pName(playerid));
        SendFMessageToAll(COLOR_LIGHTBLUE, "Lead Admin %s(%d) has given %s(%d) VIP status!", pName(playerid), playerid, pName(pID), pID);
   
        PVar[pID][pLevel] = Level;
        }
        else return SendClientMessage(playerid, COLOR_RED, "* That user does not have an account!");
    }
    else return SendClientMessage(playerid, COLOR_RED, "Only admin level 5 commands!");
    return 1;
}
//=========================

stock LoadPlayerInfo(iPlayer)
{
    new Query[700];

    if(mysql_fetch_row(Query))
    {
        //added dsssd
        sscanf(Query, "e<p<|>s[24]s[35]ddddfffddsssd>", PVar[iPlayer]); // Remember to update this if you add more info...
        mysql_free_result();
    }
    return 1;
}

=====================

stock SavePInfo(playerid)
{
    if(GetPVarInt(playerid, "LoggedIN") == 1)
    {
        new Query[600];

        format(Query, sizeof(Query), "UPDATE `playerinfo` SET `kills` = %d, `deaths` = %d, `money` = %d, `Level` = %d, `Last Pos X` = %f, `Last Pos Y` = %f, `Last Pos Z` = %f, `Interior` = %d, `warns` = %d, `warn1` = %f, `warn2` = %f, `warn3` = %f, `vip` =%d, WHERE `user` = '%s'", // Also remember to update this...

        PVar[playerid][pKills],
        PVar[playerid][pDeaths],
        GetPlayerMoney(playerid),
        PVar[playerid][pLevel],
        PVar[playerid][pLastX],
        PVar[playerid][pLastY],
        PVar[playerid][pLastZ],
        GetPlayerInterior(playerid),
        PVar[playerid][pWarns],
        PVar[playerid][pVip],
        pName(playerid));

        mysql_query(Query);
        mysql_free_result();
        return 1;
    }
    else return 0;
}

=================

stock ResetPVars(playerid)
{
    PVar[playerid][pLevel]      = 0;
    PVar[playerid][pKills]      = 0;
    PVar[playerid][pDeaths]     = 0;
    PVar[playerid][pMoney]      = 0;
    PVar[playerid][pLastX]      = 0.0;
    PVar[playerid][pLastY]      = 0.0;
    PVar[playerid][pLastZ]      = 0.0;
    PVar[playerid][pInt]        = 0;
    PVar[playerid][pWarns]      = 0;
    PVar[playerid][pVip]        = 0;
}
The VIP is always 0 in the database.
So it inserts it(it was nothing in it at the first) just it ain't doing it properly.
Reply


Messages In This Thread
MYSQL Getting and inserting - by AlExAlExAlEx - 20.02.2011, 15:14
Re: MYSQL Getting and inserting - by JaTochNietDan - 21.02.2011, 19:06
Re: MYSQL Getting and inserting - by AlExAlExAlEx - 21.02.2011, 19:11
Re: MYSQL Getting and inserting - by JaTochNietDan - 21.02.2011, 19:20
Re: MYSQL Getting and inserting - by AlExAlExAlEx - 21.02.2011, 20:21
Re: MYSQL Getting and inserting - by JaTochNietDan - 21.02.2011, 20:34
Re: MYSQL Getting and inserting - by AlExAlExAlEx - 21.02.2011, 20:41
Re: MYSQL Getting and inserting - by JaTochNietDan - 21.02.2011, 20:57
Re: MYSQL Getting and inserting - by AlExAlExAlEx - 21.02.2011, 20:59
Re: MYSQL Getting and inserting - by JaTochNietDan - 21.02.2011, 21:01

Forum Jump:


Users browsing this thread: 1 Guest(s)