16.11.2014, 23:31
Hello Guys, after seeking around big time i couldnt solve that problem , it's not error it's not bug but it's something like MYSQL doesn't doing his JOB
After The Player Store's his weapons In House , it Stores the First Slot and if he want to store an other weapon he can in too and it saves in mysql DB.. BUt ! BUT ! when im re-booting the server , The Save(data) still in the DB , and if player goes to his house and doing
he will find ONLY FIrst Slot with the first gun he store's it , second one gone!! , but he is still in DB .. i can see the Id weapon and ammo in DB , in server i cannot , it doesnt load all the stored Guns from the Database .
i hope from you guys helping me with this ..
After The Player Store's his weapons In House , it Stores the First Slot and if he want to store an other weapon he can in too and it saves in mysql DB.. BUt ! BUT ! when im re-booting the server , The Save(data) still in the DB , and if player goes to his house and doing
PHP код:
/checksafe
i hope from you guys helping me with this ..
PHP код:
YCMD:storeweapon(playerid, params[], help)
{
if(help) return SCM(playerid, COLOR_GREY, "Not supported");
if(IsPlayerConnected(playerid))
{
new string[256], ammo, house = PlayerInfo[playerid][pPhousekey];
new gunname[24];
if(IsPlayerInRangeOfPoint(playerid, 15, HouseInfo[house][hExitx],HouseInfo[house][hExity],HouseInfo[house][hExitz]))
{
if(sscanf(params, "d", ammo))
{
SCM(playerid, COLOR_GRAD1, "USAGE: /storeweapon [ammo]");
return 1;
}
if(ammo > GetPlayerAmmo(playerid))
{
SCM(playerid, COLOR_GREY, " You don't have so many Ammo.");
return 1;
}
new weapon = GetPlayerWeapon(playerid);
GetWeaponName(weapon,gunname, sizeof(gunname));
if(weapon != 0)
{
if(HouseInfo[house][hWeapon][0] == 0)
{
if(HouseInfo[house][hAmmo][0] >= 25000) return SCM(playerid, COLOR_GREY,"* You cannot exceed the 25000 Limit.");
SafeGivePlayerWeapon(playerid, weapon, -ammo);
HouseInfo[house][hWeapon][0] = weapon;
HouseInfo[house][hAmmo][0] = ammo;
if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), "* %s takes out his %s and places it at his safe.", GetPlayerNameEx(playerid),gunname); }
else { format(string, sizeof(string), "* %s takes out her %s and places it at her safe.", GetPlayerNameEx(playerid),gunname); }
ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
}
else if(HouseInfo[house][hWeapon][0] == weapon)
{
if(HouseInfo[house][hAmmo][0] >= 25000) return SCM(playerid, COLOR_GREY,"* You cannot exceed the 25000 Limit.");
SafeGivePlayerWeapon(playerid, weapon, -ammo);
HouseInfo[house][hAmmo][0] += ammo;
if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), "* %s takes out his %s and places it at his safe.", GetPlayerNameEx(playerid),gunname); }
else { format(string, sizeof(string), "* %s takes out her %s and places it at her safe.", GetPlayerNameEx(playerid),gunname); }
ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
}
else if(HouseInfo[house][hWeapon][0] != 0 && HouseInfo[house][hWeapon][1] == 0)
{
if(HouseInfo[house][hAmmo][1] >= 25000) return SCM(playerid, COLOR_GREY,"* You cannot exceed the 25000 Limit.");
SafeGivePlayerWeapon(playerid, weapon, -ammo);
HouseInfo[house][hWeapon][1] = weapon;
HouseInfo[house][hAmmo][1] = ammo;
if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), "* %s takes out his %s and places it at his safe.", GetPlayerNameEx(playerid),gunname); }
else { format(string, sizeof(string), "* %s takes out her %s and places it at her safe.", GetPlayerNameEx(playerid),gunname); }
ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
}
else if(HouseInfo[house][hWeapon][1] == weapon)
{
if(HouseInfo[house][hAmmo][1] >= 25000) return SCM(playerid, COLOR_GREY,"* You cannot exceed the 25000 Limit.");
SafeGivePlayerWeapon(playerid, weapon, -ammo);
HouseInfo[house][hAmmo][1] += ammo;
if(PlayerInfo[playerid][pSex] == 1) { format(string, sizeof(string), "* %s takes out his %s and places it at his safe.", GetPlayerNameEx(playerid),gunname); }
else { format(string, sizeof(string), "* %s takes out her %s and places it at her safe.", GetPlayerNameEx(playerid),gunname); }
ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
}
else
{
SCM(playerid, COLOR_GREY,"* This slot is taken by another weapon!");
return 1;
}
OnPropUpdate(1, house);
}
else
{
SCM(playerid, COLOR_GREY,"* This slot is taken by another weapon!");
SCM(playerid, COLOR_GREY,"* Either deposit more ammo of the same weapon or load it up!");
return 1;
}
}
else
{
SCM(playerid, COLOR_GREY,"* You're not on your House!");
return 1;
}
}
return 1;
}
PHP код:
YCMD:checksafe(playerid, params[], help)
{
if(help) return SCM(playerid, COLOR_GREY, "Not supported");
if(IsPlayerConnected(playerid))
{
new house = PlayerInfo[playerid][pPhousekey];
new gunname[24];
new gunname1[24];
new gunname2[24];
new gunname3[24];
new gunname4[24];
new gunname5[24];
new string[256];
GetWeaponName(HouseInfo[house][hWeapon][0],gunname, sizeof(gunname));
GetWeaponName(HouseInfo[house][hWeapon][1],gunname1, sizeof(gunname1));
GetWeaponName(HouseInfo[house][hWeapon][2],gunname2, sizeof(gunname2));
GetWeaponName(HouseInfo[house][hWeapon][3],gunname3, sizeof(gunname3));
GetWeaponName(HouseInfo[house][hWeapon][4],gunname4, sizeof(gunname4));
GetWeaponName(HouseInfo[house][hWeapon][5],gunname5, sizeof(gunname5));
if(IsPlayerInRangeOfPoint(playerid, 15, HouseInfo[house][hExitx],HouseInfo[house][hExity],HouseInfo[house][hExitz]))
{
format(string, sizeof(string),"-HOUSE STORAGE- You have %d Drugs and %d Materials.",HouseInfo[house][hDrugs],HouseInfo[house][hMaterials]);
SCM(playerid, COLOR_GREY,string);
format(string, sizeof(string),"-HOUSE STORAGE- Weapon 0 - %s Ammo: %d.",gunname,HouseInfo[house][hAmmo][0]);
SCM(playerid, COLOR_GREY,string);
format(string, sizeof(string),"-HOUSE STORAGE- Weapon 1 - %s Ammo: %d.",gunname1,HouseInfo[house][hAmmo][1]);
SCM(playerid, COLOR_GREY,string);
format(string, sizeof(string),"-HOUSE STORAGE- Weapon 2 - %s Ammo: %d.",gunname2,HouseInfo[house][hAmmo][2]);
SCM(playerid, COLOR_GREY,string);
format(string, sizeof(string),"-HOUSE STORAGE- Weapon 3 - %s Ammo: %d.",gunname3,HouseInfo[house][hAmmo][3]);
SCM(playerid, COLOR_GREY,string);
format(string, sizeof(string),"-HOUSE STORAGE- Weapon 5 - %s Ammo: %d.",gunname4,HouseInfo[house][hAmmo][4]);
SCM(playerid, COLOR_GREY,string);
format(string, sizeof(string),"-HOUSE STORAGE- Weapon 5 - %s Ammo: %d.",gunname5,HouseInfo[house][hAmmo][5]);
SCM(playerid, COLOR_GREY,string);
}
else
{
SCM(playerid, COLOR_GRAD1, " You are not Logged in!");
return 1;
}
}
return 1;
}
PHP код:
stock LoadProperty()
{
print("[SCRIPT]: Loading MySQL Properties");
inline SQLLoadProperty() {
new
rows,
cols,
currentRow,
idx,
previousId,
tmp,
fx = 0,
loadedWeapons = 0;
cache_get_data(rows, cols, dbhandle);
if(!rows) return printf("[SCRIPT]: The SQL Houses loading query returned 0 results");
for(currentRow = 0; currentRow != rows; ++currentRow, fx = 0, loadedWeapons = 0) {
tmp = cache_get_row_int(currentRow, fx++, dbhandle);
//Property weapons in joined query
if(previousId == tmp) {
if(MAX_PROPERTY_WEAPONS != loadedWeapons) {
HouseInfo[idx][hWeapon][loadedWeapons] = cache_get_field_content_int(currentRow, "pw_weapon", dbhandle);
HouseInfo[idx][hAmmo][loadedWeapons] = cache_get_field_content_int(currentRow, "pw_ammo", dbhandle);
++loadedWeapons;
}
continue;
} else previousId = tmp;
HouseInfo[idx][hdbID] = tmp;
HouseInfo[idx][hEntrancex] = cache_get_row_float(currentRow, fx++, dbhandle);
HouseInfo[idx][hEntrancey] = cache_get_row_float(currentRow, fx++, dbhandle);
HouseInfo[idx][hEntrancez] = cache_get_row_float(currentRow, fx++, dbhandle);
HouseInfo[idx][hExitx] = cache_get_row_float(currentRow, fx++, dbhandle);
HouseInfo[idx][hExity] = cache_get_row_float(currentRow, fx++, dbhandle);
HouseInfo[idx][hExitz] = cache_get_row_float(currentRow, fx++, dbhandle);
HouseInfo[idx][hHealthx] = cache_get_row_int(currentRow, fx++, dbhandle);
HouseInfo[idx][hHealthy] = cache_get_row_int(currentRow, fx++, dbhandle);
HouseInfo[idx][hHealthz] = cache_get_row_int(currentRow, fx++, dbhandle);
HouseInfo[idx][hArmourx] = cache_get_row_int(currentRow, fx++, dbhandle);
HouseInfo[idx][hArmoury] = cache_get_row_int(currentRow, fx++, dbhandle);
HouseInfo[idx][hArmourz] = cache_get_row_int(currentRow, fx++, dbhandle);
cache_get_row(currentRow, fx++, HouseInfo[idx][hOwner], dbhandle, 255);
cache_get_row(currentRow, fx++, HouseInfo[idx][hDiscription], dbhandle, 255);
HouseInfo[idx][hValue] = cache_get_row_int(currentRow, fx++, dbhandle);
HouseInfo[idx][hHel] = cache_get_row_int(currentRow, fx++, dbhandle);
HouseInfo[idx][hArm] = cache_get_row_int(currentRow, fx++, dbhandle);
HouseInfo[idx][hInt] = cache_get_row_int(currentRow, fx++, dbhandle);
HouseInfo[idx][hLock] = cache_get_row_int(currentRow, fx++, dbhandle);
HouseInfo[idx][hOwned] = cache_get_row_int(currentRow, fx++, dbhandle);
HouseInfo[idx][hRooms] = cache_get_row_int(currentRow, fx++, dbhandle);
HouseInfo[idx][hRentabil] = cache_get_row_int(currentRow, fx++, dbhandle);
HouseInfo[idx][hRent] = cache_get_row_int(currentRow, fx++, dbhandle);
HouseInfo[idx][hTakings] = cache_get_row_int(currentRow, fx++, dbhandle);
HouseInfo[idx][hLevel] = cache_get_row_int(currentRow, fx++, dbhandle);
HouseInfo[idx][hWorld] = cache_get_row_int(currentRow, fx++, dbhandle);
HouseInfo[idx][hSetted] = 1;
HouseInfo[idx][hDrugs] = cache_get_row_int(currentRow, fx++, dbhandle);
HouseInfo[idx][hMaterials] = cache_get_row_int(currentRow, fx++, dbhandle);
cache_get_row(currentRow, fx++, HouseInfo[idx][hMessage], dbhandle, 255);
OnHousePickupUpdate(idx);
OnPropTextdrawUpdate(1, idx);
Iter_Add(HouseInfo, idx);
++idx;
if(idx == MAX_LOADED_PROPERTIES) {
printf("[SCRIPT]: Notice - there's more properties in database than script can handle. Tweak your MAX_LOADED_PROPERTIES settings");
break;
}
}
printf("[SCRIPT]: Loaded MySQL Houses (%d)", idx);
return 1;
}
mysql_tquery_inline(dbhandle, "SELECT p.*, pw.weapon AS pw_weapon, pw.ammo AS pw_ammo FROM properties p LEFT JOIN property_weapons pw ON pw.pid = p.id ORDER BY p.id ASC, pw.id ASC", using inline SQLLoadProperty, "");
return 1;
}