forward SaveAccount(playerid);public SaveAccount(playerid) { new query[500]; GetPlayerPos(playerid, PlayerInfo[playerid][posx], PlayerInfo[playerid][posy], PlayerInfo[playerid][posz]); format(query, 500, "UPDATE `user` SET `posX`='%f', `posY`='%f', `posZ`='%f', `angle`='%f', `interiorid`='%f', `adminlvl`='%s', `pass2`='%f', `dinero`='%d', `dinerobank`='%d', `banco`='%d', `movil`='%d', `dni`='%d', `busquedad`='%d', `sexo`='%d', `edad`='%d',`skin`='%d',`origen`='%d',`faccion`='% s', `carcel`='%d', `vida`='%d', WHERE `id`='%d' LIMIT 1", PlayerInfo[playerid][posx], PlayerInfo[playerid][posy], PlayerInfo[playerid][posz], PlayerInfo[playerid][angle], PlayerInfo[playerid][interiorid], PlayerInfo[playerid][adminlvl], PlayerInfo[playerid][pass2], PlayerInfo[playerid][dinero], PlayerInfo[playerid][dinerobank], PlayerInfo[playerid][banco], PlayerInfo[playerid][movil], PlayerInfo[playerid][dni], PlayerInfo[playerid][Busqueda], PlayerInfo[playerid][sexo], PlayerInfo[playerid][edad], PlayerInfo[playerid][skin], PlayerInfo[playerid][origen], PlayerInfo[playerid][faccion], PlayerInfo[playerid][carcel], PlayerInfo[playerid][vida]); mysql_function_query(Conecction, query, true, "OnQueryFinish", "ii", 0, playerid); return 1; } |
orward OnQueryFinish(resultid, extraid, ConnectionHandle); public OnQueryFinish(resultid, extraid, ConnectionHandle) { new Rows, Field, string[256]; if(resultid != 0) { cache_get_data(Rows, Field); } switch(resultid) { case 1: { if(Rows == 1) { new content[20]; cache_get_field_content(0, "Contraseсa", PlayerInfo[extraid][passtext]); cache_get_field_content(0, "posX", content); PlayerInfo[extraid][posx] = floatstr(content); cache_get_field_content(0, "posY", content); PlayerInfo[extraid][posy] = floatstr(content); cache_get_field_content(0, "posZ", content); PlayerInfo[extraid][posz] = floatstr(content); cache_get_field_content(0, "angle", PlayerInfo[extraid][angle]); cache_get_field_content(0, "interiorid", content); PlayerInfo[extraid][interiorid] = strval(content); //cache_get_field_content(0, "virtualworldid", content); PlayerInfo[extraid][virtualworldid] = strval(content); cache_get_field_content(0, "adminlvl", PlayerInfo[extraid][adminlvl]); cache_get_field_content(0, "email", content); PlayerInfo[extraid][email] = strval(content); cache_get_field_content(0, "pass2", content); PlayerInfo[extraid][pass2] = strval(content); cache_get_field_content(0, "dinero", content); PlayerInfo[extraid][dinero] = strval(content); cache_get_field_content(0, "dinerobank", content); PlayerInfo[extraid][dinerobank] = strval(content); cache_get_field_content(0, "banco", content); PlayerInfo[extraid][banco] = strval(content); cache_get_field_content(0, "movil", content); PlayerInfo[extraid][movil] = strval(content); cache_get_field_content(0, "dni", content); PlayerInfo[extraid][dni] = strval(content); cache_get_field_content(0, "Busqueda", content); PlayerInfo[extraid][Busqueda] = strval(content); cache_get_field_content(0, "sexo", content); PlayerInfo[extraid][sexo] = strval(content); cache_get_field_content(0, "edad", content); PlayerInfo[extraid][edad] = strval(content); cache_get_field_content(0, "skin", content); PlayerInfo[extraid][skin] = strval(content); cache_get_field_content(0, "origen", content); PlayerInfo[extraid][origen] = strval(content); cache_get_field_content(0, "faccion", content); PlayerInfo[extraid][faccion] = strval(content); cache_get_field_content(0, "carcel", content); PlayerInfo[extraid][carcel] = strval(content); cache_get_field_content(0, "Vida", content); PlayerInfo[extraid][vida] = floatstr(content); cache_get_field_content(0, "Chaleco", content); PlayerInfo[extraid][chaleco] = floatstr(content); cache_get_field_content(0, "razonadv1", content); PlayerInfo[extraid][advrazon1] = strval(content); cache_get_field_content(0, "razonadv2", content); PlayerInfo[extraid][advrazon2] = strval(content); cache_get_field_content(0, "razonadv3", content); PlayerInfo[extraid][advrazon3] = strval(content); cache_get_field_content(0, "advertencias",content); PlayerInfo[extraid][warnings] = strval(content); cache_get_field_content(0, "DudeChannel", content); PlayerInfo[extraid][DudeChannel] = strval(content); cache_get_field_content(0, "KeyCar1", content); PlayerInfo[extraid][KeyCar1] = strval(content); cache_get_field_content(0, "KeyCar2", content); PlayerInfo[extraid][KeyCar2] = strval(content); cache_get_field_content(0, "KeyCar3", content); PlayerInfo[extraid][KeyCar3] = strval(content); SetSpawnInfo(extraid,0,0, PlayerInfo[extraid][posx],PlayerInfo[extraid][posy],PlayerInfo[extraid][posz],0.0,0,0,0,0,0,0); SetPlayerArmour(extraid, PlayerInfo[extraid][chaleco]); SetPlayerHealth(extraid, PlayerInfo[extraid][vida]); |
forward SaveAccount(playerid);public SaveAccount(playerid)
{
new
query[500];
GetPlayerPos(playerid, PlayerInfo[playerid][posx], PlayerInfo[playerid][posy], PlayerInfo[playerid][posz]);
format(query, sizeof query, "UPDATE `user` SET `posX`='%f', `posY`='%f', `posZ`='%f', `angle`='%f', `interiorid`='%f'",
PlayerInfo[playerid][posx],
PlayerInfo[playerid][posy],
PlayerInfo[playerid][posz],
PlayerInfo[playerid][angle],
PlayerInfo[playerid][interiorid]);
format(query, sizeof query, "%s, `adminlvl`='%s', `pass2`='%f', `dinero`='%d', `dinerobank`='%d', `banco`='%d', `movil`='%d', `dni`='%d'",
query,
PlayerInfo[playerid][adminlvl],
PlayerInfo[playerid][pass2],
PlayerInfo[playerid][dinero],
PlayerInfo[playerid][dinerobank],
PlayerInfo[playerid][banco],
PlayerInfo[playerid][movil],
PlayerInfo[playerid][dni]);
format(query, sizeof query, "%s, `busquedad`='%d', `sexo`='%d', `edad`='%d',`skin`='%d',`origen`='%d',`faccion`='% s', `carcel`='%d', `vida`='%d'",
query,
PlayerInfo[playerid][Busqueda],
PlayerInfo[playerid][sexo],
PlayerInfo[playerid][edad],
PlayerInfo[playerid][skin],
PlayerInfo[playerid][origen],
PlayerInfo[playerid][faccion],
PlayerInfo[playerid][carcel],
PlayerInfo[playerid][vida]);
format(query, sizeof query, "%s WHERE `id`='%d' LIMIT 1", query, ACA_FALTA_ALGO);
mysql_function_query(Conecction, query, true, "OnQueryFinish", "ii", 0, playerid);
return 1;
}
PHP код:
|
Una ID ЪNICA que diferencie a al fila del usuario con todas las demбs
|