Teamscore in Textdraw help?
#1

I am really new to scripting, so sorry for newbie mistakes -

new Text:DMTeam1Score;
new Text:DMTeam2Score;

public OnFilterScriptInit()
{
DMTeam1Score = TextDrawCreate(460.0,100.0,"Team 1 Points - 0");
TextDrawColor(DMTeam1Score, 0xFF0000FF);
DMTeam2Score = TextDrawCreate(460.0,115.0,"Team 2 Points - 0");
TextDrawColor(DMTeam2Score, 0x0000FFFF);
}

public OnPlayerCommandText(playerid, cmdtext[])
{
TextDrawShowForPlayer(playerid, DMTeam1Score);
TextDrawShowForPlayer(playerid, DMTeam2Score);
}

What should i put under OnPlayerDeath to add a point to the "0" in each Textdraw?
Reply
#2

What you will need is an array to store the score in. Replace this:
pawn Код:
new Text:DMTeam1Score;
new Text:DMTeam2Score;
With this:
pawn Код:
new Text:DMTeam1Score;
new Text:DMTeam2Score;
new Score[2]; // Score[2] will be storing each team's overall score
Now, under OnPlayerDeath
pawn Код:
new string[24];
if(Team[killerid] == 1) // Or whatever your team code is
{
    Score[0] ++;
    format(string,sizeof(string),"Team 1 Points - %d",Score[0]);
    TextDrawSetString(DMTeam1Score, string);
}
else if(Team[killerid] == 2)  // Or whatever your team code is
{
    Score[1] ++;
    format(string,sizeof(string),"Team 2 Points - %d",Score[1]);
    TextDrawSetString(DMTeam2Score, string);
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)