mysql saving stats problem
#1

Something is not right here

pawn Код:
stock SaveStats(playerid)
{
    new query[200],ip[16];
    GetPlayerIp(playerid,ip,16);
    format(query,sizeof(query),"UPDATE `Players` SET `IP`='%s', `Admin`=%d, `VIP`=%d, `Scores`=%d,`Money`=%d,`Skin`=%d WHERE `Username`='%s'",ip, pInfo[playerid][Admin],pInfo[playerid][VIP],GetPlayerScore(playerid),GetPlayerMoney(playerid),GetPlayerSkin(playerid),Getname(playerid));
    mysql_query(query);
    print(query);
    return 1;
}
Print result
Код:
UPDATE `Players` SET `IP`='255.255.255.255', `Admin`=287, `VIP`=0, `Scores`=0,`Money`=0,`Skin`=287 WHERE `Username`='tester'
At Admin and Skin part. It's same! Can someone tell me what is wrong there?
(ignore that ip, I'll fix that later)
Reply
#2

I would CTRL+F through your script for every instance that you use pInfo[playerid][Admin] (I assume this is the incorrect one) and check whether there is any instance where you are accidentally setting the player skin to this variable. I sometimes end up doing this if I copy and paste similar code and forget to change it in every place.
Reply
#3

i think its code work but somewhere a ADMIN too !! Mby another update or smth
pawn Код:
stock SaveStats(playerid)
{
    new
        query[ 522 ],
        ip[ 16 ]
    ;
    GetPlayerIp( playerid, ip , 16 );
    skinid = GetPlayerSkin( playerid );

    format( query ,sizeof( query ),"UPDATE `Players` SET `IP`='%s', `Admin`=%d, `VIP`=%d, `Scores`=%d,`Money`=%d,`Skin`=%d WHERE `Username`='%s'", ip, pInfo[ playerid ][ Admin ], pInfo[ playerid ][ VIP ] , GetPlayerScore( playerid ) , GetPlayerMoney( playerid ) , skinid , Getname( playerid ));
    mysql_query( query );
   
    print( query );
    return 1;
}
Reply
#4

Quote:
Originally Posted by Benjo
Посмотреть сообщение
I would CTRL+F through your script for every instance that you use pInfo[playerid][Admin] (I assume this is the incorrect one) and check whether there is any instance where you are accidentally setting the player skin to this variable. I sometimes end up doing this if I copy and paste similar code and forget to change it in every place.
I found another one in my script, but I'm pretty sure there's nothing wrong here...
pawn Код:
format(query,sizeof(query),"INSERT INTO `Players` (`Username`, `Password`, `IP`, `Admin`, `VIP`, `Scores`, `Money`,`Skin`) VALUES ('%s', '%s', '%s', 0, 0, 0, 0,0)",Getname(playerid),esctext,ip);

Quote:
Originally Posted by Aprezt
Посмотреть сообщение
i think its code work but somewhere a ADMIN too !! Mby another update or smth
pawn Код:
stock SaveStats(playerid)
{
    new
        query[ 522 ],
        ip[ 16 ]
    ;
    GetPlayerIp( playerid, ip , 16 );
    skinid = GetPlayerSkin( playerid );

    format( query ,sizeof( query ),"UPDATE `Players` SET `IP`='%s', `Admin`=%d, `VIP`=%d, `Scores`=%d,`Money`=%d,`Skin`=%d WHERE `Username`='%s'", ip, pInfo[ playerid ][ Admin ], pInfo[ playerid ][ VIP ] , GetPlayerScore( playerid ) , GetPlayerMoney( playerid ) , skinid , Getname( playerid ));
    mysql_query( query );
   
    print( query );
    return 1;
}
What's the difference?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)