Creating an experience system:
#9

pawn Код:
#include <a_samp>
#include <zcmd>

enum PlayerInfo
{
    Exp,
    CurExp,
    Level,
}
new pInfo[MAX_PLAYERS][PlayerInfo];

CMD:test(playerid, params[])
{
    SetTimer("LevelTimer", 1800000, true);
   
    pInfo[playerid][Exp] = 8;
    pInfo[playerid][Level] = 1;
   
    return 1;
}

forward LevelTimer(playerid);
public LevelTimer(playerid)
{
    new string[128];
   
    if(pInfo[playerid][CurExp] != pInfo[playerid][Exp])
    {
        pInfo[playerid][CurExp] += 1;

        format(string, sizeof(string), "SERVER:{FFFFFF} Level progression: {BF4B4B}%d{FFFFFF}/{60B34B}%d{FFFFFF}. Next payday in 30 minutes.", pInfo[playerid][CurExp], pInfo[playerid][Exp]);
        SendClientMessage(playerid, 0x46E850FF, string);
    }
   
    else if(pInfo[playerid][CurExp] == pInfo[playerid][Exp])
    {
        pInfo[playerid][CurExp] = 0;
        pInfo[playerid][Exp] += 8;
       
        pInfo[playerid][Level] += 1;

        format(string, sizeof(string), "SERVER:{FFFFFF} You have leveled up! New level: {FFBB00}%d{FFFFFF}!", pInfo[playerid][Level]);
        SendClientMessage(playerid, 0x46E850FF, string);
       
        format(string, sizeof(string), "SERVER:{FFFFFF} Experience necessities upgraded: {BF4B4B}%d{FFFFFF}/{FFBB00}%d{FFFFFF}.", pInfo[playerid][CurExp], pInfo[playerid][Exp]);
        SendClientMessage(playerid, 0x46E850FF, string);
    }

    return 1;
}
Reply


Messages In This Thread
Creating an experience system: - by Twizted - 12.06.2014, 13:01
AW: Creating an experience system: - by BiosMarcel - 12.06.2014, 13:32
Re: AW: Creating an experience system: - by magnusburton - 12.06.2014, 13:34
Re: Creating an experience system: - by _Mohit_ - 12.06.2014, 14:01
Re: Creating an experience system: - by Twizted - 12.06.2014, 17:38
Re: Creating an experience system: - by TakeiT - 12.06.2014, 17:53
Re: Creating an experience system: - by Patrick - 12.06.2014, 18:02
Re: Creating an experience system: - by Denying - 12.06.2014, 18:09
Re: Creating an experience system: - by Dignity - 12.06.2014, 18:16
AW: Re: Creating an experience system: - by BiosMarcel - 12.06.2014, 18:44

Forum Jump:


Users browsing this thread: 2 Guest(s)