PDA

View Full Version : Trying to get map to change after X amount of kills.


rangerxxll
23/03/2013, 05:59 AM
So I've tried to add this code, and it doesn't seem to be working. I'm a bit confused. I'm trying to get the map(mode) to change after 10 kills by the same team. Anyone have any idea on what I'm doing wrong? Am I even doing any of it correctly?

Here's my current relevant code.

public OnPlayerDeath(playerid, killerid, reason)
{
if(gTeam[killerid] == TEAM_CT)
{
foreach(Player, i)
{
tscore[gTeam[i]] +=1;
}
}
if(gTeam[killerid] == TEAM_TE)
{
foreach(Player, i)
{
tscore[gTeam[i]] +=1;
}
}
foreach(Player, i)
{
if(tscore[gTeam[i]] == 10)
{
new pstring[128];
format(pstring,sizeof(pstring), "%s has won the round for his Team.",GetName(killerid));
SendClientMessageToAll(COLOR_CYAN, pstring);
if(CurrentGamemode == 5)
{
ChangeMode();
CurrentGamemode = 0;
}
ChangeMode();
CurrentGamemode++;
}
}

Glad2BeHere
23/03/2013, 06:08 AM
Show The coding for the following plz.... stock/ public w/e

ChangeMode();
CurrentGamemode++;

rangerxxll
23/03/2013, 06:19 AM
As requested.

forward ChangeMode();
public ChangeMode()
{
switch(CurrentGamemode)
{
case 0:
{
ServerMinutes = 9;
ServerSeconds = 59;
CurrentGamemode++;
}
case 1:
{
ServerMinutes = 9;
ServerSeconds = 59;
CurrentGamemode++;
}
case 2:
{
ServerMinutes = 9;
ServerSeconds = 59;
CurrentGamemode++;
}
case 3:
{
ServerMinutes = 9;
ServerSeconds = 59;
CurrentGamemode++;
}
case 4:
{
ServerMinutes = 9;
ServerSeconds = 59;
CurrentGamemode++;
}
case 5:
{
ServerMinutes = 9;
ServerSeconds = 59;
CurrentGamemode = 0;
}
}

Glad2BeHere
23/03/2013, 06:25 AM
tscore[gTeam[i]] == 10

This means that every player score needs to be 10 but u have
public OnPlayerDeath(playerid, killerid, reason)
{
if(gTeam[killerid] == TEAM_CT)
{
foreach(Player, i)
{
tscore[gTeam[i]] +=1;
}
}
if(gTeam[killerid] == TEAM_TE)
{
foreach(Player, i)
{
tscore[gTeam[i]] +=1;
}
}

rangerxxll
23/03/2013, 06:26 AM
What would you recommend I do?

Glad2BeHere
23/03/2013, 06:37 AM
//under on playerdeath
foreach(Player, i)
{
if(gTeam[killerid] == gTeam[i])
{
tscore[i] +=1;
}
}
//ChangeMode(); instead of
// try this SetTimer("ChangeMode", 1000, false);


What the purpose of this callback :? don't understand is it to reset timers

rangerxxll
23/03/2013, 06:45 AM
To change the map.

[ABK]Antonio
23/03/2013, 08:52 AM
public OnPlayerDeath(playerid, killerid, reason)
{
tscore[gTeam[killerid]]++;
if(tscore[gTeam[killerid]] == 10)
{
new pstring[128];
format(pstring,sizeof(pstring), "%s has won the round for his Team.",GetName(killerid));
SendClientMessageToAll(COLOR_CYAN, pstring);
ChangeMode();
}
}

forward ChangeMode();
public ChangeMode()
{
if(CurrentGamemode == 5) CurrentGamemode = 0;
else CurrentGamemode++;
ServerMinutes = 9;
ServerSeconds = 59;
}

What's actually being changed aside from some variable values (whats currentgamemode doing)