SA-MP Forums Archive
*** Terrible Title Removed - 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: *** Terrible Title Removed (/showthread.php?tid=387365)



*** Terrible Title Removed - Fernado Samuel - 24.10.2012

Hello
Removed


Re: How to convert this? - Roel - 24.10.2012

Replace it with:
pawn Код:
new query[256], pname[24];
GetPlayerName(playerid, pname, 24);
format(query,sizeof(query),"SELECT SavSkin FROM data WHERE UseSkin=1 AND user='%s LIMIT 1'",pname);
mysql_query(query);
mysql_store_result();
new skinstr[26];
if(mysql_retrieve_row())
{
    mysql_fetch_field_row(skinstr, "SavSkin");
    SetPlayerSkin(playerid,strval(skinstr));
    mysql_free_result();
}
else
{
    SetPlayerSkin(playerid,1); // Default Skin if query failed.
}



Re: *** Terrible Title Removed - Fernado Samuel - 25.10.2012

Removed


Re: *** Terrible Title Removed - Roel - 25.10.2012

Okay,
But when he doesn't use a skin the UseSkin is 0 right?
So if it's 0 it won't retrieve any rows, but here is a solution if that doesnt work.
Replace it with:
pawn Код:
new query[256], pname[24];
GetPlayerName(playerid, pname, 24);
format(query,sizeof(query),"SELECT SavSkin FROM data WHERE UseSkin=1 AND user='%s LIMIT 1'",pname);
mysql_query(query);
mysql_store_result();
new skinstr[26];
if(mysql_retrieve_row())
{
    mysql_fetch_field_row(skinstr, "SavSkin");
        if(strval(skinstr) > 0)
        {
    SetPlayerSkin(playerid,strval(skinstr));
        }
        else
        {
         SetPlayerSkin(playerid,1); // default skin.
         }
    mysql_free_result();
}
else
{
    SetPlayerSkin(playerid,1); // Default Skin if query failed.
}



Re: *** Terrible Title Removed - Fernado Samuel - 25.10.2012

Removed


Re: *** Terrible Title Removed - gtakillerIV - 25.10.2012

No, the default skin (CJ) = ID 0.