MySQL skins not saving
#1

So this is an extract of my script on OnPlayerDisconnect, so when you logout this saves the skin ID into the DB.

pawn Код:
SavePlayerSkin(playerid);
This is my setskin CMD (untidy, I know), at the bottom I tried SavePlayerSkin(targetid); in attempt to make that users skin save instantly after setting. This does not work, any reason why?

pawn Код:
CMD:setskin(playerid, params[])
{
    new targetid, skin, sendername[MAX_PLAYER_NAME], receiver[MAX_PLAYER_NAME], string[128];
    if(sscanf(params,"ui", targetid, skin)) return SendClientMessage(playerid, COLOR_RED,"[SERVER] USAGE: /setskin [PlayerID] [Skinmodel]");
    if(PlayerData[playerid][pAdminLevel] < 1) return SendClientMessage(playerid, COLOR_RED,"[SERVER] You are not authorised to use this command!");
    if(skin > 299 || skin < 1) return SendClientMessage(playerid, COLOR_RED,"[ADMIN] Skins range between 1-299.");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, COLOR_RED,"[ADMIN] This player is not connected.");
    GetPlayerName(playerid, sendername, sizeof(sendername));
    GetPlayerName(targetid, receiver,sizeof(receiver));
    format(string, sizeof(string),"[ADMIN] Your skin have been set to model %d by admin %s", skin, sendername);
    SendClientMessage(targetid, COLOR_RED, string);
    format(string, sizeof(string),"You have set %s skin to model %d", receiver, skin);
    SendClientMessage(playerid, COLOR_RED, string);
    SetPlayerSkin(targetid, skin); // just added pSkin to auto set when SetPlayerSkin is called, basically added more functionality to SetPlayerS ah alright, so should it save on
    SavePlayerSkin(targetid);
    return 1;
}
Reply
#2

Can you post the code for SavePlayerSkin
Reply
#3

pawn Код:
Server:SavePlayerSkin(playerid)
{  
    new query[128];
    mysql_format(sqlConnection, query, sizeof(query), "UPDATE players SET Skin = '%d' WHERE Name = '%e' LIMIT 1", PlayerData[playerid][pSkin], GetName(playerid));
    mysql_pquery(sqlConnection, query);
    return true;
}
Reply
#4

You never actually stored the skin into pSkin.
Reply
#5

Quote:
Originally Posted by Arthur Kane
Посмотреть сообщение
You never actually stored the skin into pSkin.
On the command you mean?
Reply
#6

Yes.
PHP код:
PlayerData[targetid][pSkin] = skin
Reply
#7

Quote:
Originally Posted by Arthur Kane
Посмотреть сообщение
Yes.
PHP код:
PlayerData[targetid][pSkin] = skin
Ah, got it. Thank you for your help.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)