Level System failling - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Level System failling (
/showthread.php?tid=237354)
Level System failling -
=WoR=Bruno - 09.03.2011
Ok,im using this level system,but the problem is...it make players leveling up directly to level 2.and then they dont level up anymore,althougth we still got the message about respect growing.
-Edit-i made all 60 seconds to get 1 resp.and some players are level 4,but beeing ingame less time then others that are still lvl 2.
Here is the code:
Код:
#include <a_samp>
#include <dini>
#define COR_AQUI 0xFFFFFFAA
new Level[MAX_PLAYERS];
new Respeito[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
if(dini_Isset("levels.dkn",PlayerName(playerid))) Level[playerid] = (playerid,dini_Int("levels.dkn",PlayerName(playerid)));
SetTimerEx("Timer",60000,true,"i",playerid);
return 1;
}
forward Timer(playerid);
public Timer(playerid)
{
Respeito[playerid]++;
SendClientMessage(playerid,COR_AQUI,"Gratz,your respect has grown a bit more!!");
if(Respeito[playerid] == 5)
{
Level[playerid]++;
SendClientMessage(playerid,COR_AQUI,"Gratz,you leveled up!!");
Level[playerid]++;
}
return 1;
}
public OnGameModeInit()
{
if(!fexist("levels.dkn")) dini_Create("levels.dkn");
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
dini_IntSet("levels.dkn",PlayerName(playerid),Level[playerid]);
return 1;
}
public OnPlayerUpdate(playerid)
{
dini_IntSet("levels.dkn",PlayerName(playerid),Level[playerid]);
if(dini_Isset("levels.dkn",PlayerName(playerid))) SetPlayerScore(playerid,dini_Int("levels.dkn",PlayerName(playerid)));
return 1;
}
stock PlayerName(playerid)
{
new PlayerNameLevel[MAX_PLAYERS];
GetPlayerName(playerid, PlayerNameLevel, MAX_PLAYERS);
return PlayerNameLevel;
}
Re: Level System failling -
Mean - 09.03.2011
You are putting him 2 lvl ups. Also, make on levelup:
pawn Код:
if(Respeito[playerid] == 5)
{
Level[playerid]++;
SendClientMessage(playerid,COR_AQUI,"Gratz,you leveled up!!");
Respeito[playerid] = 0; // You reset it upon level up right?
}
Re: Level System failling -
=WoR=Bruno - 09.03.2011
Damn xD
I think its good. thx