Hangover
Дебютант
Доброе время суток!
Уважаемые коллеги, столкнулся с проблемой в сохранении скиллов на оружие. Пробовал исправить сам но без полезно -_-
Объясняю всю суть проблемы, я захожу на свой сервер прописываю /setskill id, выдаю себе скиллы 100% на все ввиды оружия.
После рестарта сервера, скиллы не сохраняются! И они я заметил просто не вносятся в аккаунт.
Уважаемые коллеги, столкнулся с проблемой в сохранении скиллов на оружие. Пробовал исправить сам но без полезно -_-
Объясняю всю суть проблемы, я захожу на свой сервер прописываю /setskill id, выдаю себе скиллы 100% на все ввиды оружия.
После рестарта сервера, скиллы не сохраняются! И они я заметил просто не вносятся в аккаунт.
PHP:
pGunSkill[6]
PHP:
pTemp[playerid][pGunSkill][0] = pData[playerid][pSkill1];
pTemp[playerid][pGunSkill][1] = pData[playerid][pSkill2];
pTemp[playerid][pGunSkill][2] = pData[playerid][pSkill3];
pTemp[playerid][pGunSkill][3] = pData[playerid][pSkill4];
pTemp[playerid][pGunSkill][4] = pData[playerid][pSkill5];
pTemp[playerid][pGunSkill][5] = pData[playerid][pSkill6];
PHP:
if(!pTemp[playerid][pLogined] || !pTemp[playerid][pJoined]) return 1;
if(strlen(gunids) && strlen(ammos)) format(pgun,sizeof(pgun),"%s:%s",gunids,ammos);
new query[532];
pData[playerid][pSkill1] = pTemp[playerid][pGunSkill][0];
pData[playerid][pSkill2] = pTemp[playerid][pGunSkill][1];
pData[playerid][pSkill3] = pTemp[playerid][pGunSkill][2];
pData[playerid][pSkill4] = pTemp[playerid][pGunSkill][3];
pData[playerid][pSkill5] = pTemp[playerid][pGunSkill][4];
pData[playerid][pSkill6] = pTemp[playerid][pGunSkill][5];
format(query,sizeof(query),"UPDATE `accounts` SET `skill1`='%s', `skill2`='%s', `skill3`='%s', `skill4`='%s', `skill5`='%s', `skill6`='%s',`health` = '%.2f',`money` = %d,`jail`='%d',`gun`='%s',`otigral`='%d',`status`='0' WHERE `nickname`='%s'"
,pData[playerid][pSkill1],pData[playerid][pSkill2],pData[playerid][pSkill3],pData[playerid][pSkill4],pData[playerid][pSkill5],pData[playerid][pSkill6]
,pData[playerid][pHealth],pData[playerid][pMoney],pData[playerid][pJail],pgun,pTemp[playerid][pGiveExp],pData[playerid][pNickname]);
sql_query(zConn, query, QUERY_THREADED);
SetPlayerDataToDefault(playerid);
return 1;
}
PHP:
stock OnPlayerAmmoChange(playerid, newammo, oldammo)
{
if(newammo < oldammo)
{
switch(GetPlayerWeapon(playerid))
{
case 24:
{
SetPVarInt(playerid, "SkillD",GetPVarInt(playerid, "SkillD") +2);
if(GetPVarInt(playerid, "SkillD") >= Ammo_DEAGLE && pTemp[playerid][pGunSkill][1] < 100)
{
pTemp[playerid][pGunSkill][1]++;
SetPVarInt(playerid, "SkillD",0);
}
}
case 23:
{
SetPVarInt(playerid, "SkillSD",GetPVarInt(playerid, "SkillSD") +2);
if(GetPVarInt(playerid, "SkillSD")>= Ammo_SDPISTOL && pTemp[playerid][pGunSkill][0] < 100)
{
pTemp[playerid][pGunSkill][0]++;
SetPVarInt(playerid, "SkillSD",0);
}
}
case 25:
{
SetPVarInt(playerid, "SkillShot",GetPVarInt(playerid, "SkillShot") +2);
if(GetPVarInt(playerid, "SkillShot") >= Ammo_SHOTGUN && pTemp[playerid][pGunSkill][2] < 100)
{
pTemp[playerid][pGunSkill][2]++;
SetPVarInt(playerid, "SkillShot",0);
}
}
case 29:
{
SetPVarInt(playerid, "SkillMP5",GetPVarInt(playerid, "SkillMP5") +2);
if(GetPVarInt(playerid, "SkillMP5") >= Ammo_MP5 && pTemp[playerid][pGunSkill][3] < 100)
{
pTemp[playerid][pGunSkill][3]++;
SetPVarInt(playerid, "SkillMP5",0);
}
}
case 30:
{
SetPVarInt(playerid, "SkillAk47",GetPVarInt(playerid, "SkillAk47") +2);
if(GetPVarInt(playerid, "SkillAk47") >= Ammo_AK47 && pTemp[playerid][pGunSkill][4] < 100)
{
pTemp[playerid][pGunSkill][4]++;
SetPVarInt(playerid, "SkillAk47",0);
}
}
case 31:
{
SetPVarInt(playerid, "SkillM4",GetPVarInt(playerid, "SkillM4") +2);
if(GetPVarInt(playerid, "SkillM4") >= Ammo_M4A1 && pTemp[playerid][pGunSkill][5] < 100)
{
pTemp[playerid][pGunSkill][5]++;
SetPVarInt(playerid, "SkillM4",0);
}
}
}
}
return 1;
}
stock WeaponSkill(playerid)
{
SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL_SILENCED, pTemp[playerid][pGunSkill][0]);
SetPlayerSkillLevel(playerid, WEAPONSKILL_DESERT_EAGLE, pTemp[playerid][pGunSkill][1]);
SetPlayerSkillLevel(playerid, WEAPONSKILL_SHOTGUN, pTemp[playerid][pGunSkill][2]);
SetPlayerSkillLevel(playerid, WEAPONSKILL_MP5, pTemp[playerid][pGunSkill][3]);
SetPlayerSkillLevel(playerid, WEAPONSKILL_AK47, pTemp[playerid][pGunSkill][4]);
SetPlayerSkillLevel(playerid, WEAPONSKILL_M4, pTemp[playerid][pGunSkill][5]);
return true;
}
stock UpdateWeaponSkill(playerid)
{
SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL_SILENCED, pTemp[playerid][pGunSkill][0]*10);
SetPlayerSkillLevel(playerid, WEAPONSKILL_DESERT_EAGLE, pTemp[playerid][pGunSkill][1]*10);
SetPlayerSkillLevel(playerid, WEAPONSKILL_SHOTGUN, pTemp[playerid][pGunSkill][2]*10);
SetPlayerSkillLevel(playerid, WEAPONSKILL_MP5, pTemp[playerid][pGunSkill][3]*10);
SetPlayerSkillLevel(playerid, WEAPONSKILL_AK47, pTemp[playerid][pGunSkill][4]*10);
SetPlayerSkillLevel(playerid, WEAPONSKILL_M4, pTemp[playerid][pGunSkill][5]*10);
return true;
}
stock GetPlayerID(Name[])
{
foreach(new i:Player) {
if(!strcmp(Name, pData[i][pNickname])) return i;
}
return -1;
}
stock SetPlayerSkills(playerid)
{
SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL_SILENCED, pTemp[playerid][pGunSkill][0]*10);
SetPlayerSkillLevel(playerid, WEAPONSKILL_DESERT_EAGLE, pTemp[playerid][pGunSkill][1]*10);
SetPlayerSkillLevel(playerid, WEAPONSKILL_SHOTGUN, pTemp[playerid][pGunSkill][2]*10);
SetPlayerSkillLevel(playerid, WEAPONSKILL_MP5, pTemp[playerid][pGunSkill][3]*10);
SetPlayerSkillLevel(playerid, WEAPONSKILL_AK47, pTemp[playerid][pGunSkill][4]*10);
SetPlayerSkillLevel(playerid, WEAPONSKILL_M4, pTemp[playerid][pGunSkill][5]*10);
return true;
}
PHP:
pSkill1,
pSkill2,
pSkill3,
pSkill4,
pSkill5,
pSkill6,
PHP:
stock LoadPlayerData(playerid)
{
new query[456]; format(query, 126, "SELECT * FROM `accounts` WHERE nickname = '%s'",pData[playerid][pNickname]);
new Result:pldata = sql_query(zConn, query, QUERY_CACHED);
if(sql_num_rows(pldata)) {
pData[playerid][pMysqlID] = sql_get_field_assoc_int_ex(pldata, 0, "id");
sql_get_field_assoc_ex(pldata, 0, "nickname", pData[playerid][pNickname]);
sql_get_field_assoc_ex(pldata, 0, "ip", pData[playerid][pRegIP]);
pData[playerid][pMarried] = sql_get_field_assoc_int_ex(pldata, 0, "married");
sql_get_field_assoc_ex(pldata, 0, "divorce", pData[playerid][pDivorce]);
pData[playerid][pWarn] = sql_get_field_assoc_int_ex(pldata, 0, "warn");
pData[playerid][pWarnc] = sql_get_field_assoc_int_ex(pldata, 0, "warnc");
pData[playerid][pMut] = sql_get_field_assoc_int_ex(pldata, 0, "mut");
pData[playerid][pEConfirmed] = sql_get_field_assoc_int_ex(pldata, 0, "econfirmed");
pData[playerid][pSex] = sql_get_field_assoc_int_ex(pldata, 0, "sex");
pTemp[playerid][pGiveExp] = sql_get_field_assoc_int_ex(pldata, 0, "otigral");
pData[playerid][pColor] = sql_get_field_assoc_int_ex(pldata, 0, "color");
pData[playerid][pAge] = sql_get_field_assoc_int_ex(pldata, 0, "age");
pData[playerid][pNation] = sql_get_field_assoc_int_ex(pldata, 0, "nation");
pData[playerid][pSkin] = sql_get_field_assoc_int_ex(pldata, 0, "skin");
pData[playerid][pFractionSkin] = sql_get_field_assoc_int_ex(pldata, 0, "fractionskin");
pData[playerid][pHealth] = sql_get_field_assoc_float_ex(pldata, 0, "health");
pData[playerid][pHouse] = sql_get_field_assoc_int_ex(pldata, 0, "house");
pData[playerid][pHotel] = sql_get_field_assoc_int_ex(pldata, 0, "hotel");
pData[playerid][pHotelRoom] = sql_get_field_assoc_int_ex(pldata, 0, "hotelroom");
pData[playerid][pCar] = sql_get_field_assoc_int_ex(pldata, 0, "car");
pData[playerid][pJob] = sql_get_field_assoc_int_ex(pldata, 0, "job");
pData[playerid][pSalary] = sql_get_field_assoc_int_ex(pldata, 0, "salary");
pData[playerid][pMoney] = sql_get_field_assoc_int_ex(pldata, 0, "money");
pData[playerid][pBank] = sql_get_field_assoc_int_ex(pldata, 0, "bank");
pData[playerid][pBusSkill] = sql_get_field_assoc_int_ex(pldata, 0, "busskill");
pData[playerid][pTruckSkill] = sql_get_field_assoc_int_ex(pldata, 0, "truckskill");
pData[playerid][pLevel] = sql_get_field_assoc_int_ex(pldata, 0, "level");
pData[playerid][pExp] = sql_get_field_assoc_int_ex(pldata, 0, "exp");
pData[playerid][pPhone] = sql_get_field_assoc_int_ex(pldata, 0, "phone");
pData[playerid][pPhoneMoney] = sql_get_field_assoc_int_ex(pldata, 0, "phonemoney");
pData[playerid][pWanted] = sql_get_field_assoc_int_ex(pldata, 0, "wanted");
pData[playerid][pJail] = sql_get_field_assoc_int_ex(pldata, 0, "jail");
pData[playerid][pDrugs] = sql_get_field_assoc_int_ex(pldata, 0, "drugs");
pData[playerid][pRadio] = sql_get_field_assoc_int_ex(pldata, 0, "radio");
pData[playerid][pSpawn] = sql_get_field_assoc_int_ex(pldata, 0, "spawn");
pData[playerid][pAmmo] = sql_get_field_assoc_int_ex(pldata, 0, "ammo");
pData[playerid][pGunAmount] = sql_get_field_assoc_int_ex(pldata, 0, "gunamount");
pData[playerid][pFraction] = sql_get_field_assoc_int_ex(pldata, 0, "fraction");
pData[playerid][pSubfraction] = sql_get_field_assoc_int_ex(pldata, 0, "subfraction");
pData[playerid][pRank] = sql_get_field_assoc_int_ex(pldata, 0, "rank");
pData[playerid][pBusiness] = sql_get_field_assoc_int_ex(pldata, 0, "bussiness");
pData[playerid][pWatch] = sql_get_field_assoc_int_ex(pldata, 0, "watch");
pData[playerid][pCode] = sql_get_field_assoc_int_ex(pldata, 0, "code");
pData[playerid][pRequestCode] = sql_get_field_assoc_int_ex(pldata, 0, "requestcode");
sql_get_field_assoc_ex(pldata, 0, "language", pData[playerid][pLanguage]);
pData[playerid][pAdmin] = sql_get_field_assoc_int_ex(pldata, 0, "admin");
pData[playerid][pLicenses][LIC_DRIVING] = sql_get_field_assoc_int_ex(pldata, 0, "licDrive");
pData[playerid][pLicenses][LIC_FLY] = sql_get_field_assoc_int_ex(pldata, 0, "licFly");
pData[playerid][pLicenses][LIC_BOAT] = sql_get_field_assoc_int_ex(pldata, 0, "licBoat");
pData[playerid][pLicenses][LIC_WEAP] = sql_get_field_assoc_int_ex(pldata, 0, "licWeap");
pData[playerid][pLicenses][LIC_BISS] = sql_get_field_assoc_int_ex(pldata, 0, "licBiss");
pData[playerid][pSettings] = sql_get_field_assoc_int_ex(pldata, 0, "settings");
pData[playerid][pSett] = sql_get_field_assoc_int_ex(pldata, 0, "settings");
pData[playerid][pUnemployment] = sql_get_field_assoc_int_ex(pldata, 0, "unemployment");
pData[playerid][pVehicleKey] = sql_get_field_assoc_int_ex(pldata, 0, "vehiclekey");
pData[playerid][pTime] = sql_get_field_assoc_int_ex(pldata, 0, "time");
pData[playerid][pArmyTime] = sql_get_field_assoc_int_ex(pldata, 0, "armytime");
pData[playerid][pArmyRank] = sql_get_field_assoc_int_ex(pldata, 0, "armyrank");
pData[playerid][pBankNomer] = sql_get_field_assoc_int_ex(pldata, 0, "banknomer");
sql_get_field_assoc_ex(pldata, 0, "bankpink", pData[playerid][pBankPin]);
pData[playerid][pBank1] = sql_get_field_assoc_int_ex(pldata, 0, "bank1");
pData[playerid][pDrunk] = sql_get_field_assoc_int_ex(pldata, 0, "drunk");
pData[playerid][pZakon] = sql_get_field_assoc_int_ex(pldata, 0, "zakon");
pData[playerid][pBomb] = sql_get_field_assoc_int_ex(pldata, 0, "bomb");
pData[playerid][pObjectGlasses] = sql_get_field_assoc_int_ex(pldata, 0, "objectglasses");
pData[playerid][pObjectHouse] = sql_get_field_assoc_int_ex(pldata, 0, "objecthouse");
pData[playerid][pObjectHat] = sql_get_field_assoc_int_ex(pldata, 0, "ObjectHat");
pData[playerid][pSkill1] = sql_get_field_assoc_int_ex(pldata, 0, "skill1");
pData[playerid][pSkill2] = sql_get_field_assoc_int_ex(pldata, 0, "skill2");
pData[playerid][pSkill3] = sql_get_field_assoc_int_ex(pldata, 0, "skill3");
pData[playerid][pSkill4] = sql_get_field_assoc_int_ex(pldata, 0, "skill4");
pData[playerid][pSkill5] = sql_get_field_assoc_int_ex(pldata, 0, "skill5");
pData[playerid][pSkill6] = sql_get_field_assoc_int_ex(pldata, 0, "skill6");
sql_get_field_assoc_ex(pldata, 0, "gun", query);
SetPVarString(playerid,"mysqlgun",query);
sql_free_result(pldata);
format(query, sizeof(query), "[Àâòîðèçàöèÿ]: Âàø àêêàóíò çàãðóæåí.");
SendClientMessage(playerid, COLOR_GREY, query);
SetPlayerSkills(playerid);
pTemp[playerid][pLogin4] = false;
UpdatePlayerData(playerid,"status",1);
