SA-MP Forums Archive
Skin doesn't load from MySQL? - 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)
+--- Thread: Skin doesn't load from MySQL? (/showthread.php?tid=657028)



Skin doesn't load from MySQL? - Jing_Chan - 30.07.2018

pawn Код:
SetSpawnInfo(playerid, 0, pInfo[playerid][Skin], 1922.8219,2440.4648,11.1782,180.3614, -1, -1, -1, -1, -1, -1);
When I use this it just spawns me in with the CJ skin?


Re: Skin doesn't load from MySQL? - Rufio - 30.07.2018

Can you show us your MySQL error log as well as yoır saving functions?


Re: Skin doesn't load from MySQL? - Jyothiranand - 30.07.2018

Change the number 0 to any other number.The skin ID you want. On the setspawninfo line


Re: Skin doesn't load from MySQL? - Jing_Chan - 30.07.2018

Quote:
Originally Posted by Rufio
Посмотреть сообщение
Can you show us your MySQL error log as well as yoır saving functions?
This is the OnPlayerDisconnect query:

pawn Код:
mysql_format(Database, DB_Query, sizeof(DB_Query), "UPDATE `PLAYERS` SET `SCORE` = %d, `CASH` = %d, `KILLS` = %d, `DEATHS` = %d, `ADMIN` = %d, `SKIN` = %d, `DONATOR` = %d, `NAMECHANGES` = %d, `HEADSHOTS` WHERE `ID` = %d LIMIT 1",
    pInfo[playerid][Score], pInfo[playerid][Cash], pInfo[playerid][Kills], pInfo[playerid][Deaths], pInfo[playerid][Admin], pInfo[playerid][Skin], pInfo[playerid][Donator], pInfo[playerid][Namechanges], pInfo[playerid][Headshots], pInfo[playerid][ID]);
during login..

pawn Код:
cache_get_value_int(0, "SKIN", pInfo[playerid][Skin]);
--

Quote:
Originally Posted by Jyothiranand
Посмотреть сообщение
Change the number 0 to any other number.The skin ID you want. On the setspawninfo line
pawn Код:
(playerid, team, skin, Float:x, Float:y, Float:z, Float:rotation, weapon1, weapon1_ammo, weapon2, weapon2_ammo, weapon3, weapon3_ammo)
that would be incorrect, refer to the SA:MP wiki


Re: Skin doesn't load from MySQL? - jlalt - 30.07.2018

seems like your updating data query has an issue.
PHP код:
`HEADSHOTSWHERE `ID` = %d LIMIT 1 
has to be:
PHP код:
`HEADSHOTS` = %d WHERE `ID` = %d LIMIT 1 
so ->
PHP код:
    mysql_format(DatabaseDB_Querysizeof(DB_Query), "UPDATE `PLAYERS` SET `SCORE` = %d, `CASH` = %d, `KILLS` = %d, `DEATHS` = %d, `ADMIN` = %d, `SKIN` = %d, `DONATOR` = %d, `NAMECHANGES` = %d, `HEADSHOTS`= %d WHERE `ID` = %d LIMIT 1",
    
pInfo[playerid][Score], pInfo[playerid][Cash], pInfo[playerid][Kills], pInfo[playerid][Deaths], pInfo[playerid][Admin], pInfo[playerid][Skin], pInfo[playerid][Donator], pInfo[playerid][Namechanges], pInfo[playerid][Headshots], pInfo[playerid][ID]); 



Re: Skin doesn't load from MySQL? - Jing_Chan - 30.07.2018

Quote:
Originally Posted by jlalt
Посмотреть сообщение
seems like your updating data query has an issue.
PHP код:
`HEADSHOTSWHERE `ID` = %d LIMIT 1 
has to be:
PHP код:
`HEADSHOTS` = %d WHERE `ID` = %d LIMIT 1 
so ->
PHP код:
    mysql_format(DatabaseDB_Querysizeof(DB_Query), "UPDATE `PLAYERS` SET `SCORE` = %d, `CASH` = %d, `KILLS` = %d, `DEATHS` = %d, `ADMIN` = %d, `SKIN` = %d, `DONATOR` = %d, `NAMECHANGES` = %d, `HEADSHOTS`= %d WHERE `ID` = %d LIMIT 1",
    
pInfo[playerid][Score], pInfo[playerid][Cash], pInfo[playerid][Kills], pInfo[playerid][Deaths], pInfo[playerid][Admin], pInfo[playerid][Skin], pInfo[playerid][Donator], pInfo[playerid][Namechanges], pInfo[playerid][Headshots], pInfo[playerid][ID]); 
The skin saves perfectly, it just won't load it and set me it.


Re: Skin doesn't load from MySQL? - jlalt - 30.07.2018

Quote:
Originally Posted by Jing_Chan
Посмотреть сообщение
The skin saves perfectly, it just won't load it and set me it.
Have you checked the mysql database or predicting? may you do another test? [ buy a skin or whatever then relog? ]


Re: Skin doesn't load from MySQL? - Jing_Chan - 30.07.2018

Quote:
Originally Posted by jlalt
Посмотреть сообщение
Have you checked the mysql database or predicting? may you do another test? [ buy a skin or whatever then relog? ]
I'm testing it now..

I've checked and it doesn't seem to be saving, any ideas?


Re: Skin doesn't load from MySQL? - Jing_Chan - 30.07.2018

The skin saves now but still won't load?

pawn Код:
SetPlayerSkin(playerid, pInfo[playerid][Skin]);
under OnPlayerSpawn etc..


Re: Skin doesn't load from MySQL? - Rufio - 30.07.2018

Can you show us the code where you load your player's data? Does it only fail at loading skin or does it fail at loading EVERY variable?