SQLite functions!
#5

any one knows why this code crashes my server?

PHP код:
LoadData(playerid)
{
    new 
DBResultqueryszQuery[200], szPlayerName[MAX_PLAYER_NAME];
    
GetPlayerName(playeridszPlayerNameMAX_PLAYER_NAME);
    new 
Field[20], x[20], y[20], z[20], a[20];
    
format(szQuerysizeof(szQuery), "SELECT * from players WHERE NAME = '%s'"DB_Escape(szPlayerName));
    
query db_query(someDBszQuery);
    if(
db_num_rows(query))
    {
        
db_get_field_assoc(query"CASH"Field30);
        
GivePlayerMoney(playeridstrval(Field));
        
//---
        
db_get_field_assoc(query"ADMINLEVEL"Field30);
        
pData[playerid][pAdminLevel] = strval(Field);
        
//---
        
db_get_field_assoc(query"LEVEL"Field30);
        
SetPlayerScore(playeridstrval(Field));
           
//---
           
db_get_field_assoc(query"GENDER"Field30);
        
pData[playerid][pGender] = strval(Field);
        
//---
        
db_get_field_assoc(query"AGE"Field30);
        
pData[playerid][pAge] = strval(Field);
        
//---
        
db_get_field_assoc(query"SKIN"Field30);
        
SetPlayerSkin(playeridstrval(Field));
        new    
skin =  strval(Field);
        
//---
          
db_get_field_assoc(query"GUN1"Field30);
        
GivePlayerWeapon(playeridstrval(Field), pData[playerid][pAmmo1]);
         
//---
          
db_get_field_assoc(query"GUN2"Field30);
        
GivePlayerWeapon(playeridstrval(Field), pData[playerid][pAmmo2]);
         
//---
         
db_get_field_assoc(query"GUN3"Field30);
        
GivePlayerWeapon(playeridstrval(Field), pData[playerid][pAmmo3]);
         
//---
          
db_get_field_assoc(query"AMMO1"Field30);
        
SetPlayerAmmo(playeridpData[playerid][pGun1],  strval(Field));
          
//---
           
db_get_field_assoc(query"AMMO2"Field30);
        
SetPlayerAmmo(playeridpData[playerid][pGun2],  strval(Field));
        
//---
        
db_get_field_assoc(query"AMMO3"Field30);
        
SetPlayerAmmo(playeridpData[playerid][pGun3],  strval(Field));
        
//---
        
db_get_field_assoc(query"POS_X"x30);
        
db_get_field_assoc(query"POS_Y"y30);
        
db_get_field_assoc(query"POS_Z"z30);
        
db_get_field_assoc(query"POS_A"a30);
        
pData[playerid][pPos_x] = strval(x);
        
pData[playerid][pPos_y] = strval(y);
        
pData[playerid][pPos_z] = strval(z);
        
pData[playerid][pPos_a] = strval(a);
        
SetSpawnInfo(playerid0skinpData[playerid][pPos_x], pData[playerid][pPos_y], pData[playerid][pPos_z], pData[playerid][pPos_a], pData[playerid][pGun1], pData[playerid][pAmmo1],pData[playerid][pGun2], pData[playerid][pAmmo2], pData[playerid][pGun3], pData[playerid][pAmmo3]);
        
SpawnPlayer(playerid);
        
//if(pData[playerid][pGun1] != 0 || pData[playerid][pGun2] != 0 || pData[playerid][pGun3] != 0) { return SendClientMessage(playerid, COLOR_YELLOW, "[TIPS]:"COL_GREEN" /getweapons to restore back your weapons");
    
}
    else {
        
SendClientMessage(playeridCOLOR_RED"ERROR(001): Couldn't Load Your DatBase");
    }
    return 
1;

Reply


Messages In This Thread
SQLite functions! - by Youice - 25.10.2012, 00:45
Re: SQLite functions! - by Emmet_ - 25.10.2012, 00:47
Re: SQLite functions! - by ReneG - 25.10.2012, 00:49
Re: SQLite functions! - by Youice - 25.10.2012, 00:50
Re: SQLite functions! - by Youice - 25.10.2012, 00:55
Re: SQLite functions! - by ReneG - 25.10.2012, 00:57
Re: SQLite functions! - by Youice - 25.10.2012, 00:59
Re: SQLite functions! - by ReneG - 25.10.2012, 01:02
Re: SQLite functions! - by Youice - 25.10.2012, 01:09
Re: SQLite functions! - by Kevin FOx - 25.10.2012, 01:18

Forum Jump:


Users browsing this thread: 1 Guest(s)