PHP код:
LoadData(playerid)
{
new DBResult: query, szQuery[200], szPlayerName[MAX_PLAYER_NAME];
GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);
new Field[20], x[20], y[20], z[20], a[20];
format(szQuery, sizeof(szQuery), "SELECT * from players WHERE NAME = '%s'", DB_Escape(szPlayerName));
query = db_query(someDB, szQuery);
if(db_num_rows(query))
{
db_get_field_assoc(query, "CASH", Field, 30);
GivePlayerMoney(playerid, strval(Field));
//---
db_get_field_assoc(query, "ADMINLEVEL", Field, 30);
pData[playerid][pAdminLevel] = strval(Field);
//---
db_get_field_assoc(query, "LEVEL", Field, 30);
SetPlayerScore(playerid, strval(Field));
//---
db_get_field_assoc(query, "GENDER", Field, 30);
pData[playerid][pGender] = strval(Field);
//---
db_get_field_assoc(query, "AGE", Field, 30);
pData[playerid][pAge] = strval(Field);
//---
db_get_field_assoc(query, "SKIN", Field, 30);
SetPlayerSkin(playerid, strval(Field));
new skin = strval(Field);
//---
db_get_field_assoc(query, "GUN1", Field, 30);
GivePlayerWeapon(playerid, strval(Field), pData[playerid][pAmmo1]);
//---
db_get_field_assoc(query, "GUN2", Field, 30);
GivePlayerWeapon(playerid, strval(Field), pData[playerid][pAmmo2]);
//---
db_get_field_assoc(query, "GUN3", Field, 30);
GivePlayerWeapon(playerid, strval(Field), pData[playerid][pAmmo3]);
//---
db_get_field_assoc(query, "AMMO1", Field, 30);
SetPlayerAmmo(playerid, pData[playerid][pGun1], strval(Field));
//---
db_get_field_assoc(query, "AMMO2", Field, 30);
SetPlayerAmmo(playerid, pData[playerid][pGun2], strval(Field));
//---
db_get_field_assoc(query, "AMMO3", Field, 30);
SetPlayerAmmo(playerid, pData[playerid][pGun3], strval(Field));
//---
db_get_field_assoc(query, "POS_X", x, 30);
db_get_field_assoc(query, "POS_Y", y, 30);
db_get_field_assoc(query, "POS_Z", z, 30);
db_get_field_assoc(query, "POS_A", a, 30);
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(playerid, 0, skin, pData[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(playerid, COLOR_RED, "ERROR(001): Couldn't Load Your DatBase");
}
return 1;
}