09.05.2012, 00:44
Hello guys, I'm using the FS Experience Bar below, the problem is that it is not by setting the level of the player in the game only when it reconnects it shows the level that would show when he advances in level.
?
OnPlayerConnect
I am posting only the main FS, because I believe that the error is here:
?
OnPlayerConnect
pawn Код:
new file2[128];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(file2,sizeof(file2),savefile,name);
if(!fexist(file2))
{
DOF2_CreateFile(file2);
DOF2_SetInt(file2,"pExp", 0);
DOF2_SetInt(file2,"pNivel", 0);
DOF2_SaveFile();
DOF2_Exit();
}
if(fexist(file2))
{
Exp[playerid] = DOF2_GetInt(file2,"pExp");
Nivel[playerid] = DOF2_GetInt(file2,"pNivel");
}
pawn Код:
TimerUpdate(); public TimerUpdate()
{
new string[128],name[MAX_PLAYER_NAME];
for(new i=0;i<MAX_PLAYERS;i++)
{
if (IsPlayerConnected(i))
{
if(Exp[i] >= 10)
{
Exp[i] = Exp[i]-10;
Nivel[i]++;
GetPlayerName(i,name,sizeof(name));
format(string,sizeof(string),"~b~~h~~h~~h~%s Subiu de Nivel!!!",name);
GameTextForAll(string,2000,3);
TextDrawHideForPlayer(i,Textdrawz1[i]);
format(string, sizeof(string), "%s" ,GetExpTol(i));
TextDrawSetString(Textdrawz1[i],string);
TextDrawShowForPlayer(i,Textdrawz1[i]);
}
else
{
TextDrawHideForPlayer(i,Textdrawz1[i]);
format(string, sizeof(string), "%s" ,GetExpTol(i));
TextDrawSetString(Textdrawz1[i],string);
TextDrawShowForPlayer(i,Textdrawz1[i]);
}
}
}
return 1;
}