System score in tdm team win
#8

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 Team1KillsTeam2KillsRoundTimeRoundStatus// 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(playeridkillerid)
{
    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(stringsizeof(string), "Team 1 :%i | Team 2 :%i"Team1KillsTeam2Kills);
        
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"1000true);
    return 
1;
}
public 
OnPlayerCommandText(playeridcmdtext[])
{
    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;

Reply


Messages In This Thread
[Solved]System score in tdm team win - by Saliim - 19.04.2016, 19:06
Re: System score in tdm team win - by perfectboy - 19.04.2016, 19:56
Re: System score in tdm team win - by Saliim - 20.04.2016, 07:35
Re: System score in tdm team win - by itsCody - 20.04.2016, 08:00
Re: System score in tdm team win - by Saliim - 20.04.2016, 08:18
Re: System score in tdm team win - by Saliim - 25.04.2016, 00:10
Re: System score in tdm team win - by Sew_Sumi - 25.04.2016, 02:58
Re: System score in tdm team win - by Sew_Sumi - 25.04.2016, 03:01
Re: System score in tdm team win - by Saliim - 25.04.2016, 07:16
Re: System score in tdm team win - by Sew_Sumi - 25.04.2016, 07:20

Forum Jump:


Users browsing this thread: 1 Guest(s)