SA-MP Forums Archive
need a text draw score keeper - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: need a text draw score keeper (/showthread.php?tid=117628)



need a text draw score keeper - Bloodz4Lyfe - 01.01.2010

I need a text draw to where, When a gang kills the opposit gangs gang membe, they're score goes up 1. and it just keeps going till the server restarts.

how can i do that?


Re: need a text draw score keeper - KnooL - 01.01.2010

onplayerdeath you should check if the killerid(player) is in the left team or the right team. Then you put a variable++ and put it in a timer that refreshes/updates the textdraw with the data.

So it'll be:

On Top:
pawn Код:
new team1score = 0;
new team2score = 0;
OnGameModeInit:
pawn Код:
SetTimer("refreshsboard", 1000, true);
OnPlayerDeath:
pawn Код:
if(Team[killerid] == team1)     // the killer is oart of team1
{
if(Team[playerid] == team2)   // so if he kills a member of team2 then his score and his teams score gets increased.
{
team1score++;
SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
}
}
if(Team[killerid] == team2)
{
if(Team[playerid] == team1)
{
team2score++;
SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
}
}
At the bottom of your script:
pawn Код:
forward refreshsboard();
public refreshsboard()
{
new score[128]; //reduced to 128 save some server memory
format(score, sizeof(score), "score ~n~ ~n~ ~n~ team1:   %i ~n~ ~n~ team2: %i", team1score, team2score);
TextDrawSetString(scoretext, score);
for(new i = 0; i < MAX_SERVER_PLAYERS; i++) //change MAX_SERVER_PLAYERS to the maximum player slots you have on ur server
TextDrawShowForPlayer(playerid, scoretext)
return 1;
}
the only remaining thing is making the textdraw to put the information in.