18.01.2015, 17:59
(
Последний раз редактировалось vassilis; 27.01.2015 в 04:05.
)
NEVER SOLVED
pinfo[playerid][Skin] = GetPlayerSkin(playerid);
mysql_format(MySQLTunnel,Query,sizeof(Query),"UPDATE `accounts` SET `pskin` = '%d' WHERE `pid` = '%d'",pinfo[playerid][Skin],pinfo[playerid][pMySQLID]);
mysql_pquery(MySQLTunnel,Query);
It saves it now ye forgot that function but i want to make it so when player registers he choose skin but when he logs in(as registered ofc)he get spawned how this could be implemented?
|
if((PlayerInfo[playerid][LoggedIn] == 1)) {
new query[100];
mysql_format(mysql, query, sizeof(query), "SELECT `pskin` FROM `accounts` WHERE `pid` = '%d'", pinfo[playerid][pMySQLID]);
new Cache:result = mysql_query(mysql, query);
if(cache_get_row_count() != 0)
{
pinfo[playerid][Skin] = cache_get_field_content_int(0, "pskin");
SetPlayerSkin(playerid,pinfo[playerid][Skin]);
}
cache_delete(result);}
Ok thanks for that and i use a function named accountload. should i use spawnplayer there?
The accountload is whenplayer logs in succesffuly to load player statistics(at the same time player is at class selection but i want the player to get spawned if he is already registered) |
function SkinSaving(playerid)
{
pinfo[playerid][Skin] = GetPlayerSkin(playerid);
mysql_format(MySQLTunnel,Query,sizeof(Query),"UPDATE `accounts` SET `pskin` = '%d' WHERE `pid` = '%d'",pinfo[playerid][Skin],pinfo[playerid][pMySQLID]);
mysql_pquery(MySQLTunnel,Query);
return 1;
}
skinsaving[playerid] = SetTimerEx("SkinSaving", 600000,1,"i",playerid);
if((pinfo[playerid][pLogged] == 1)) {
mysql_format(MySQLTunnel, Query, sizeof(Query), "SELECT `pskin` FROM `accounts` WHERE `pid` = '%d'", pinfo[playerid][pMySQLID]);
new Cache:result = mysql_query(MySQLTunnel, Query);
if(cache_get_row_count() != 0)
{
pinfo[playerid][Skin] = cache_get_field_content_int(0, "pskin");
SetPlayerSkin(playerid,pinfo[playerid][Skin]);
}
cache_delete(result);}