https://sampwiki.blast.hk/wiki/SetPlayerScore
SetPlayerScore(playerid, GetPlayerScore(playerid) + 1); Just make that for every time they level up and it will update their score in tab |
public DollahScoreUpdate() { new LevScore; for(new i=0; i<MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { LevScore = PlayerInfo[i][pLevel]; SetPlayerScore(i, LevScore); } } return 1; }
OnPlayerConnect(playerid) { SetPlayerScore(playerid, GetPlayerInfo[Level]); return 1; }
Yeah, that's why I am confused.
Код:
public DollahScoreUpdate() { new LevScore; for(new i=0; i<MAX_PLAYERS; i++) { if(IsPlayerConnected(i)) { LevScore = PlayerInfo[i][pLevel]; SetPlayerScore(i, LevScore); } } return 1; } |
CMD:buylevel(playerid, params[])
{
if (gPlayerLogged{playerid} != 0)
{
if(PlayerInfo[playerid][pLevel] >= 0)
{
new nxtlevel = PlayerInfo[playerid][pLevel]+1;
new costlevel = nxtlevel*25000;
new expamount = nxtlevel*4;
if(GetPlayerCash(playerid) < costlevel)
{
new string[128];
format(string, sizeof(string), "You don't have enough cash ($%d).",costlevel);
SendClientMessageEx(playerid, COLOR_GRAD1, string);
return 1;
}
else if (PlayerInfo[playerid][pExp] < expamount)
{
new string[58];
format(string, sizeof(string), "You need %d more respect points to buy your next level.", expamount - PlayerInfo[playerid][pExp]);
SendClientMessageEx(playerid, COLOR_GRAD1, string);
return 1;
}
else
{
new string[92];
format(string, sizeof(string), "~g~LEVEL UP~n~~w~You Are Now Level %d", nxtlevel);
PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
GivePlayerCash(playerid, (-costlevel));
PlayerInfo[playerid][pLevel]++;
PlayerInfo[playerid][pExp] = PlayerInfo[playerid][pExp]-expamount;
PlayerInfo[playerid][gPupgrade] = PlayerInfo[playerid][gPupgrade]+2;
GameTextForPlayer(playerid, string, 5000, 1);
format(string, sizeof(string), "You have bought level %d for $%d, and gained %i upgrade points! /upgrade to use them.", nxtlevel, costlevel, PlayerInfo[playerid][gPupgrade]);
SendClientMessageEx(playerid, COLOR_GRAD1, string);
SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);
if(PlayerInfo[playerid][pLevel] == 6)
{
SendClientMessageEx(playerid, COLOR_WHITE, "Newbie chat will now be automatically togged off on login.");
}
}
}
return 1;
}
else
{
SendClientMessageEx(playerid, COLOR_GRAD1, "You're not logged in.");
}
return 1;
}