PDA

View Full Version : Why wont my skins save?


ChunkyGaming26
11/07/2016, 09:08 AM
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: http://wiki.sa-mp.com/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;
}*/

Jonesy96
11/07/2016, 09:12 AM
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

ChunkyGaming26
11/07/2016, 09:13 AM
Not sure how easy is it to add to the SQL?

Jonesy96
11/07/2016, 09:17 AM
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: http://forum.sa-mp.com/showthread.php?t=56564