Quantcast
Channel: SA-MP Forums
Viewing all articles
Browse latest Browse all 18226

MySQL CJ Skin problem,

$
0
0
Sometimes when i logged into game, server kill me, i don't know the reason.
I need to Mention, when i try to loggin into server, all my variables goes to 0, regardless my saving system is ok.
And my skin are changed at CJ.
Or sometimes when i connect in game, server kick me before logging.
I use system which block arrows on connect, because i don't like that, i dont use class for that, i used toggleplayerspectate..

Here is the code:

PHP Code:

forward CreateSpawnInfo(playerid);
public 
CreateSpawnInfo(playerid)
{
    new 
rand random(sizeof(SpawnRandom));
    
PlayerInfo[playerid][pPos_x] = SpawnRandom[rand][0];
    
PlayerInfo[playerid][pPos_y] = SpawnRandom[rand][1];
    
PlayerInfo[playerid][pPos_z] = SpawnRandom[rand][2];
    
SetSpawnInfo(playerid0PlayerInfo[playerid][pChar], PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z], 270000000);
    return 
1;
}

public 
OnPlayerConnect(playerid)
{
    
TogglePlayerSpectating(playeridtrue);
    return 
1;
}

public 
OnPlayerStateChange(playeridnewstateoldstate)
{
    if(
newstate == PLAYER_STATE_SPAWNED)
    {
        
PlayerInfo[playerid][pHealth] = 50.0;
        
SafeSetPlayerHealth(playeridPlayerInfo[playerid][pHealth]); // Set player health to 50
    
}
    return 
1;
}

public 
OnPlayerRequestClass(playeridclassid)
{
    if(
gPlayerLogged[playerid] == true)
    {
        
CreateSpawnInfo(playerid);
        
SpawnPlayer(playerid);
    }
    else return 
false;
    return 
true;
}

public 
OnPlayerRequestSpawn(playerid)
{
    if(
gPlayerLogged[playerid] == true)
    {
        
CreateSpawnInfo(playerid);
        
SpawnPlayer(playerid);
    }
    else return 
false;
    return 
true;
}

Dialog(Login)
{
    new 
query[100], hashpass[129], playername[MAX_PLAYER_NAME];
    
GetPlayerName(playeridplayernamesizeof(playername));
    
WP_Hash(hashpasssizeof(hashpass), inputtext);
    if(!
strcmp(hashpassPlayerInfo[playerid][pPass]))
    {
        
mysql_format(mysqlquerysizeof(query), "SELECT * FROM `Players` WHERE `Name` = '%e' LIMIT 1"playername);
         
mysql_tquery(mysqlquery"OnAccountLoad""i"playerid);
          
Login[playerid] = 1;
    }
    else
    {
        
gPlayerLogTries[playerid] += 1;
         
ShowPlayerDialog(playerid888DIALOG_STYLE_PASSWORD"Try Again, please Loggin""{800000}Password {FFFFFF}which you type is incorrect.\nType your {800000}password {FFFFFF}in fields bellow.""Login""Quit");
        if(
gPlayerLogTries[playerid] == 3) { Kick(playerid); gPlayerLogTries[playerid] = 0printf("6");}
    }
     return 
1;
}


forward OnAccountLoad(playerid);
public 
OnAccountLoad(playerid)
{
    
PlayerInfo[playerid][pLevel] = cache_get_field_content_int(0"Level");
    
PlayerInfo[playerid][pAdmin] = cache_get_field_content_int(0"Admin");
    
PlayerInfo[playerid][pMoney] = cache_get_field_content_int(0"Money");
    
PlayerInfo[playerid][pPos_x] = cache_get_field_content_float(0"Pos_x");
    
PlayerInfo[playerid][pPos_y] = cache_get_field_content_float(0"Pos_y");
    
PlayerInfo[playerid][pPos_z] = cache_get_field_content_float(0"Pos_z");
    
PlayerInfo[playerid][pChar] = cache_get_field_content_int(0"Char");
    
PlayerInfo[playerid][pHealth] = cache_get_field_content_float(0"Health");
    
    
TogglePlayerSpectating(playeridfalse);
    
gPlayerLogged[playerid] = true;
    
CreateSpawnInfo(playerid);
     
SpawnPlayer(playerid);
     
     
//Here i don't use SafeSetPlayerHealth(playerid, PlayerInfo[playerid][pHealth]); because not work
     
return 1;



Viewing all articles
Browse latest Browse all 18226

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>