Why wont my skins save? - 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: Why wont my skins save? (
/showthread.php?tid=611819)
Why wont my skins save? -
ChunkyGaming26 - 11.07.2016
When I'm in game, and go to Bincos and do /skin a menu pops up and it gives you all the skins so I select one at random. and it puts the skin I selected on but if I /q or /switchchar it disappears. Can anyone help.
Код:
YCMD:skin(playerid, params[], help) {
if(help) {
SendClientMessage(playerid, X11_WHITE, "Used for changing a players skin");
return 1;
}
//new skinid;
if(!IsPlayerInRangeOfPoint(playerid, 15.0, 210.047988, -102.005409, 1005.257812)) {
SendClientMessage(playerid, X11_TOMATO_2, "You aren't at Bincos!");
return 1;
}
ShowModelSelectionMenu(playerid, skinlist, "Select Skin");
return 1;
/* if(!sscanf(params, "d", skinid)) {
if(IsValidSkin(skinid) && IsSkinAllowed(playerid, skinid)) {
setCharacterSkin(playerid, skinid);
}
} else {
SendClientMessage(playerid, X11_WHITE, "USAGE: /skin [skinid]");
SendClientMessage(playerid, COLOR_LIGHTBLUE, "Hint: {FFFFFF}A list of skin IDs can be found here: https://sampwiki.blast.hk/wiki/Category:Skins");
}
return 1;*/
}
public OnPlayerModelSelection(playerid, response, listid, modelid)
{
if(listid == skinlist)
{
if(response)
{
SendClientMessage(playerid, 0xFF0000FF, "Skin Changed");
SetPlayerSkin(playerid, modelid);
}
else SendClientMessage(playerid, 0xFF0000FF, "Canceled skin selection");
return 1;
}
return 1;
}
/*IsValidSkin(skin) {
if(skin < 0 || skin >= 300) return 0;
return 1;
}*/
/*IsSkinAllowed(playerid, skinid) {
#pragma unused playerid
if(!IsValidSkin(skinid)) {
return 0;
}
for(new i=0;i<sizeof(BadSkins);i++) {
if(BadSkins[i] == skinid) {
return 0;
}
}
return 1;
}*/
Re: Why wont my skins save? -
Jonesy96 - 11.07.2016
Are you saving the skin ID, for example in a MySQL database? Otherwise, the skin will just set to whatever you have set as the default skin in your script
Re: Why wont my skins save? -
ChunkyGaming26 - 11.07.2016
Not sure how easy is it to add to the SQL?
Re: Why wont my skins save? -
Jonesy96 - 11.07.2016
If you're going to build a script/server that's actually going to save user data, so that when they log back into your server, their data can be loaded again(E.g. skin id, killCount, deathCount, etc.), the best way really is via a MySQL database. There's many topics to see on this that you could search up on.
If you do not know anything about MySQL and databases yet, I suggest you look into that first. Check out the MySQL website, and tutorials on normalised relational databases.
Once you have an understanding of that, you could take a look at BlueG's SAMP MySQL plugin, to work with your script:
https://sampforum.blast.hk/showthread.php?tid=56564