06.01.2013, 15:15
Queria que alguйm convertesse este cуdigo para SII/y_ini, como jб diz o tнtulo. Desde jб obrigado.
#EDIT: Nгo sou muito bom com SII/y_ini, por isso estб em dini e por isso estou pedindo para alguйm me ajudar!
pawn Код:
stock GivePlayerExp(playerid, exp, reason[])
{
new pfile[100], pname[MAX_PLAYER_NAME], string2[126], string3[126], string4[126];
GetPlayerName(playerid, pname, sizeof(pname));
format(pfile, sizeof(pfile), "HAccounts/%s.ini",pname);
dini_IntSet(pfile, "Experiencia", dini_Int(pfile, "Experiencia") +exp);
if (dini_Int(pfile, "Experiencia") >= dini_Int(pfile, "ExperienciaTotal"))
{
if (dini_Int(pfile, "Level") < EXP_LevelMaximo)
{
while (dini_Int(pfile, "Experiencia") >= dini_Int(pfile, "ExperienciaTotal"))
{
dini_IntSet(pfile, "Experiencia", dini_Int(pfile, "Experiencia") - dini_Int(pfile, "ExperienciaTotal"));
dini_IntSet(pfile, "Level", dini_Int(pfile, "Level") + 1);
dini_IntSet(pfile, "ExperienciaTotal", dini_Int(pfile, "Level") * EXP_PorLevel);
format(string3, sizeof(string3), "Lvl: %02d",dini_Int(pfile, "Level"));
TextDrawSetString(TextoParaLevel[playerid], string3);
GivePlayerMoney(playerid, EXP_DinheiroPorLevel * dini_Int(pfile, "Level") * EXP_MultiplicarDinheiro);
format(string4, sizeof(string4), "~p~You got %d Exp for ~n~%s !~n~~g~Level up!", exp, reason);
}
}
else
{
GameTextForPlayer(playerid, "~g~L~y~e~b~v~r~e~g~l ~y~M~b~a~r~x~g~i~y~m~b~o ~r~A~g~l~y~c~b~a~r~n~g~c~y~a~b~d~r~o~g~!", EXP_GameTextTime, EXP_GameTextStyle);
dini_IntSet(pfile, "Experiencia", dini_Int(pfile, "ExperienciaTotal"));
}
}
else
{
format(string4, sizeof(string4), "~p~You got %d Exp for ~n~%s !", exp, reason);
}
format(string2, sizeof(string2), "Exp: %05d/%05d",dini_Int(pfile, "Experiencia"), dini_Int(pfile, "ExperienciaTotal"));
TextDrawSetString(TextoParaExperiencia[playerid], string2);
#if defined EXP_UsarProgressBar
SetProgressBarValue(Experiencia[playerid], dini_Int(pfile, "Experiencia"));
SetProgressBarMaxValue(Experiencia[playerid], dini_Int(pfile, "ExperienciaTotal"));
UpdateProgressBar(Experiencia[playerid], playerid);
#endif
GameTextForPlayer(playerid, string4, EXP_GameTextTime, EXP_GameTextStyle);
}
stock GetPlayerExpLevel(playerid)
{
new pfile[100], pname[MAX_PLAYER_NAME], Plevel;
GetPlayerName(playerid, pname, sizeof(pname));
format(pfile, sizeof(pfile), "HAccounts/%s.ini",pname);
Plevel = dini_Int(pfile, "Level");
return Plevel;
}
stock GetPlayerExp(playerid)
{
new pfile[100], pname[MAX_PLAYER_NAME], PExp;
GetPlayerName(playerid, pname, sizeof(pname));
format(pfile, sizeof(pfile), "HAccounts/%s.ini",pname);
PExp = dini_Int(pfile, "Experiencia");
return PExp;
}
stock GetPlayerTotalExp(playerid)
{
new pfile[100], pname[MAX_PLAYER_NAME], PTotalExp;
GetPlayerName(playerid, pname, sizeof(pname));
format(pfile, sizeof(pfile), "HAccounts/%s.ini",pname);
PTotalExp = dini_Int(pfile, "ExperienciaTotal");
return PTotalExp;
}