PDA

Просмотр полной версии : [Вопрос] Выдача pLevel и pExp при регестрации



Albert
29.12.2014, 17:37
stock CreateAccount(playerid, password[])
{
new account[37];
format(account,sizeof(account),"users/%s.ini",pNick(playerid));
if(fexist(account)) return ShowPlayerDialog(playerid,1,DIALOG_STYLE_INPUT, "Àâòîðèçàöèÿ", "Äàííûé àêêàóíò çàðåãèñòðèðîâàí. Ââåäèòå ïàðîëü:", "Äàëåå", "Âûõîä");
new iniFile = ini_createFile(account);
if(iniFile < 0) ini_openFile (account);
{
ini_setString(iniFile,"Ïàðîëü",password);//Î "ini_setString" è "ini_setInteger" íàïèñàíî â òåìå, êîòîðàÿ îïèñûâàåò èíêëóä mxINI (âûøå ññûëêà)
ini_setInteger(iniFile, "Äåíüãè", 15);
ini_setInteger(iniFile,"Level",pInfo[playerid][pLevel]);
ini_setInteger(iniFile,"Exp",pInfo[playerid][pExp]);
ini_closeFile(iniFile);
OnPlayerLogin(playerid);
}
return 1;
}
stock OnPlayerLogin(playerid)
{
new account[37];
format(account,sizeof(account),"users/%s.ini",pNick(playerid));
new iniFile = ini_openFile(account);
ini_getString (iniFile,"Ïàðîëü", pInfo[playerid][pPassword],64);
ini_getInteger(iniFile,"Äåíüãè", pInfo[playerid][pMoney]);
ini_getInteger(iniFile,"Level",pInfo[playerid][pLevel]);
ini_getInteger(iniFile,"Exp",pInfo[playerid][pExp]);
ini_closeFile(iniFile);
ResetPlayerMoney(playerid);
GivePlayerMoney(playerid, pInfo[playerid][pMoney]);
pInfo[playerid][pLogged]=true;
//SpawnPlayer(playerid);
return 1;
}
stock SavePlayer(playerid)
{
new account[37];
format(account,sizeof(account),"users/%s.ini",pNick(playerid));
new iniFile = ini_openFile(account);
ini_setString(iniFile, "Ïàðîëü", pInfo[playerid][pPassword]);
ini_setInteger(iniFile, "Äåíüãè", pInfo[playerid][pMoney]);
ini_setInteger(iniFile,"Level",pInfo[playerid][pLevel]);
ini_setInteger(iniFile,"Exp",pInfo[playerid][pExp]);
ini_closeFile(iniFile);
return 1;
}

Как сделать чтобы на месте Score показывался pLevel? И как сделать чтобы при регистрации pLevel ровнялся не 0, а 1?

Osetin
29.12.2014, 18:11
Когда копируете текст меняйте раскладку на русский язык.

wAx
29.12.2014, 18:41
ini_setInteger(iniFile,"Level",pInfo[playerid][pLevel]);
Перед этой строчкой добавь

pInfo[playerid][pLevel] = 1

При OnPlayerSpawn

SetPlayerScore(playerid, pInfo[playerid][pLevel]);

L0ndl3m
29.12.2014, 23:36
ini_setInteger(iniFile,"Level",pInfo[playerid][pLevel]);
Перед этой строчкой добавь

pInfo[playerid][pLevel] = 1

А точка с запятой где? :scratch_one-s_head: