SA-MP Forums Archive
"Score" help - 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: "Score" help (/showthread.php?tid=387752)



[SOLVED] - Vexus - 26.10.2012

[SOLVED]


Re: "Score" help - [TC]XxJuggaloxX - 26.10.2012

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


Re: "Score" help - Vexus - 27.10.2012

Quote:
Originally Posted by [TC]XxJuggaloxX
Посмотреть сообщение
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
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;
}
Does this seem right? It seems right to me...


Re: "Score" help - xplor09edy - 27.10.2012

You can use something like this:
Код:
OnPlayerConnect(playerid) {
SetPlayerScore(playerid, GetPlayerInfo[Level]);
return 1; }
Something like this, i don't remember what info have ravens


Re: "Score" help - [TC]XxJuggaloxX - 27.10.2012

Quote:
Originally Posted by Vexus
Посмотреть сообщение
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;
}
Does this seem right? It seems right to me...
Well I have this in my /buylevel
SetPlayerScore(playerid, PlayerInfo[playerid][pLevel]);

So what that is doing is setting their score based on their level when they /buy level.

For you I will put my /buylevel command here
pawn Код:
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;
}