Kill/Dead - Scoreboard
#1

Hello my fellow scripters.

I want to create a scoreboard at the right side of someone's screen which will shows the top 5 players with their amount of kills and times they died.

The problem is, I don't know where to start. It would be nice if someone could help me out!
Reply
#2

Start by checking if you have an registration system.
Most of them will have this:

pawn Код:
PlayerInfo[playerid][pKills]
PlayerInfo[playerid][pDeaths]
Next you could check the number of kills in order, not sure how to do that though
You should do a GetPlayerKills/deaths function :\ Not sure... Hope it helped a little!

EDIT: I just remembered how to do getplayerkills
pawn Код:
stock GetPlayerKills(playerid)
{
    return PlayerInfo[playerid][pKills];
}
Same for GetPlayerDeaths
Reply
#3

Quote:
Originally Posted by hydravink
Посмотреть сообщение
Start by checking if you have an registration system.
Most of them will have this:

pawn Код:
PlayerInfo[playerid][pKills]
PlayerInfo[playerid][pDeaths]
Next you could check the number of kills in order, not sure how to do that though
You should do a GetPlayerKills/deaths function :\ Not sure... Hope it helped a little!

EDIT: I just remembered how to do getplayerkills
pawn Код:
stock GetPlayerKills(playerid)
{
    return PlayerInfo[playerid][pKills];
}
Same for GetPlayerDeaths
Yeah I have some saving system, but somehow whenever I reboot the server everyone loses his admin. Not sure how to solve this :/.

Thanks for your help though!
Reply
#4

******: samp tutorial textdraw and do you want top kills on online or general with offline players?

Edit: Use in OnGameModeExit callback a for loop and call the OnPlayerDisconnect with reason 1 for saving data when you restart the server. Unless it's something wrong that you'll need to show us the saving and loading part.
Reply
#5

Quote:
Originally Posted by Dwane
Посмотреть сообщение
******: samp tutorial textdraw and do you want top kills on online or general with offline players?

Edit: Use in OnGameModeExit callback a for loop and call the OnPlayerDisconnect with reason 1 for saving data when you restart the server. Unless it's something wrong that you'll need to show us the saving and loading part.
I want them of the players online.

Edit:
Lol, my OnGameModeExit is empty!
Код:
public OnGameModeExit()
{
    return 1;
}
Not sure what to put there (I'm a beginner). And I use SII.

Also my OnPlayerDisconnect is empty somehow :/
Код:
public OnPlayerDisconnect(playerid, reason)
{
    return 1;
}
Reply
#6

SII is outdated and slow compared to others INI files or SQL. If you don't save the data with a timer, then where do you save them?

I recomment you from INI files, y_ini or from SQL: SQLite OR MySQL.

What I meant was this
pawn Код:
public OnGameModeExit()
{
    for( new i = 0; i < MAX_PLAYERS; i ++ )
    {
        if( /* Player is logged in */( i ) ) OnPlayerDisconnect( i, 1 );
    }
    return 1;
}
// It will call the callback like players leave the game by menu > Esc or /q and it is supposed in OnPlayerDisconnect, you save the data.
Reply
#7

Quote:
Originally Posted by Dwane
Посмотреть сообщение
SII is outdated and slow compared to others INI files or SQL. If you don't save the data with a timer, then where do you save them?

I recomment you from INI files, y_ini or from SQL: SQLite OR MySQL.

What I meant was this
pawn Код:
public OnGameModeExit()
{
    for( new i = 0; i < MAX_PLAYERS; i ++ )
    {
        if( /* Player is logged in */( i ) ) OnPlayerDisconnect( i, 1 );
    }
    return 1;
}
// It will call the callback like players leave the game by menu > Esc or /q and it is supposed in OnPlayerDisconnect, you save the data.
Then I have to rescript everything, if I change from include?
Reply
#8

Yes, but I can help you with that. I switched from Dini (When I started) to y_ini in 2 days and after some months from y_ini to SQLite in one day. It doesn't take so much to re-script it if you've already have the old, just editing the code with new functions/callbacks etc.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)