SA-MP Forums Archive
Team score? - 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: Team score? (/showthread.php?tid=267843)



Team score? - HayZatic - 10.07.2011

How would i do team score, then the server restarts (newround) when the team gets 50 Score?


Re: Team score? - PotH3Ad - 10.07.2011

This should give you an idea (I hope) on how to do it.

pawn Код:
new TeamScore;

//Use this to add to the team's score - "TeamScore += 1;"

if(TeamScore >= 50) //If team's score is 50 or greater
{
    SendRconCommand("gmx"); //restart the server
    return 1;
}



Re: Team score? - dowster - 10.07.2011

use an array for multiple teams,
a timer that runs around like every two or three seconds, to reduce server load
and a function called by that timer.
if you want to go by kill you would put in an if else if structure, or a switch int he onplayer death that checks the killers team and adds the point to their team.


Re: Team score? - mitsos1997 - 19.07.2011

[HELP] I NEED A TEAM SYSTEM I CANT MAKE IT BECAUSE I DONT KNOW HOW
FOR QUESTIONS ON mitsos-1997-221@hotmail.com
please help


Re: Team score? - eDz0r - 19.07.2011

....edit for your needs is not very good because i don't know your code so.. i have do my best...

pawn Код:
#include <a_samp>

#define TEAM_BLUE                                                               0
#define TEAM_RED                                                                1

new TeamBlueScore;
new TeamReadScore;
new CheckScoreTimer;

forward ScoreCheck();

public OnFilterScriptInit()
{
TeamBlueScore = 0;
TeamReadScore = 0;
CheckScoreTimer = SetTimer("ScoreCheck", 1000 * 5, 1);
return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
if(GetPlayerTeam(killerid) == TEAM_BLUE)
{
TeamBlueScore ++;
}
if(GetPlayerTeam(killerid) == TEAM_RED)
{
TeamReadScore ++;
}
return 1;
}

public ScoreCheck()
{
if(TeamBlueScore > 25)
{
GameTextForAll("~w~Team ~b~Blue ~w~Wins", 2500, 4);
return 1;
}
else if(TeamReadScore > 25)
{
GameTextForAll("~w~Team ~r~Read ~w~Wins", 2500, 4);
return 1;
}
SendRconCommand("gmx");
KillTimer(CheckScoreTimer);
return 1;
}