Kill Counter
#1

Can you help me to create kill counter of kills of witch team and to type them, so everyone on server can see following:

Код:
Team 1: [Number Of Kills]
Team 2: [Number of Kills].
Reply
#2

pawn Код:
#define MAX_TEAMS 2

new TeamKills[MAX_TEAMS];

public OnPlayerDeath(playerid, killerid, reason)
{
    if (PlayerTeam[playerid] == TEAM_COPS) TeamKills[0]++ // change PlayerTeam[playerid] == TEAM_COPS to the variable you use to identify teams
    else if (PlayerTeam[playerid] == TEAM_BADDIES) TeamKills[1]++ // change PlayerTeam[playerid] == TEAM_BADDIES to the variable you use to identify teams
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/showkills", cmdtext, true, 10) == 0)
    {
        new string[128];
        SendClientMessageToAll(0xFFFFFF00, "*** Team Kill Stats ***");
        format(string, sizeof string, "Team 1 (Cops): %d", TeamKills[0]);
        SendClientMessageToAll(0xFF8000FF, string);
        format(string, sizeof string, "Team 2 (Baddies): %d", TeamKills[1]);
        SendClientMessageToAll(0xFF8000FF, string);
        return 1;
    }
   
    if (strcmp("/resetkills", cmdtext, true, 11) == 0)
    {
        for (new i = 0; i < MAX_TEAMS; i++)
        {
            TeamKills[i] = 0;
        }
        return 1;
    }
    return 0;
}
I was bored so i just quickly done this. You must change:
pawn Код:
PlayerTeam[playerid] == TEAM_COPS
and
PlayerTeam[playerid] == TEAM_BADDIES
to however your script defines/identifies teams. Untested
Reply
#3

Than you very much!
Reply
#4

Please once again, I get following errors if I type your code:

Код:
I:\[0.2] Mini Missions Reborn\World war 3\gamemodes\FarmWars.pwn(160) : warning 217: loose indentation
I:\[0.2] Mini Missions Reborn\World war 3\gamemodes\FarmWars.pwn(160) : error 017: undefined symbol "PlayerTeam"
I:\[0.2] Mini Missions Reborn\World war 3\gamemodes\FarmWars.pwn(160) : warning 215: expression has no effect
I:\[0.2] Mini Missions Reborn\World war 3\gamemodes\FarmWars.pwn(160) : error 001: expected token: ";", but found "]"
I:\[0.2] Mini Missions Reborn\World war 3\gamemodes\FarmWars.pwn(160) : error 029: invalid expression, assumed zero
I:\[0.2] Mini Missions Reborn\World war 3\gamemodes\FarmWars.pwn(160) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
I need it so please help! Thanks
Reply
#5

How do you define your teams?
Reply
#6

Quote:
Originally Posted by [B2K
Hustler ]

I was bored so i just quickly done this. You must change:
pawn Код:
PlayerTeam[playerid] == TEAM_COPS
and
PlayerTeam[playerid] == TEAM_BADDIES
to however your script defines/identifies teams. Untested
you forgot this i guess
Reply
#7

Quote:
Originally Posted by DeathOnaStick
Quote:
Originally Posted by [B2K
Hustler ]

I was bored so i just quickly done this. You must change:
pawn Код:
PlayerTeam[playerid] == TEAM_COPS
and
PlayerTeam[playerid] == TEAM_BADDIES
to however your script defines/identifies teams. Untested
you forgot this i guess

Hes gonna have to change the team Cops and team baddies to what ever his teams are. But ya he did.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)