Hey guys, i faced with another problem. Player information is not updating after player disconnect, please help me.
Код:
// New's
enum pInfo
{
ID,
ORM:ORM_ID,
IP[24],
Name[MAX_PLAYER_NAME+1],
Password[101],
pScore,
pMoney,
pSkin,
pCookies,
pKills,
Float:pPosX,
Float:pPosY,
Float:pPosZ,
Float:pPosA,
bool: Admin,
bool: VIP,
Kalba,
Ispejimai,
Float: PosX,
Float: PosY,
Float: PosZ,
Float: PosA,
Registracija[MAX_PLAYERS],
PaskutinisIP[24],
Email[101],
Data[75],
RegDate[75]
}
enum Settings
{
ID,
ORM:ORM_ID,
SpeedBooster,
CarJump,
cRepair,
tColor,
tPaintJob,
tHydraulics,
tNitro,
tWheels,
tNeon,
Godmode,
Name[MAX_PLAYER_NAME+1]
}
enum Papildomi
{
ID,
Name[MAX_PLAYER_NAME+1],
ORM:ORM_ID,
ORM:PapildomaInformacija
}
public OnPlayerConnect(playerid)
{
papildoma = Papildoma[playerid][ORM_ID] = orm_create("papildoma");
settings = PlayerSettings[playerid][ORM_ID] = orm_create("nustatymai");
playerdata = PlayerInfo[playerid][ORM_ID] = orm_create("playerdata");
PlayerInfo[playerid][RegDate] = GetPlayerDate();
PlayerInfo[playerid][IP] = GetIp(playerid);
PlayerInfo[playerid][PaskutinisIP] = GetIp(playerid);
GetPlayerName(playerid, PlayerInfo[playerid][Name], MAX_PLAYER_NAME);
GetPlayerName(playerid, PlayerSettings[playerid][Name], MAX_PLAYER_NAME);
GetPlayerName(playerid, Papildoma[playerid][Name], MAX_PLAYER_NAME);
// Krovimas - Ћaidėjo Informacija
orm_addvar_int(playerdata, PlayerInfo[playerid][ID], "id");
orm_addvar_string(playerdata, PlayerInfo[playerid][Name], MAX_PLAYER_NAME+1, "user");
orm_addvar_string(playerdata, PlayerInfo[playerid][Password], 101, "password");
orm_addvar_int(playerdata, PlayerInfo[playerid][Kalba], "kalba");
orm_addvar_int(playerdata, PlayerInfo[playerid][pScore], "score");
orm_addvar_int(playerdata, PlayerInfo[playerid][pMoney], "money");
orm_addvar_int(playerdata, PlayerInfo[playerid][pSkin], "skin");
orm_addvar_float(playerdata, PlayerInfo[playerid][PosX], "posx");
orm_addvar_float(playerdata, PlayerInfo[playerid][PosY], "posy");
orm_addvar_float(playerdata, PlayerInfo[playerid][PosZ], "posz");
orm_addvar_float(playerdata, PlayerInfo[playerid][PosA], "posa");
orm_addvar_int(playerdata, PlayerInfo[playerid][Registracija], "reg");
orm_addvar_string(playerdata, PlayerInfo[playerid][IP], 24, "IP");
orm_addvar_string(playerdata, PlayerInfo[playerid][RegDate], 75, "regdate");
orm_addvar_string(playerdata, PlayerInfo[playerid][Data], 75, "prisijungimas");
orm_addvar_string(playerdata, PlayerInfo[playerid][PaskutinisIP], 24, "prisijungip");
orm_addvar_string(playerdata, PlayerInfo[playerid][Email], 101, "email");
orm_setkey(playerdata, "user");
// Korvimas - Nustatymai
orm_addvar_int(settings, PlayerSettings[playerid][ID], "id");
orm_addvar_string(settings, PlayerSettings[playerid][Name], MAX_PLAYER_NAME+1, "Vardas");
orm_addvar_int(settings, PlayerSettings[playerid][cRepair], "cRepair");
orm_addvar_int(settings, PlayerSettings[playerid][SpeedBooster], "SpeedBooster");
orm_addvar_int(settings, PlayerSettings[playerid][CarJump], "CarJump");
orm_addvar_int(settings, PlayerSettings[playerid][tColor], "tColor");
orm_addvar_int(settings, PlayerSettings[playerid][tPaintJob], "tPaintJob");
orm_addvar_int(settings, PlayerSettings[playerid][tHydraulics], "tHydraulics");
orm_addvar_int(settings, PlayerSettings[playerid][tNitro], "tNitro");
orm_addvar_int(settings, PlayerSettings[playerid][tWheels], "tWheels");
orm_addvar_int(settings, PlayerSettings[playerid][tNeon], "tNeon");
orm_addvar_int(settings, PlayerSettings[playerid][Godmode], "Godmode");
orm_setkey(settings, "Vardas");
// Krovimas - Papildoma Informacija
orm_addvar_int(papildoma, Papildoma[playerid][ID], "id");
orm_addvar_string(papildoma, Papildoma[playerid][Name], MAX_PLAYER_NAME+1, "Vardas");
orm_addvar_int(papildoma, UzbaigtiIsukiai[playerid][1], "UI1");
orm_addvar_int(papildoma, UzbaigtiIsukiai[playerid][2], "UI2");
orm_addvar_int(papildoma, UzbaigtiIsukiai[playerid][3], "UI3");
orm_addvar_int(papildoma, UzbaigtiIsukiai[playerid][4], "UI4");
orm_addvar_int(papildoma, UzbaigtiIsukiai[playerid][5], "UI5");
orm_addvar_int(papildoma, UzbaigtiIsukiai[playerid][6], "UI6");
orm_addvar_int(papildoma, UzbaigtiIsukiai[playerid][7], "UI7");
orm_addvar_int(papildoma, UzbaigtiIsukiai[playerid][8], "UI8");
orm_addvar_int(papildoma, UzbaigtiIsukiai[playerid][9], "UI9");
orm_addvar_int(papildoma, UzbaigtiIsukiai[playerid][10], "UI10");
orm_addvar_int(papildoma, UzbaigtiIsukiai[playerid][11], "UI11");
orm_addvar_int(papildoma, UzbaigtiIsukiai[playerid][12], "UI12");
orm_addvar_int(papildoma, UzbaigtiIsukiai[playerid][13], "UI13");
orm_addvar_int(papildoma, UzbaigtiIsukiai[playerid][14], "UI14");
orm_addvar_int(papildoma, UzbaigtiIsukiai[playerid][15], "UI15");
orm_addvar_int(papildoma, UzbaigtiIsukiai[playerid][16], "UI16");
orm_addvar_int(papildoma, UzbaigtiIsukiai[playerid][17], "UI17");
orm_setkey(papildoma, "Vardas");
// Krovimas Baigtas!
orm_select(playerdata, "OnPlayerDataLoad", "d", playerid);
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
if(PlayerInfo[playerid][ID] != 0) {
MySQL_Update(playerid);
}
orm_destroy(PlayerInfo[playerid][ORM_ID]);
orm_destroy(PlayerSettings[playerid][ORM_ID]);
orm_destroy(Papildoma[playerid][ORM_ID]);
return 1;
}
stock MySQL_Update(playerid)
{
// Nustatymai
GetPlayerPos(playerid, PlayerInfo[playerid][PosX], PlayerInfo[playerid][PosY], PlayerInfo[playerid][PosZ]);
GetPlayerFacingAngle(playerid, PlayerInfo[playerid][PosA]);
PlayerInfo[playerid][pSkin] = GetPlayerSkin(playerid);
PlayerInfo[playerid][pMoney] = GetPlayerMoney(playerid);
PlayerInfo[playerid][pScore] = GetPlayerScore(playerid);
PlayerInfo[playerid][Data] = GetPlayerDate();
PlayerInfo[playerid][RegDate] = GetPlayerDate();
orm_delvar(playerdata, "regdate");
orm_delvar(playerdata, "IP");
orm_delvar(playerdata, "email");
// Update
orm_update(PlayerInfo[playerid][ORM_ID]);
orm_update(PlayerSettings[playerid][ORM_ID]);
orm_update(Papildoma[playerid][ORM_ID]);
return 1;
}
Код:
[16:29:05] [DEBUG] orm_create - table: "papildoma", connectionHandle: 1
[16:29:05] [DEBUG] COrm::Create - creating new orm object..
[16:29:05] [DEBUG] COrm::Create - orm object created (id: 1)
[16:29:05] [DEBUG] orm_create - table: "nustatymai", connectionHandle: 1
[16:29:05] [DEBUG] COrm::Create - creating new orm object..
[16:29:05] [DEBUG] COrm::Create - orm object created (id: 2)
[16:29:05] [DEBUG] orm_create - table: "playerdata", connectionHandle: 1
[16:29:05] [DEBUG] COrm::Create - creating new orm object..
[16:29:05] [DEBUG] COrm::Create - orm object created (id: 3)
[16:29:05] [DEBUG] orm_addvar - orm_id: 3, var: 039CB9F0, datatype: 0, varname: "id", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 3, var: 039CBA58, datatype: 2, varname: "user", var_maxlen: 25
[16:29:05] [DEBUG] orm_addvar - orm_id: 3, var: 039CBABC, datatype: 2, varname: "password", var_maxlen: 101
[16:29:05] [DEBUG] orm_addvar - orm_id: 3, var: 039CBC7C, datatype: 0, varname: "kalba", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 3, var: 039CBC50, datatype: 0, varname: "score", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 3, var: 039CBC54, datatype: 0, varname: "money", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 3, var: 039CBC58, datatype: 0, varname: "skin", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 3, var: 039CBC84, datatype: 1, varname: "posx", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 3, var: 039CBC88, datatype: 1, varname: "posy", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 3, var: 039CBC8C, datatype: 1, varname: "posz", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 3, var: 039CBC90, datatype: 1, varname: "posa", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 3, var: 039CBC94, datatype: 0, varname: "reg", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 3, var: 039CB9F8, datatype: 2, varname: "IP", var_maxlen: 24
[16:29:05] [DEBUG] orm_addvar - orm_id: 3, var: 039CC198, datatype: 2, varname: "regdate", var_maxlen: 75
[16:29:05] [DEBUG] orm_addvar - orm_id: 3, var: 039CC06C, datatype: 2, varname: "prisijungimas", var_maxlen: 75
[16:29:05] [DEBUG] orm_addvar - orm_id: 3, var: 039CBE78, datatype: 2, varname: "prisijungip", var_maxlen: 24
[16:29:05] [DEBUG] orm_addvar - orm_id: 3, var: 039CBED8, datatype: 2, varname: "email", var_maxlen: 101
[16:29:05] [DEBUG] orm_setkey - orm_id: 3, varname: "user"
[16:29:05] [DEBUG] orm_addvar - orm_id: 2, var: 03A0E808, datatype: 0, varname: "id", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 2, var: 03A0E838, datatype: 2, varname: "Vardas", var_maxlen: 25
[16:29:05] [DEBUG] orm_addvar - orm_id: 2, var: 03A0E818, datatype: 0, varname: "cRepair", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 2, var: 03A0E810, datatype: 0, varname: "SpeedBooster", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 2, var: 03A0E814, datatype: 0, varname: "CarJump", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 2, var: 03A0E81C, datatype: 0, varname: "tColor", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 2, var: 03A0E820, datatype: 0, varname: "tPaintJob", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 2, var: 03A0E824, datatype: 0, varname: "tHydraulics", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 2, var: 03A0E828, datatype: 0, varname: "tNitro", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 2, var: 03A0E82C, datatype: 0, varname: "tWheels", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 2, var: 03A0E830, datatype: 0, varname: "tNeon", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 2, var: 03A0E834, datatype: 0, varname: "Godmode", var_maxlen: 1
[16:29:05] [DEBUG] orm_setkey - orm_id: 2, varname: "Vardas"
[16:29:05] [DEBUG] orm_addvar - orm_id: 1, var: 03A12FE0, datatype: 0, varname: "id", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 1, var: 03A12FE4, datatype: 2, varname: "Vardas", var_maxlen: 25
[16:29:05] [DEBUG] orm_addvar - orm_id: 1, var: 03A166B8, datatype: 0, varname: "UI1", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 1, var: 03A166BC, datatype: 0, varname: "UI2", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 1, var: 03A166C0, datatype: 0, varname: "UI3", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 1, var: 03A166C4, datatype: 0, varname: "UI4", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 1, var: 03A166C8, datatype: 0, varname: "UI5", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 1, var: 03A166CC, datatype: 0, varname: "UI6", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 1, var: 03A166D0, datatype: 0, varname: "UI7", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 1, var: 03A166D4, datatype: 0, varname: "UI8", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 1, var: 03A166D8, datatype: 0, varname: "UI9", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 1, var: 03A166DC, datatype: 0, varname: "UI10", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 1, var: 03A166E0, datatype: 0, varname: "UI11", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 1, var: 03A166E4, datatype: 0, varname: "UI12", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 1, var: 03A166E8, datatype: 0, varname: "UI13", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 1, var: 03A166EC, datatype: 0, varname: "UI14", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 1, var: 03A166F0, datatype: 0, varname: "UI15", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 1, var: 03A166F4, datatype: 0, varname: "UI16", var_maxlen: 1
[16:29:05] [DEBUG] orm_addvar - orm_id: 1, var: 03A166F8, datatype: 0, varname: "UI17", var_maxlen: 1
[16:29:05] [DEBUG] orm_setkey - orm_id: 1, varname: "Vardas"
[16:29:05] [DEBUG] orm_select - orm_id: 3, callback: "OnPlayerDataLoad", format: "d"
[16:29:05] [DEBUG] CMySQLQuery::Execute[OnPlayerDataLoad] - starting query execution
[16:29:05] [DEBUG] CMySQLQuery::Execute[OnPlayerDataLoad] - query was successfully executed within 0.567 milliseconds
[16:29:05] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[16:29:05] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '0', data: "99"
[16:29:05] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '1', data: "81dc9bdb52d04dc20036dbd8313ed055"
[16:29:05] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '2', data: "1"
[16:29:05] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '3', data: "4"
[16:29:05] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '4', data: "12071"
[16:29:05] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '5', data: "19"
[16:29:05] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '6', data: "-2141"
[16:29:05] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '7', data: "1139"
[16:29:05] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '8', data: "76"
[16:29:05] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '9', data: "180"
[16:29:05] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '10', data: "4"
[16:29:05] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '11', data: "127.0.0.1"
[16:29:05] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '12', data: "2014-02-22"
[16:29:05] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '13', data: "2014-02-22"
[16:29:05] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '14', data: "127.0.0.1"
[16:29:05] [DEBUG] CMySQLResult::GetRowData - row: '0', field: '15', data: "test@gmail.com"
[16:29:05] [DEBUG] Calling callback "OnPlayerDataLoad"..
[16:29:05] [DEBUG] orm_errno - orm_id: 3
[16:29:05] [DEBUG] orm_setkey - orm_id: 3, varname: "id"
[16:29:05] [DEBUG] orm_setkey - orm_id: 2, varname: "id"
[16:29:05] [DEBUG] orm_setkey - orm_id: 1, varname: "id"
[16:29:05] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[16:29:14] [DEBUG] mysql_escape_string - source: "1234", connection: 1, max_len: 101
[16:29:14] [DEBUG] orm_select - orm_id: 2, callback: "OnPlayerLoadSettings", format: "d"
[16:29:14] [DEBUG] CMySQLQuery::Execute[OnPlayerLoadSettings] - starting query execution
[16:29:14] [DEBUG] CMySQLQuery::Execute[OnPlayerLoadSettings] - query was successfully executed within 0.477 milliseconds
[16:29:14] [DEBUG] CMySQLResult::CMySQLResult() - constructor called
[16:29:14] [DEBUG] Calling callback "OnPlayerLoadSettings"..
[16:29:14] [DEBUG] orm_errno - orm_id: 2
[16:29:14] [DEBUG] CMySQLResult::~CMySQLResult() - deconstructor called
[16:30:46] [DEBUG] orm_delvar - orm_id: 3, varname: "regdate"
[16:30:46] [DEBUG] orm_delvar - orm_id: 3, varname: "IP"
[16:30:46] [DEBUG] orm_delvar - orm_id: 3, varname: "email"
[16:30:46] [DEBUG] orm_update - orm_id: 3
[16:30:46] [DEBUG] orm_update - orm_id: 2
[16:30:46] [DEBUG] orm_update - orm_id: 1
[16:30:46] [DEBUG] orm_destroy - orm_id: 3
[16:30:46] [DEBUG] COrm::Destroy - orm object destroyed (id: 3)
[16:30:46] [DEBUG] orm_destroy - orm_id: 2
[16:30:46] [DEBUG] COrm::Destroy - orm object destroyed (id: 2)
[16:30:46] [DEBUG] orm_destroy - orm_id: 1
[16:30:46] [DEBUG] COrm::Destroy - orm object destroyed (id: 1)
[16:30:46] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[16:30:46] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 33.666 milliseconds
[16:30:46] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving
[16:30:46] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[16:30:46] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 0.534 milliseconds
[16:30:46] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving
[16:30:46] [DEBUG] CMySQLQuery::Execute[] - starting query execution
[16:30:46] [DEBUG] CMySQLQuery::Execute[] - query was successfully executed within 1.409 milliseconds
[16:30:46] [DEBUG] CMySQLQuery::Execute[] - no callback specified, skipping result saving
playerdata is updating, but another 2 tables(papildoma, nustatymai) is not updating.