После добавления новых данных, нет сохранения.
#1

Хотел бы спросить, не могу понять почему уже месяц где-то, нужна помощь. Хочу добавить для игрока новое значение в БД, в моде кажеться все правильно вставил, но после того как скомпилировал мод, захожу на сервер, и теперь ни чего не сохроняется вообще. В чем проблема, подскажите пожалуйсто.
Вот мод, рабочая версия, без добавлений:
http://rghost.ru/54451456
Reply
#2

В таблицу не забывай поле добавлять.
Reply
#3

Добавлял.
Reply
#4

Тогда дай код, который отвечает конкретно за сохранение и загрузку аккаунтов, никакому адекватному человеку не захочется копаться на свалке размером в 15 тысяч строк
Reply
#5

PHP код:
stock SavePlayer(playerid)
{
    if(
PlayerLogged[playerid] == 0) return 1;
    
query "";
    
format(query,sizeof(query),"UPDATE `"TABLE_ACCOUNT"` SET \
        `Admin` = %d, `AdmKey` = '%s', `Muted` = %d, `Heal` = '%f', `Cash` = %d, `Sex` = %d, `Skin` = %d, `FracSkin` = %d WHERE `Name` = '%s'"
,
        
PI[playerid][pAdmLevel],PI[playerid][pAdmKey],PI[playerid][pMuted],PI[playerid][pHeal],PI[playerid][pCash],PI[playerid][pSex],PI[playerid][pSkin],PI[playerid][pFracSkin],NamePlayer(playerid)
    );
    
mysql_query(query, -1, -1cHandle);
    
query "";
    
format(query,sizeof(query),"UPDATE `"TABLE_ACCOUNT"` SET \
        `Level` = %d, `Exp` = %d, `Leader` = %d, `Member` = %d, `Rank` = %d, `Warn` = %d, `Job` = %d, `Jail` = %d, `JailTime` = %d WHERE `Name` = '%s'"
,
        
PI[playerid][pLevel],PI[playerid][pExp],PI[playerid][pLeader],PI[playerid][pMember],PI[playerid][pRank],PI[playerid][pWarn],PI[playerid][pJob],PI[playerid][pJail],PI[playerid][pJailTime],NamePlayer(playerid)
    );
    
mysql_query(query, -1, -1cHandle);
    
format(PI[playerid][pPhones],16,"%i,%i,%i",PI[playerid][pPhone][0],PI[playerid][pPhone][1],PI[playerid][pPhone][2]);
    
format(PI[playerid][pLics],40,"%i,%i,%i,%i,%i",PI[playerid][pLic][0],PI[playerid][pLic][1],PI[playerid][pLic][2],PI[playerid][pLic][3],PI[playerid][pLic][4]);
    
query "";
    
format(query,sizeof(query),"UPDATE `"TABLE_ACCOUNT"` SET \
        `Phone` = '%s', `Licenses` = '%s', `PayCheck` = %d, `Txt` = %d, `PutMoney` = %d WHERE `Name` = '%s'"
,
        
PI[playerid][pPhones],PI[playerid][pLics],PI[playerid][pPayCheck],PI[playerid][pTxt],PI[playerid][pPutMoney],NamePlayer(playerid)
    );
    
mysql_query(query, -1, -1cHandle);
    
//
    
format(PI[playerid][pStuff],30,"%i,%i,%i",PI[playerid][pStuf][0],PI[playerid][pStuf][1],PI[playerid][pStuf][2]);
    
format(PI[playerid][pJobAmounts],30,"%i,%i,%i",PI[playerid][pJobAmount][0],PI[playerid][pJobAmount][1],PI[playerid][pJobAmount][2]);
    
query "";
    
format(query,sizeof(query),"UPDATE `"TABLE_ACCOUNT"` SET `Stuff` = '%s', `JobAmount` = '%s' WHERE `Name` = '%s'",PI[playerid][pStuff],PI[playerid][pJobAmounts],NamePlayer(playerid));
    
mysql_query(query, -1, -1cHandle);
    if(
GetPVarInt(playerid"GunCheat") == 0)
    {
        for(new 
013i++)
        {
            
GetPlayerWeaponData(playeridiPI[playerid][pGun][i], PI[playerid][pAmmo][i]);
        }
        
format(PI[playerid][pGuns],40,"%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",
        
PI[playerid][pGun][0],PI[playerid][pGun][1],PI[playerid][pGun][2],PI[playerid][pGun][3],PI[playerid][pGun][4],PI[playerid][pGun][5],
        
PI[playerid][pGun][6],PI[playerid][pGun][7],PI[playerid][pGun][8],PI[playerid][pGun][9],PI[playerid][pGun][10],PI[playerid][pGun][11],PI[playerid][pGun][12]);
        
format(PI[playerid][pAmmos],128,"%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d",
        
PI[playerid][pAmmo][0],PI[playerid][pAmmo][1],PI[playerid][pAmmo][2],PI[playerid][pAmmo][3],PI[playerid][pAmmo][4],PI[playerid][pAmmo][5],
        
PI[playerid][pAmmo][6],PI[playerid][pAmmo][7],PI[playerid][pAmmo][8],PI[playerid][pAmmo][9],PI[playerid][pAmmo][10],PI[playerid][pAmmo][11],PI[playerid][pAmmo][12]);
        
query "";
        
format(query,sizeof(query),"UPDATE `"TABLE_ACCOUNT"` SET `Guns` = '%s', `Ammos` = '%s' WHERE `Name` = '%s'",PI[playerid][pGuns],PI[playerid][pAmmos],NamePlayer(playerid));
        
mysql_query(query, -1, -1cHandle);
    }
    return 
1;

PHP код:
forward LoadPlayer(playerid);
public 
LoadPlayer(playerid)
{
    
PI[playerid][pID] = cache_get_field_content_int(0"id"cHandle);
    
cache_get_field_content(0"Name"NamePlayer(playerid), cHandlesizeof(qurey));
    
cache_get_field_content(0"Password"PI[playerid][pPassword], cHandlesizeof(qurey));
    
cache_get_field_content(0"Email"PI[playerid][pEmail], cHandlesizeof(qurey));
    
PI[playerid][pTxt] = cache_get_field_content_int(0"Txt"cHandle);
    
PI[playerid][pPutMoney] = cache_get_field_content_int(0"PutMoney"cHandle);
    
PI[playerid][pAdmLevel] = cache_get_field_content_int(0"Admin"cHandle);
    
cache_get_field_content(0"AdmKey"PI[playerid][pAdmKey], cHandlesizeof(qurey));
    
PI[playerid][pMuted] = cache_get_field_content_int(0"Muted"cHandle);
    
PI[playerid][pHeal] = cache_get_field_content_float(0"Heal"cHandle);
    
PI[playerid][pCash] = cache_get_field_content_int(0"Cash"cHandle);
    
PI[playerid][pSex] = cache_get_field_content_int(0"Sex"cHandle);
    
cache_get_field_content(0"RegIp"PI[playerid][pRegIp], cHandlesizeof(qurey));
    
PI[playerid][pSkin] = cache_get_field_content_int(0"Skin"cHandle);
    
PI[playerid][pFracSkin] = cache_get_field_content_int(0"FracSkin"cHandle);
    
PI[playerid][pLevel] = cache_get_field_content_int(0"Level"cHandle);
    
PI[playerid][pExp] = cache_get_field_content_int(0"Exp"cHandle);
    
PI[playerid][pLeader] = cache_get_field_content_int(0"Leader"cHandle);
    
PI[playerid][pMember] = cache_get_field_content_int(0"Member"cHandle);
    
PI[playerid][pRank] = cache_get_field_content_int(0"Rank"cHandle);
    
PI[playerid][pWarn] = cache_get_field_content_int(0"Warn"cHandle);
    
PI[playerid][pGoro] = cache_get_field_content_int(0"Goro"cHandle);
    
PI[playerid][pJob] = cache_get_field_content_int(0"Job"cHandle);
    
PI[playerid][pJail] = cache_get_field_content_int(0"Jail"cHandle);
    
PI[playerid][pJailTime] = cache_get_field_content_int(0"JailTime"cHandle);
    
PI[playerid][pPayCheck] = cache_get_field_content_int(0"PayCheck"cHandle);
    
PI[playerid][pRegDate] = cache_get_field_content_int(0"RegDate"cHandle);
    
cache_get_field_content(0"Phone"PI[playerid][pPhones], cHandlesizeof(qurey));
    
sscanf(PI[playerid][pPhones], "p<,>a<i>[3]"PI[playerid][pPhone]);
    
cache_get_field_content(0"Licenses"PI[playerid][pLics], cHandlesizeof(qurey));
    
sscanf(PI[playerid][pLics], "p<,>a<i>[5]",PI[playerid][pLic]);
    
//
    
cache_get_field_content(0"Stuff"PI[playerid][pStuff], cHandlesizeof(qurey));
    
sscanf(PI[playerid][pStuff], "p<,>a<i>[3]",PI[playerid][pStuf]);
    
cache_get_field_content(0"JobAmount"PI[playerid][pJobAmounts], cHandlesizeof(qurey));
    
sscanf(PI[playerid][pJobAmounts], "p<,>a<i>[3]",PI[playerid][pJobAmount]);
    
//
    
cache_get_field_content(0"Guns"PI[playerid][pGuns], cHandlesizeof(qurey));
    
sscanf(PI[playerid][pGuns], "p<,>a<i>[13]",PI[playerid][pGun]);
    
cache_get_field_content(0"Ammos"PI[playerid][pAmmos], cHandlesizeof(qurey));
    
sscanf(PI[playerid][pAmmos], "p<,>a<i>[13]",PI[playerid][pAmmo]);
    
//
    
SetSpawnInfo(playerid255PI[playerid][pSkin], 0001.0, -1, -1, -1, -1, -1, -1);
    
PlayerLogged[playerid] = 1;
    
KillTimer(EnterTimer[playerid]);
    
LoadMyCar(playerid);
    
SetHealth(playeridPI[playerid][pHeal]);
    
SetMoney(playeridPI[playerid][pCash]);
    
GetPlayerIp(playerid,PI[playerid][pConnectIp],16);
    
SendMes(playeridCOLOR_PAYCHEC"Добро пожаловать на test Role Play");
    if(
PI[playerid][pTxt] == 1)
    {
        
SendMes(playeridCOLOR_RED"Ваш дом был продан гос-ву за неуплату налогов!"),SendMes(playeridCOLOR_RED"Деньги за дом были переведены на Ваш банковский счет.");
        
PI[playerid][pBank] += PI[playerid][pPutMoney], PlusBankMoney(playeridPI[playerid][pPutMoney]);
        
PI[playerid][pTxt] = 0PI[playerid][pPutMoney] = 0;
        
SavePlayer(playerid);
    }
    
CheckBank(playerid);
     
SpawnPlayer(playerid);
    return 
1;

Reply
#6

Запрос не уходит, возможно что маловата переменная.
Reply
#7

Какой столбец то добавил?
P.S. Поля с данными через запятую это ваще не хорошо.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)