Problem with level
#1

Hello..
How can i make at script to give level automatically..Not with /levelup..
I have a Roleplay server but i can`t resolve this problem..i don`t want /level up..i want give level automatically
Reply
#2

It is possible without timers. If you add some Exp to player and then you called function(same as /levelup but "auto") e.g.
Код:
CheckPlayerLevelForEXP(playerid) if(currentEXP[playerid] > some_value) lvl[playerid] += 1;
so if you add player exp then function "CheckPlayerLevelForEXP" will be called.
See: https://sampwiki.blast.hk/wiki/CallLocalFunction
something like that..
Reply
#3

Ohhh,i don`t know..I have a United Roleplay Edit...
And there is /levelup ...i want give level automatically
Reply
#4

Can you post your level up command? , we can't help without codes.
Reply
#5

I am surprised posts like these are still popping up. This community has a good amount of tutorials and documentation. I suggest you do some reading before asking these questions (it will honestly help you in the long run, as is well worth the small amount of time it will take to read/test these articles).

https://sampwiki.blast.hk/wiki/Scripting_Basics
https://sampwiki.blast.hk/wiki/Control_Structures
Reply
#6

Quote:
Originally Posted by SilentSoul
Посмотреть сообщение
Can you post your level up command? , we can't help without codes.
Код:
	if(strcmp(cmd, "/levelup", true) == 0)
	{
	    if(IsPlayerConnected(playerid))
	    {
			if(gPlayerLogged[playerid] != 0)
			{
				if(PlayerInfo[playerid][pLevel] >= 0)
				{
					new nxtlevel = PlayerInfo[playerid][pLevel]+1;
					new costlevel = nxtlevel*levelcost;//10k for testing purposes
					new expamount = nxtlevel*levelexp;
					if(PlayerInfo[playerid][pCash] < costlevel)
					{
						format(string, sizeof(string), "   You can't afford that ($%d) !",costlevel);
						SendClientMessage(playerid, COLOR_GREY, string);
						return 1;
					}
					else if(PlayerInfo[playerid][pExp] < expamount)
					{
						format(string, sizeof(string), "   You need %d respect points, you curently have %d !",expamount,PlayerInfo[playerid][pExp]);
						SendClientMessage(playerid, COLOR_GREY, string);
						return 1;
					}
					else
					{
						format(string, sizeof(string), "~r~Level up~n~~w~level %d", nxtlevel);
						PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
						if(PlayerInfo[playerid][pDonateRank] >= 3)
						{
						PlayerInfo[playerid][pLevel]++;
						PlayerInfo[playerid][gPupgrade] = PlayerInfo[playerid][gPupgrade]+5;
						PlayerInfo[playerid][pLevel]++;
						format(string, sizeof(string), "You became level %d, type /upgrade.", nxtlevel);
						SendClientMessage(playerid, COLOR_YELLOW, string);
						format(string, sizeof(string), "You have %d upgrade points remaining.",PlayerInfo[playerid][gPupgrade]);
						SendClientMessage(playerid, COLOR_YELLOW, string);
						}
						else
						{
						PlayerInfo[playerid][pExp] -= expamount;
						new total = PlayerInfo[playerid][pExp];
						if(total > 0) { PlayerInfo[playerid][pExp] = total; }
						else { PlayerInfo[playerid][pExp] = 0; }
						PlayerInfo[playerid][gPupgrade] = PlayerInfo[playerid][gPupgrade]+2;
						GameTextForPlayer(playerid, string, 5000, 1);
						format(string, sizeof(string), "You became level %d, type /upgrade.", nxtlevel);
						SendClientMessage(playerid, COLOR_YELLOW, string);
						format(string, sizeof(string), "You have %d upgrade points remaining.",PlayerInfo[playerid][gPupgrade]);
						SendClientMessage(playerid, COLOR_YELLOW, string);
						}
					}
				}
				return 1;
			}
			else
			{
				SendClientMessage(playerid, COLOR_GRAD1, "   You are not Logged in !");
			}
		}
		return 1;
	}
Reply
#7

Would you like to tell us what exactly you looking for , you want each amount of time the player got level up , when he kill player or what are you looking for ?
Reply
#8

I want to give level automatically.
I don`t want ,player when have 8/8 exp to type /levelup..Whe he have 8/8,server gives level automatically...

It`s a Roleplay Server !
Reply
#9

Anyone ?
Reply
#10

Didn't test it but it should work , please tell me if there any errors
pawn Код:
public OnPlayerUpdate(playerid)
{
    if(PlayerInfo[playerid][pExp] == 8)
    {
        new string[126];
        format(string, sizeof(string), "~r~Level up~n~~w~level %d", nxtlevel);
        GameTextForPlayer(playerid,string,3000,3);
        PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
        if(PlayerInfo[playerid][pDonateRank] >= 3)
        {
        PlayerInfo[playerid][pLevel]++;
        PlayerInfo[playerid][gPupgrade] = PlayerInfo[playerid][gPupgrade]+5;
        PlayerInfo[playerid][pLevel]++;
        format(string, sizeof(string), "You became level %d, type /upgrade.", nxtlevel);
        SendClientMessage(playerid, COLOR_YELLOW, string);
        format(string, sizeof(string), "You have %d upgrade points remaining.",PlayerInfo[playerid][gPupgrade]);
        SendClientMessage(playerid, COLOR_YELLOW, string);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 8 Guest(s)