Posts: 99
Threads: 13
Joined: Mar 2016
Reputation:
0
19.04.2016, 19:06
(
Последний раз редактировалось Saliim; 25.04.2016 в 07:24.
Причина: Solved
)
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
Posts: 165
Threads: 22
Joined: Feb 2015
Reputation:
0
A pretty random question please look at a few tdm script examples you will be able to make it
Posts: 99
Threads: 13
Joined: Mar 2016
Reputation:
0
hi, Thank you for your answer,
I watch a lot of topic, but I did not find what you told me
Posts: 519
Threads: 21
Joined: Nov 2012
Reputation:
0
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.
Posts: 99
Threads: 13
Joined: Mar 2016
Reputation:
0
thank you what way I can store them killed?
Posts: 6,242
Threads: 8
Joined: Jun 2008
Posts: 6,242
Threads: 8
Joined: Jun 2008
25.04.2016, 03:01
(
Последний раз редактировалось Sew_Sumi; 25.04.2016 в 04:41.
)
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;
}
Posts: 6,242
Threads: 8
Joined: Jun 2008
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);