How to create Max Level - 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)
+--- Thread: How to create Max Level (
/showthread.php?tid=516405)
How to create Max Level -
Loveno - 31.05.2014
hey i have Exp and Level system but how to make Max Level ?
example Max Level for player is 25 and when player reach level 25 the player can't levelup again ?
thanks before
sorry for my bad english
Re: How to create Max Level -
BroZeus - 31.05.2014
pawn Код:
#define MAX_LEVEL 25 //on top
if(Exp[playerid]>=MAX_LEVEL)return 1;//supposing you save player experience in variable Exp[playerid]
//place this line in function or timer or stock where ever you update player's experience
Re: How to create Max Level -
Rittik - 31.05.2014
Код:
if(PlayerInfo[playerid][pLevel]==25)
{
//you code here...(Stop the timer or whatever you have you level/experience)
}
Re: How to create Max Level -
Rittik - 31.05.2014
Sorry for double post.
Re: How to create Max Level -
Loveno - 31.05.2014
still confused
this my script
pawn Код:
public UpdateExp(playerid)
{
new string[30]; // String.
if(IsPlayerConnected(playerid) == 1) // Checks if player is connected.
{
//new points[248]; // Points.
new nxtlevel = PlayerInfo[playerid][pLevel]+1; // As soon as its executed, It adds +1 to your score.
new expamount = nxtlevel*levelexp+100; // Exp amount, Its 2 CURRENTLY but you can raise it by adding +number after levelexp
// new pfile[100];
if(PlayerInfo[playerid][pExp] < expamount) // Checks if player's exp amount is above the required one or not.
{
//format(points,sizeof(points)," You need [%d] Exp Points in order to level up, You currently have [%d]",expamount,PlayerInfo[playerid][pExp]); // Format, This is pretty obvious.
//SendClientMessage(playerid,white,points); // Sends the message.
return 1;
}
else
{
PlayerInfo[playerid][pExp] = 0; // Sets the EXP amount to 0 as you level'd up.
PlayerInfo[playerid][pLevel]++; // Adds a level.
format(string,sizeof(string),"~g~Your now level:[%d] dan mendapatkan $%d",PlayerInfo[playerid][pLevel], CashForLevelUp * PlayerInfo[playerid][pLevel] * CashMultiplier); // Format.
GameTextForPlayer(playerid,string,3000,4); // Sends gametext about his new level'ing up.
GivePlayerMoney(playerid, CashForLevelUp * PlayerInfo[playerid][pLevel] * CashMultiplier);
return 1;
}
}
return 1;
}
Re: How to create Max Level -
BroZeus - 31.05.2014
pawn Код:
#define MAX_LEVEL 25 //on top
public UpdateExp(playerid)
{
new string[30]; // String.
if(IsPlayerConnected(playerid) == 1) // Checks if player is connected.
{
if(PlayerInfo[playerid][pLevel]>=MAX_LEVEL)return SendClientMessage(playerid,-1,"{ff0000}Max Level Reached can level up more.");//ADDED THIS LINE
//new points[248]; // Points.
new nxtlevel = PlayerInfo[playerid][pLevel]+1; // As soon as its executed, It adds +1 to your score.
new expamount = nxtlevel*levelexp+100; // Exp amount, Its 2 CURRENTLY but you can raise it by adding +number after levelexp
// new pfile[100];
if(PlayerInfo[playerid][pExp] < expamount) // Checks if player's exp amount is above the required one or not.
{
//format(points,sizeof(points)," You need [%d] Exp Points in order to level up, You currently have [%d]",expamount,PlayerInfo[playerid][pExp]); // Format, This is pretty obvious.
//SendClientMessage(playerid,white,points); // Sends the message.
return 1;
}
else
{
PlayerInfo[playerid][pExp] = 0; // Sets the EXP amount to 0 as you level'd up.
PlayerInfo[playerid][pLevel]++; // Adds a level.
format(string,sizeof(string),"~g~Your now level:[%d] dan mendapatkan $%d",PlayerInfo[playerid][pLevel], CashForLevelUp * PlayerInfo[playerid][pLevel] * CashMultiplier); // Format.
GameTextForPlayer(playerid,string,3000,4); // Sends gametext about his new level'ing up.
GivePlayerMoney(playerid, CashForLevelUp * PlayerInfo[playerid][pLevel] * CashMultiplier);
return 1;
}
}
return 1;
}