SA-MP Forums Archive
How can i make this function on score board? - 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 can i make this function on score board? (/showthread.php?tid=309094)



How can i make this function on score board? - Artie_Scorpion - 06.01.2012

pawn Код:
forward ExpTimer();
pawn Код:
public OnGameModeInit()
{
    SetTimer("ExpTimer", 60000, true); // Repeating timer set when the server starts up
}
at end of script
pawn Код:
public ExpTimer()  // The timer callback
{
    for(new i = 0; i != MAX_PLAYERS; i++)
    { // Loop
        if(IsPlayerConnected(i) && !IsPlayerNPC(i)) // Checks if player is connected + NPC's don't need experience
        {
            GivePlayerExp(i, 15, ""); // Every connected player receives 1 EXP
        }
    }
    return 1;
}
So this is EXP... How can i make EXP amount displayed in score board? And it will be saved maybe?


Re: How can i make this function on score board? - sabretur - 06.01.2012

Why do you use GivePlayerExp()? Use this:
pawn Код:
SetPlayerScore(i,GetPlayerScore(i)+15);



AW: How can i make this function on score board? - BigETI - 06.01.2012

https://sampwiki.blast.hk/wiki/SetPlayerScore

Quote:
Originally Posted by sabretur
Посмотреть сообщение
Why do you use GivePlayerExp()? Use this:
pawn Код:
SetPlayerScore(i,GetPlayerScore(i)+15);
probably he/she wants to save the EXP value somewhere.
Best wa is to get the value from the EXP and use SetPlayerScore.


Re: How can i make this function on score board? - Konstantinos - 06.01.2012

He might has stock.
pawn Код:
// Example:
stock GivePlayerScore(playerid, score)
{
    return SetPlayerScore(playerid, GetPlayerScore(playerid) + score);
}



Re: How can i make this function on score board? - Artie_Scorpion - 06.01.2012

Quote:
Originally Posted by Dwane
Посмотреть сообщение
He might has stock.
pawn Код:
// Example:
stock GivePlayerScore(playerid, score)
{
    return SetPlayerScore(playerid, GetPlayerScore(playerid) + score);
}
I mean something like that:

pawn Код:
if(GivePlayerExp(i, 15, "") && GetPlayerScore(playerid) + 15);



Re: How can i make this function on score board? - Artie_Scorpion - 06.01.2012

help plz


Re: How can i make this function on score board? - sabretur - 06.01.2012

pawn Код:
public ExpTimer()  // The timer callback
{
    for(new i = 0; i != MAX_PLAYERS; i++)
    { // Loop
        if(IsPlayerConnected(i) && !IsPlayerNPC(i)) // Checks if player is connected + NPC's don't need experience
        {
            SetPlayerScore(i,GetPlayerScore(i)+15);
        }
    }
    return 1;
}



Re: How can i make this function on score board? - Artie_Scorpion - 06.01.2012

Quote:
Originally Posted by sabretur
Посмотреть сообщение
pawn Код:
public ExpTimer()  // The timer callback
{
    for(new i = 0; i != MAX_PLAYERS; i++)
    { // Loop
        if(IsPlayerConnected(i) && !IsPlayerNPC(i)) // Checks if player is connected + NPC's don't need experience
        {
            SetPlayerScore(i,GetPlayerScore(i)+15);
        }
    }
    return 1;
}
duok skype parodysiu visa scripta ...


Re: How can i make this function on score board? - Artie_Scorpion - 06.01.2012

I mean something like that people:

pawn Код:
if(GivePlayerExp(i, 15, "") && GetPlayerScore(playerid) + 15);
help me