15.10.2016, 01:58
(
Последний раз редактировалось Pearson; 15.10.2016 в 03:14.
)
Hello guys !!
I really need this, im opening dayz server in my country and i started working on gm , and its on ini system , ill put here codes and help to make sql.
Please guys i really need this pleaseee (((
I really need this, im opening dayz server in my country and i started working on gm , and its on ini system , ill put here codes and help to make sql.
PHP код:
//==========================================================================
GetBan(playerid);
//==========================================================================
new stringisdedamovtyan[256], password2[64];
format(stringisdedamovtyan, sizeof(stringisdedamovtyan), "/aqauntebi/%s.ini", GetName(playerid)); // Задаём путь к файлу
new iniFile = ini_openFile(stringisdedamovtyan); // Открываем файл.
if(iniFile < 0) ini_openFile(stringisdedamovtyan);
ini_getString(iniFile, "Password", password2); // Узнаём пароль аккаунта.
if(strlen(password2) < strlen(password) || strlen(password2) > strlen(password) || strlen(password) == 0) return ShowPlayerDialog(playerid,dialog_login,DIALOG_STYLE_INPUT,"AVTORIZACIA","Chaweret Tqveni Aqauntis Paroli.","Shesvla","Gasvla");
if(strcmp(password, password2, false)) return ShowPlayerDialog(playerid,dialog_login,DIALOG_STYLE_INPUT,"AVTORIZACIA","Chaweret Tqveni Aqauntis Paroli.","Shesvla","Gasvla");
// если пароль верный то:
Login[playerid] = 1;
ini_getInteger(iniFile, "Kills", Player[playerid][pKillsZ]);
ini_getInteger(iniFile, "HShots", Player[playerid][pHShots]); // Запишем кол-во kills в переменную.
ini_getInteger(iniFile, "Sex", Player[playerid][pSex]);
ini_getFloat(iniFile, "Blood", Player[playerid][pBlood]); // Запишем кол-во жизней в переменную.
ini_getFloat(iniFile, "Armor", Player[playerid][pArmor]);
ini_getFloat(iniFile, "Temperature", Player[playerid][pTemp]);
ini_getInteger(iniFile, "Thirst", Player[playerid][pThirst]);
ini_getInteger(iniFile, "Level", Player[playerid][pLevel]);
ini_getInteger(iniFile, "Gangid", Player[playerid][pGangid]);
ini_getInteger(iniFile, "Leader", Player[playerid][pLeader]);
ini_getInteger(iniFile, "Rank", Player[playerid][pRank]);
ini_getInteger(iniFile, "VIP", Player[playerid][pVIP]);
ini_getInteger(iniFile, "Coin", Player[playerid][pCoin]);
ini_getInteger(iniFile, "CTime", Player[playerid][pCTime]);
ini_getInteger(iniFile, "Hunger", Player[playerid][pHunger]);
ini_getInteger(iniFile, "Pack", Player[playerid][pPack]);
ini_getFloat(iniFile, "PosX", Player[playerid][PosX]);
ini_getFloat(iniFile, "PosY", Player[playerid][PosY]); //при авторизации узнаем координату Y
ini_getFloat(iniFile, "PosZ", Player[playerid][PosZ]); //при авторизации узнаем координату Z
ini_getInteger(iniFile, "Admin", Player[playerid][pAdmin]);
ini_getInteger(iniFile, "Karma", Player[playerid][pKarma]); //
ini_getInteger(iniFile, "STD", Player[playerid][pSTD]); //
ini_getInteger(iniFile, "ConnectTime", Player[playerid][pConnectTime]); // Запишем кол-во убийств в файл.
ini_getInteger(iniFile, "Death", Player[playerid][pDeath]);
ini_getInteger(iniFile, "KillsS", Player[playerid][pKillsS]);
ini_getInteger(iniFile, "Kill_game", Player[playerid][pKill_game]);
ini_getInteger(iniFile, "Loot", Player[playerid][pLoot]);
ini_getInteger(iniFile, "Noga", Player[playerid][pNoga]);
ini_getInteger(iniFile, "Kill_s_g", Player[playerid][pKill_s_g]);
ini_getInteger(iniFile, "Sec", Player[playerid][pSec]);
ini_getInteger(iniFile, "Min", Player[playerid][pMin]);
ini_getInteger(iniFile, "Hour", Player[playerid][pHour]);
ini_getInteger(iniFile, "Skin", Player[playerid][pSkin]);
ini_getInteger(iniFile, "Message", Player[playerid][pMessage]);
ini_getInteger(iniFile, "Slots", Player[playerid][pSlots]);
ini_getInteger(iniFile, "Bad", Player[playerid][pBad]);
ini_getFloat(iniFile, "FA", Player[playerid][pFA]);
for(new i=0;i<INVNUMBERS;i++)
{
new idstr[256];
format(idstr, sizeof(idstr), "id%d", i);
ini_getInteger(iniFile,idstr, PlayerInv[playerid][i]);
}
for(new w=0;w<47;w++)
{
new weaponstr[128],a;
format(weaponstr, sizeof(weaponstr), "weapon%d", w);
ini_getInteger(iniFile,weaponstr, a);
Weap_save[playerid][w] = a;
}
PHP код:
stock CreateAccount(playerid, password[])
{
new stringooooo[128];
format(stringooooo, sizeof(stringooooo), "/aqauntebi/%s.ini", GetName(playerid)); // Добавляем тип файла (.ini).
new iniFile = ini_createFile(stringooooo); // Создаём файл.
if(iniFile < 0) ini_createFile(stringooooo);
ini_openFile(stringooooo); // Если файл выдал ошибку, то мы его откроем заного.
strmid(Player[playerid][pKey], password, 0, strlen(password), 255);
ini_setString(iniFile, "Password", Player[playerid][pKey]); // Запишем пароль в файл.
ini_setInteger(iniFile, "Kills", 0); // Запишем кол-во денег в файл.
ini_setInteger(iniFile, "Sex", 1);
ini_setInteger(iniFile, "Level", 1);
ini_setInteger(iniFile, "Coin", 0);
ini_setInteger(iniFile, "Leader", 0);
ini_setInteger(iniFile, "Gangid", 0);
ini_setInteger(iniFile, "VIP", 0);
ini_setInteger(iniFile, "CTime", 0);
ini_setFloat(iniFile, "Blood", 100.0); // Запишем кол-во жизней в файл.
ini_setFloat(iniFile, "Temperature", 36.6);
ini_setInteger(iniFile, "Hunger", 1350);
ini_setInteger(iniFile, "Thirst", 1050);
ini_setInteger(iniFile, "Pack", 1);
ini_setFloat(iniFile, "PosX", 0.0); //при авторизации узнаем координату X
ini_setFloat(iniFile, "PosY", 0.0); //при авторизации узнаем координату Y
ini_setFloat(iniFile, "PosZ", 0.0); //при авторизации узнаем координату Z
ini_setFloat(iniFile, "FA", 0.0); //при авторизации узнаем угол поворота
ini_closeFile(iniFile); // Закрываем файл.
/*if(CallRemoteFunction("GetAnticheatConnect", "d", playerid) == 1)
{*/
Player[playerid][pPack] = 2;
Player[playerid][pSlots] = 4;//т.к даем 3 вещи
PlayerInv[playerid][31] = 1;
PlayerInv[playerid][1] = 1;
PlayerInv[playerid][44] = 1;
//PlayerInv[playerid][44] = 1;
PlayerInv[playerid][53] = 1;
//}
/*else if(CallRemoteFunction("GetAnticheatConnect", "d", playerid) == 0)
{
Player[playerid][pPack] = 1;
Player[playerid][pSlots] = 3;//т.к даем 3 вещи
PlayerInv[playerid][31] = 1;
PlayerInv[playerid][1] = 1;
PlayerInv[playerid][44] = 1;
}*/
LoadAccount(playerid, Player[playerid][pKey]);
return 1;
}
PHP код:
stock SaveAccount(playerid)
{
if(Login[playerid] == 0) return 1;
new stringistavi[128],Float:fa;
GetPlayerFacingAngle(playerid, fa);
GetPlayerHealth(playerid,Player[playerid][pBlood]);
GetPlayerArmour(playerid,Player[playerid][pArmor]);
if(damage_exit[playerid] > 0 || PlayerSkin[playerid] == true)
{
if(damage_exit[playerid] > 0) VeshiOff(playerid);
if(PlayerSkin[playerid] == true)
{
Player[playerid][PosX] = 0.0;
Player[playerid][PosY] = 0.0;
Player[playerid][PosZ] = 0.0;
}
Player[playerid][pSex] = 1;
Player[playerid][pSkin] = 78;
}
else if(damage_exit[playerid] < 1 && PlayerSkin[playerid] != true) GetPlayerPos(playerid, Player[playerid][PosX], Player[playerid][PosY], Player[playerid][PosZ]);
new skin_save = GetPlayerSkin(playerid);
format(stringistavi, sizeof(stringistavi), "/aqauntebi/%s.ini", GetName(playerid)); // Задаём путь к файлу
new iniFile = ini_openFile(stringistavi); // Открываем файл.
if(iniFile < 0) iniFile = ini_openFile(stringistavi); // Открываем файл.
for(new i=0;i<INVNUMBERS;i++)
{
new idstr[256];
format(idstr, sizeof(idstr), "id%d",i);
ini_setInteger(iniFile,idstr, PlayerInv[playerid][i]);
}
ini_setInteger(iniFile, "Kills", Player[playerid][pKillsZ]);
ini_setInteger(iniFile, "Hunger", Player[playerid][pHunger]);
ini_setInteger(iniFile, "Thirst", Player[playerid][pThirst]);
ini_setInteger(iniFile, "HShots", Player[playerid][pHShots]);
ini_setInteger(iniFile, "Pack", Player[playerid][pPack]);
ini_setInteger(iniFile, "Sex", Player[playerid][pSex]);
ini_setFloat(iniFile, "Blood", Player[playerid][pBlood]);
ini_setFloat(iniFile, "Armor", Player[playerid][pArmor]);
ini_setFloat(iniFile, "Temperature", Player[playerid][pTemp]);
ini_setFloat(iniFile,"PosX", Player[playerid][PosX]);
ini_setFloat(iniFile,"PosY", Player[playerid][PosY]);
ini_setFloat(iniFile,"PosZ", Player[playerid][PosZ]);
ini_setInteger(iniFile, "Admin", Player[playerid][pAdmin]);
ini_setInteger(iniFile, "Karma", Player[playerid][pKarma]);
ini_setInteger(iniFile, "Level", Player[playerid][pLevel]);
ini_setInteger(iniFile, "Gangid", Player[playerid][pGangid]);
ini_setInteger(iniFile, "Leader", Player[playerid][pLeader]);
ini_setInteger(iniFile, "Rank", Player[playerid][pRank]);
ini_setInteger(iniFile, "VIP", Player[playerid][pVIP]);
ini_setInteger(iniFile, "CTime", Player[playerid][pCTime]);
ini_setInteger(iniFile, "Coin", Player[playerid][pCoin]);
ini_setInteger(iniFile, "STD", Player[playerid][pSTD]);
ini_setInteger(iniFile, "ConnectTime", Player[playerid][pConnectTime]);
ini_setInteger(iniFile, "Death", Player[playerid][pDeath]);
ini_setInteger(iniFile, "KillsS", Player[playerid][pKillsS]);
ini_setInteger(iniFile, "Kill_game", Player[playerid][pKill_game]);
ini_setInteger(iniFile, "Loot", Player[playerid][pLoot]);
ini_setInteger(iniFile, "Noga", Player[playerid][pNoga]);
ini_setInteger(iniFile, "Kill_s_g", Player[playerid][pKill_s_g]);
ini_setInteger(iniFile, "Sec", Player[playerid][pSec]);
ini_setInteger(iniFile, "Min", Player[playerid][pMin]);
ini_setInteger(iniFile, "Hour", Player[playerid][pHour]);
ini_setInteger(iniFile, "Skin", skin_save);
ini_setInteger(iniFile, "Message", Player[playerid][pMessage]);
ini_setInteger(iniFile, "Slots", Player[playerid][pSlots]);
ini_setInteger(iniFile, "Bad", Player[playerid][pBad]);
ini_setFloat(iniFile,"FA", fa);
for(new f = 0; f < 47; f ++)//weap_save
{
new weaponstr[128];
format(weaponstr, sizeof(weaponstr), "weapon%d",f);
ini_setInteger(iniFile,weaponstr, 0);
}
for(new s = 0; s < 13; s ++)//weap_save
{
new w,a;
new weaponstr[128];
GetPlayerWeaponData(playerid,s,w,a);
if(w > 0)
{
format(weaponstr, sizeof(weaponstr), "weapon%d",w);
ini_setInteger(iniFile,weaponstr, a);
}
//printf( "slot %d weapon %d ammp %d", s,w,a);
}
ini_closeFile(iniFile); // Закрываем файл.
return 1;
}