[Solved]System score in tdm team win -
Saliim - 19.04.2016
How to create a system score for my tdm
example
Team red vs Team green
team red : 30 score
team green : 50 score
team green win after 5 minutes
Re: System score in tdm team win -
perfectboy - 19.04.2016
A pretty random question please look at a few tdm script examples you will be able to make it
Re: System score in tdm team win -
Saliim - 20.04.2016
hi, Thank you for your answer,
I watch a lot of topic, but I did not find what you told me
Re: System score in tdm team win -
itsCody - 20.04.2016
Create 2 variables to store the team kills, increase them every time somebody on one team gets a kill.
Then either display them with a textdraw or some other way.
Re: System score in tdm team win -
Saliim - 20.04.2016
thank you what way I can store them killed?
Re: System score in tdm team win -
Saliim - 25.04.2016
up please
Re: System score in tdm team win -
Sew_Sumi - 25.04.2016
--damn double posting.--
Re: System score in tdm team win -
Sew_Sumi - 25.04.2016
Very simple code man... Many examples of it in the server package.
This was whipped up from scratch. Made it as a Filterscript.
PHP код:
#include <a_samp>
new Team1Kills, Team2Kills, RoundTime, RoundStatus; // First 2 variables were what ItsCody was talking about. The latter 2 are ones for the time of the round, and one to check the status of it.
public OnPlayerDeath(playerid, killerid)
{
if(RoundStatus==0) return 1; // We don't want to count crap outside of the rounds
if(killerid == INVALID_PLAYER_ID) return 1; //If it was falling damage we don't want it either. (Could be exploited though by denying enemy of kills)
if(GetPlayerTeam(killerid)==GetPlayerTeam(playerid)) return 1; //No TK counting as a "kill". (Could also be exploited by someone TKing to save their team from the kill)
if(GetPlayerTeam(killerid)==1)
{
Team1Kills++;
}
if(GetPlayerTeam(killerid)==2)
{
Team2Kills++;
}
return 1;
}
forward Tick();
public Tick()
{
if(RoundTime<0) return 1; //If rounds are disabled via the command, we don't need to check anything.
RoundTime++;
if(RoundTime<10 && RoundStatus!=0) //If round just finished, and will be starting again
{
SendClientMessageToAll(-1, "Round will restart shortly.");
RoundStatus=0;
}
if(RoundTime>10 && RoundStatus==0) //If round is to begin
{
RoundStatus=1;
SendClientMessageToAll(-1, "Round started.");
Team1Kills = 0;
Team2Kills = 0;
}
if(RoundTime>620 && RoundStatus==1) //If round should be finishing. 600 = 10 minutes.
{
RoundTime = 0; // Change this to -1 or less to make the rounds not auto restart.
new string[30];
format(string, sizeof(string), "Team 1 :%i | Team 2 :%i", Team1Kills, Team2Kills);
SendClientMessageToAll(-1,string);
if(Team1Kills>Team2Kills) return SendClientMessageToAll(-1, "Team 1 won the round.");
if(Team1Kills<Team2Kills) return SendClientMessageToAll(-1, "Team 2 won the round.");
if(Team1Kills==Team2Kills) return SendClientMessageToAll(-1, "Teams drew.");
}
return 1;
}
public OnFilterScriptInit()
{
SetTimer("Tick", 1000, true);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/beginround", true) == 0)
{
SendClientMessage(playerid, -1, "Rounds enabled.");
RoundTime=0;
RoundStatus=1;
return 1;
}
if(strcmp(cmdtext, "/stopround", true) == 0)
{
SendClientMessage(playerid, -1, "Rounds disabled.");
RoundTime=-5;
return 1;
}
return 0;
}
Re: System score in tdm team win -
Saliim - 25.04.2016
Quote:
Originally Posted by Sew_Sumi
Very simple code man... Many examples of it in the server package.
This was whipped up from scratch. Made it as a Filterscript.
PHP код:
#include <a_samp>
new Team1Kills, Team2Kills, RoundTime, RoundStatus; // First 2 variables were what ItsCody was talking about. The latter 2 are ones for the time of the round, and one to check the status of it.
public OnPlayerDeath(playerid, killerid)
{
if(RoundStatus==0) return 1; // We don't want to count crap outside of the rounds
if(killerid == INVALID_PLAYER_ID) return 1; //If it was falling damage we don't want it either. (Could be exploited though by denying enemy of kills)
if(GetPlayerTeam(killerid)==GetPlayerTeam(playerid)) return 1; //No TK counting as a "kill". (Could also be exploited by someone TKing to save their team from the kill)
if(GetPlayerTeam(killerid)==1)
{
Team1Kills++;
}
if(GetPlayerTeam(killerid)==2)
{
Team2Kills++;
}
return 1;
}
forward Tick();
public Tick()
{
if(RoundTime<0) return 1; //If rounds are disabled via the command, we don't need to check anything.
RoundTime++;
if(RoundTime<10 && RoundStatus!=0) //If round just finished, and will be starting again
{
SendClientMessageToAll(-1, "Round will restart shortly.");
RoundStatus=0;
}
if(RoundTime>10 && RoundStatus==0) //If round is to begin
{
RoundStatus=1;
SendClientMessageToAll(-1, "Round started.");
Team1Kills = 0;
Team2Kills = 0;
}
if(RoundTime>620 && RoundStatus==1) //If round should be finishing. 600 = 10 minutes.
{
RoundTime = 0; // Change this to -1 or less to make the rounds not auto restart.
new string[30];
format(string, sizeof(string), "Team 1 :%i | Team 2 :%i", Team1Kills, Team2Kills);
SendClientMessageToAll(-1,string);
if(Team1Kills>Team2Kills) return SendClientMessageToAll(-1, "Team 1 won the round.");
if(Team1Kills<Team2Kills) return SendClientMessageToAll(-1, "Team 2 won the round.");
if(Team1Kills==Team2Kills) return SendClientMessageToAll(-1, "Teams drew.");
}
return 1;
}
public OnFilterScriptInit()
{
SetTimer("Tick", 1000, true);
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/beginround", true) == 0)
{
SendClientMessage(playerid, -1, "Rounds enabled.");
RoundTime=0;
RoundStatus=1;
return 1;
}
if(strcmp(cmdtext, "/stopround", true) == 0)
{
SendClientMessage(playerid, -1, "Rounds disabled.");
RoundTime=-5;
return 1;
}
return 0;
}
|
thank you,
but I'm having a problem, because in my toc I add
Red team:
Код:
SetPlayerColor (playerid, Color_Red);
SetPlayerTeam (playerid, 501);
and the Green team
Код:
SetPlayerColor (playerid, 0x00FF00FF);
SetPlayerTeam (playerid, 502);
The green team can not make team killing
The red team can not make teamkilling,
the problem is that if I add in TDM1
in team Red
Код:
if(GetPlayerTeam(killerid)==1)
{
Team1Kills++;
}
and, in team green
Код:
if(GetPlayerTeam(killerid)==2)
{
Team2Kills++;
}
this will make confusion with my 10 TDM, who possessed the same value
TEAM DEATH MATCH 2
team Red
Код:
if(GetPlayerTeam(killerid)==1)
{
Team1Kills++;
}
and, team green
Код:
if(GetPlayerTeam(killerid)==2)
{
Team2Kills++;
}
Re: System score in tdm team win -
Sew_Sumi - 25.04.2016
just change the 1 and 2 to 501 and 502 lol.
PHP код:
if(GetPlayerTeam(killerid)==501)
{
Team1Kills++;
}
PHP код:
if(GetPlayerTeam(killerid)==502)
{
Team2Kills++;
}
PHP код:
format(string, sizeof(string), "Team Red :%i - Team Green :%i", Team1Kills, Team2Kills);