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, -1, cHandle);
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, -1, cHandle);
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, -1, cHandle);
//
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, -1, cHandle);
if(GetPVarInt(playerid, "GunCheat") == 0)
{
for(new i = 0; i < 13; i++)
{
GetPlayerWeaponData(playerid, i, PI[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, -1, cHandle);
}
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), cHandle, sizeof(qurey));
cache_get_field_content(0, "Password", PI[playerid][pPassword], cHandle, sizeof(qurey));
cache_get_field_content(0, "Email", PI[playerid][pEmail], cHandle, sizeof(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], cHandle, sizeof(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], cHandle, sizeof(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], cHandle, sizeof(qurey));
sscanf(PI[playerid][pPhones], "p<,>a<i>[3]", PI[playerid][pPhone]);
cache_get_field_content(0, "Licenses", PI[playerid][pLics], cHandle, sizeof(qurey));
sscanf(PI[playerid][pLics], "p<,>a<i>[5]",PI[playerid][pLic]);
//
cache_get_field_content(0, "Stuff", PI[playerid][pStuff], cHandle, sizeof(qurey));
sscanf(PI[playerid][pStuff], "p<,>a<i>[3]",PI[playerid][pStuf]);
cache_get_field_content(0, "JobAmount", PI[playerid][pJobAmounts], cHandle, sizeof(qurey));
sscanf(PI[playerid][pJobAmounts], "p<,>a<i>[3]",PI[playerid][pJobAmount]);
//
cache_get_field_content(0, "Guns", PI[playerid][pGuns], cHandle, sizeof(qurey));
sscanf(PI[playerid][pGuns], "p<,>a<i>[13]",PI[playerid][pGun]);
cache_get_field_content(0, "Ammos", PI[playerid][pAmmos], cHandle, sizeof(qurey));
sscanf(PI[playerid][pAmmos], "p<,>a<i>[13]",PI[playerid][pAmmo]);
//
SetSpawnInfo(playerid, 255, PI[playerid][pSkin], 0, 0, 0, 1.0, -1, -1, -1, -1, -1, -1);
PlayerLogged[playerid] = 1;
KillTimer(EnterTimer[playerid]);
LoadMyCar(playerid);
SetHealth(playerid, PI[playerid][pHeal]);
SetMoney(playerid, PI[playerid][pCash]);
GetPlayerIp(playerid,PI[playerid][pConnectIp],16);
SendMes(playerid, COLOR_PAYCHEC, "Добро пожаловать на test Role Play");
if(PI[playerid][pTxt] == 1)
{
SendMes(playerid, COLOR_RED, "Ваш дом был продан гос-ву за неуплату налогов!"),SendMes(playerid, COLOR_RED, "Деньги за дом были переведены на Ваш банковский счет.");
PI[playerid][pBank] += PI[playerid][pPutMoney], PlusBankMoney(playerid, PI[playerid][pPutMoney]);
PI[playerid][pTxt] = 0, PI[playerid][pPutMoney] = 0;
SavePlayer(playerid);
}
CheckBank(playerid);
SpawnPlayer(playerid);
return 1;
}