How to create when player haves that exp for the next level to gives automatic LEVEL UP !, Y don't want it in cmd y wan't automatic
Код:
if (strcmp(cmd, "/levelup", true) == 0 || strcmp(cmd, "/kupilevel", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if (gPlayerLogged[playerid] != 0)
{
if(PlayerInfo[playerid][pLevel] >= 0)
{
new nxtlevel = PlayerInfo[playerid][pLevel]+1;
new expamount = nxtlevel*levelexp;
new infostring[128];
if (PlayerInfo[playerid][pExp] < expamount)
{
format(infostring, 256, "Morate imati %d Respekt Poena,trenutno imate %d!",expamount,PlayerInfo[playerid][pExp]);
SendClientMessage(playerid, WHITE, infostring);
return 1;
}
else
{
format(string, sizeof(string), "~g~VECI NIVO~n~~w~Sada ste level %d", nxtlevel);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
PlayerInfo[playerid][pLevel]++;
if(PlayerInfo[playerid][pDonateRank] > 0)
{
PlayerInfo[playerid][pExp] -= expamount;
new total = PlayerInfo[playerid][pExp];
if(total > 0)
{
PlayerInfo[playerid][pExp] = total;
}
else
{
PlayerInfo[playerid][pExp] = 0;
}
}
else
{
PlayerInfo[playerid][pExp] = 0;
}
format(infostring, 256, "Sega ste level %d.", nxtlevel);
SendClientMessage(playerid, SVETLOPLAVA, infostring);
}
}
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "Niste prijavljeni!");
}
}
return 1;
}