Skin Help - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Skin Help (
/showthread.php?tid=219510)
Skin Help -
Criss_Angel - 01.02.2011
pawn Код:
if(dialogid == 777)
{
new SkinBuy[134], name[55], SkinSave[135];
GetPlayerName(playerid, name, sizeof(name));
format(SkinBuy, sizeof(SkinBuy),"SELECT * FROM `skins` WHERE `Skinid` = '%d' AND `Owner` = 'None'",inputtext);
mysql_query(SkinBuy);
mysql_store_result();
if(!mysql_num_rows())
{
SendClientMessage(playerid, COLOR_RED, "Invalid Skin ID, Or Skin is already bought!");
}
else
{
new skinline[3];
sscanf(skinline,"p|dds", skinline[0], skinline[1], skinline[2]);
playerinfo[playerid][Skin] = skinline[0];
SendClientMessage(playerid, COLOR_GREEN,"[ ! ]Congratulations!You can wear your skin via /wearskin");
format(SkinBuy, sizeof(SkinBuy),"UPDATE `skins` SET `Owner` = '%s' WHERE `Skinid` = '%d'",name,inputtext);
mysql_query(SkinBuy);
format(SkinSave, sizeof(SkinSave),"UPDATE `playerinfo` SET `Skin` = '%d' WHERE `user` = '%s'",playerinfo[playerid][Skin],name);
mysql_query(SkinSave);
return 1;
}
mysql_free_result();
}
return 1;
}
It doesnt seem to work, i got a cmd:
pawn Код:
if (strcmp("/skin", cmdtext, true, 10) == 0)
{
format(string, sizeof(string),"Your Skin ID is: %d", playerinfo[playerid][Skin]);
SendClientMessage(playerid, COLOR_GREEN,"---------------------------------------------");
SendClientMessage(playerid, COLOR_WHITE, string);
SendClientMessage(playerid, COLOR_GREEN,"----------------------------------------------");
return 1;
}
Whenever i press it even after buying a skin i still get 0 wtfz0r O:
Re: Skin Help -
JaTochNietDan - 01.02.2011
Well what goes wrong? Does it show Invalid Skin ID or does it show Congratulations or what? You need to do provide some debug information if you need more help.
I did spot one problem immediately in your format function:
pawn Код:
format(SkinBuy, sizeof(SkinBuy),"SELECT * FROM `skins` WHERE `Skinid` = '%d' AND `Owner` = 'None'",inputtext);
"inputtext" is a string, not an integer, therefore you need to convert it first using a function like strval before formatting it as an integer, like so:
pawn Код:
format(SkinBuy, sizeof(SkinBuy),"SELECT * FROM `skins` WHERE `Skinid` = '%d' AND `Owner` = 'None'",strval(inputtext));
You made this same error in your second format function in that snippet of code.
Additionally the size of your "name" array is madness, the maximum size for a player name in SA-MP is 24, so that's 31 wasted cells!
-
Criss_Angel - 02.02.2011
Hm im guessing that might be the prob, prob:everytime after gmx or reconnrct my account isnt stored , i have to reregister allowing me to buy any skin again, this player account problem wasnt here before he skin sys was added :\ ty for ur samples ill edit when i get on my pc

thanks alot though dude
When i type the cmd /wearskin which just gets the playerinfo[playerid][Skin] it still sets my skin to 0 why?
Re: Skin Help -
Criss_Angel - 02.02.2011
I already made the code, and thats a fairly simple command.I need help because it shows the skin 0 and my skin is always 0 even if i type 299 or 55 or anything :S
Re: Skin Help -
Steven Paul - 02.02.2011
this is because you did not give any text response. Try using inputtext
Re: Skin Help -
Criss_Angel - 03.02.2011
The system seems to be working now, Thank you for the advice JachoTien somthing :P Sorry your name is quite complicated lmao