Mysql, CJ SKIN
#1

PHP код:
forward OnStatsSave(playerid);
public 
OnStatsSave(playerid)
{
    
pData[playerid][IDD] = 0;
    
format(pData[playerid][Name], 24"");
    
format(pData[playerid][IP], 16"");
    
pData[playerid][Level] = 0;
    
pData[playerid][Colour] = -1;
    
pData[playerid][RegTime] = 0;
    
pData[playerid][OnlineTime] = 0;
    
pData[playerid][Score] = 0;
    
pData[playerid][Money] = 0;
    
pData[playerid][Skin] = 0
PHP код:
pData[playerid][Skin] = 0
^^, THis spawns me as Cj skin. How to fix it.
Reply
#2

Someone help me? how to fix it? I don't think the code is wrong but is there any idea to avoid this cj skin bug or fix it?
Reply
#3

Can you show us Saving skin code? This is only format
Reply
#4

PHP код:
enum pdata //players' data
{
    
IDD,
    
Name[24],
        
Money,
    
Skin,

PHP код:
stock SaveStats(playerid)
{
    if(
LoggedIn[playerid] == 1)
    {
        new 
SessionTime gettime() - Connected[playerid]; //calculate their current session length
        
        
pData[playerid][Money] = GetPlayerMoney(playerid);
         
pData[playerid][Score] = GetPlayerScore(playerid);
         
mysql_format(chquerysizeof(query),
          
"UPDATE `players` SET ip='%s', level=%d, colour=%d, onlinetime=%d, score=%d, money=%d WHERE id=%d",
            
pData[playerid][IP], pData[playerid][Level], pData[playerid][Colour], pData[playerid][OnlineTime] + SessionTime,
             
pData[playerid][Score], pData[playerid][Money], pData[playerid][IDD]);
        switch(
Disconnecting[playerid])
        {
            case 
0mysql_pquery(chquery);
            case 
1mysql_pquery(chquery"OnStatsSave""i"playerid);
            default: 
mysql_pquery(chquery);
        }
    }
    return 
1;


PHP код:
forward OnStatsSave(playerid);
public 
OnStatsSave(playerid)
{
    
pData[playerid][IDD] = 0;
    
format(pData[playerid][Name], 24"");
    
format(pData[playerid][IP], 16"");
    
pData[playerid][Level] = 0;
    
pData[playerid][Money] = 0;
       
pData[playerid][Skin] = 0
Reply
#5

?
Reply
#6

PHP код:
stock SaveStats(playerid)
{
    if(
LoggedIn[playerid] == 1)
    {
        new 
SessionTime gettime() - Connected[playerid]; //calculate their current session length
        
        
pData[playerid][Money] = GetPlayerMoney(playerid);
         
pData[playerid][Score] = GetPlayerScore(playerid);
         
mysql_format(chquerysizeof(query),
          
"UPDATE `players` SET ip='%s', level=%d, colour=%d, onlinetime=%d, score=%d, money=%d WHERE id=%d",
            
pData[playerid][IP], pData[playerid][Level], pData[playerid][Colour], pData[playerid][Skin], pData[playerid][OnlineTime] + SessionTime,
             
pData[playerid][Score], pData[playerid][Money], pData[playerid][IDD]);
        switch(
Disconnecting[playerid])
        {
            case 
0mysql_pquery(chquery);
            case 
1mysql_pquery(chquery"OnStatsSave""i"playerid);
            default: 
mysql_pquery(chquery);
        }
    }
    return 
1;

Try with this.
Reply
#7

didnt work. anyone help?
Reply
#8

Код:
forward OnStatsSave(playerid);
public OnStatsSave(playerid)
{
	pData[playerid][IDD] = 0;
	format(pData[playerid][Name], 24, "");
	format(pData[playerid][IP], 16, "");
	pData[playerid][Level] = 0;
	pData[playerid][Money] = 0;
       pData[playerid][Skin] = GetPlayerSkin(playerid);
Reply
#9

PHP код:
enum pdata //players' data
{
    
IDD,
    
Name[24],
    
IP[16],
    
Level,
    
Colour,
    
RegTime,
    
OnlineTime,
    
Score,
    
Money,
    
Skin

PHP код:
stock SaveStats(playerid)
{
    if(
LoggedIn[playerid] == 1)
    {
        new 
SessionTime gettime() - Connected[playerid]; //calculate their current session length
        
        
pData[playerid][Money] = GetPlayerCash(playerid);
         
pData[playerid][Score] = GetPlayerScore(playerid);
         
pData[playerid][Skin] = GetPlayerSkin(playerid);
         
mysql_format(chquerysizeof(query),
          
"UPDATE `players` SET ip='%s', level=%d, colour=%d, onlinetime=%d, score=%d, money=%d, skin=%d WHERE id=%d",
            
pData[playerid][IP], pData[playerid][Level], pData[playerid][Colour], pData[playerid][OnlineTime] + SessionTime,
             
pData[playerid][Score], pData[playerid][Money], pData[playerid][Skin], pData[playerid][IDD]);
        switch(
Disconnecting[playerid])
        {
            case 
0mysql_pquery(chquery);
            case 
1mysql_pquery(chquery"OnStatsSave""i"playerid);
            default: 
mysql_pquery(chquery);
        }
    }
    return 
1;
}
forward OnStatsSave(playerid);
public 
OnStatsSave(playerid)
{
    
pData[playerid][IDD] = 0;
    
format(pData[playerid][Name], 24"");
    
format(pData[playerid][IP], 16"");
    
pData[playerid][Level] = 0;
    
pData[playerid][Colour] = -1;
    
pData[playerid][RegTime] = 0;
    
pData[playerid][OnlineTime] = 0;
    
pData[playerid][Score] = 0;
    
pData[playerid][Money] = 0;
    
pData[playerid][Skin] = 0;
    
Connected[playerid] = -1;
    
LoggedIn[playerid] = 0;
    
PasswordAttempts[playerid] = 0;
    
Disconnecting[playerid] = -1;
    return 
1;

PHP код:
stock LogPlayerIn(playerid)
{
    
cache_get_row(00strr); pData[playerid][IDD] = strval(strr); //Load player's stats from the database
    
cache_get_row(04strr); pData[playerid][Level] = strval(strr);
    
cache_get_row(05strr); pData[playerid][Colour] = strval(strr);
    
cache_get_row(06strr); pData[playerid][RegTime] = strval(strr);
    
cache_get_row(07strr); pData[playerid][OnlineTime] = strval(strr);
    
cache_get_row(08strr); pData[playerid][Score] = strval(strr);
    
cache_get_row(09strr); pData[playerid][Money] = strval(strr);
    
cache_get_row(010strr); pData[playerid][Skin] = strval(strr); 
PHP код:
public OnPlayerSpawn(playerid)
{
    if(
LoggedIn[playerid] == 0) return 0;
    if(
LoggedIn[playerid] == 1)
    {
    
SetPlayerCash(playeridpData[playerid][Money]);
    
SetPlayerScore(playeridpData[playerid][Score]);
    
SetPlayerSkin(playeridpData[playerid][Skin];
    }
return 
1;

Whenever i add "SetPlayerSkin(playerid, pData[playerid][Skin];" so it spawns with CJ SKIN.
Reply
#10

UPDATED:
Reply


Forum Jump:


Users browsing this thread: 6 Guest(s)