[Solved]Give one team money and not the other...
#1

Ok!

The title says it all. At the end of the gamemode, how can i give one team some money and not the other?
Reply
#2

At the end of the gamemode (Whatever callback defines the end of a gamemode)

Add:
pawn Код:
//-------------------------[Winning Team]---------------------------------------------
for(new i = 0; i <= MAX_PLAYERS; i++)
{
  if(IsPlayerConnected(i) && GetPlayerTeam(i) == teamid)//Replace "teamid" with the variable determinning the winning team
  {
    GivePlayerMoney(i,amount);//Replace "amount" with the amount of money you want to reward each team member with
  }
  return 1;
}
Reply
#3

Quote:
Originally Posted by Redgie
At the end of the gamemode (Whatever callback defines the end of a gamemode)

Add:
pawn Код:
//-------------------------[Winning Team]---------------------------------------------
for(new i = 0; i <= MAX_PLAYERS; i++)
{
  if(IsPlayerConnected(i) && GetPlayerTeam[i] == teamid)//Replace "teamid" with the variable determinning the winning team
  {
    GivePlayerMoney(i,amount);//Replace "amount" with the amount of money you want to reward each team member with
  }
  return 1;
}
Cool!

Plz help me with the errors

Код:
C:\DOCUME~1\mani\Desktop\Server\GAMEMO~1\Armed.pwn(402) : error 028: invalid subscript (not an array or too many subscripts): "GetPlayerTeam"
C:\DOCUME~1\mani\Desktop\Server\GAMEMO~1\Armed.pwn(402) : warning 215: expression has no effect
C:\DOCUME~1\mani\Desktop\Server\GAMEMO~1\Armed.pwn(402) : error 001: expected token: ";", but found "]"
C:\DOCUME~1\mani\Desktop\Server\GAMEMO~1\Armed.pwn(402) : error 029: invalid expression, assumed zero
C:\DOCUME~1\mani\Desktop\Server\GAMEMO~1\Armed.pwn(402) : fatal error 107: too many error messages on one line
pawn Код:
public OnPlayerEnterCheckpoint(playerid)
{
  DisablePlayerCheckpoint(playerid);
  GivePlayerMoney(playerid,25000);
  GameTextForAll("~r~Agents Win",5000,0);
  for(new i = 0; i <= MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i) && GetPlayerTeam[i] == teamid)//Replace "teamid" with the variable determinning the winning team  THE ERRORS ARE ON THIS LINE!!!!
    {
        GivePlayerMoney(i,10000);//Replace "amount" with the amount of money you want to reward each team member with
    }
    }
    return 1;
}

P.S How can I define the winning team??
Reply
#4

My bad sorry, GetPlayerTeam[i] should be GetPlayerTeam(i)

Updated my post
Reply
#5

Quote:
Originally Posted by Redgie
My bad sorry, GetPlayerTeam[i] should be GetPlayerTeam(i)

Updated my post
Thnx, but I still get the same errors.

Here is the pastebin link...
http://pastebin.com/m3ae232a3

P.S: How can i make it check which the winning team is? Would I use a variable like
pawn Код:
new agents[MAX_PLAYERS];
?

And then when the that team wins...
pawn Код:
DisablePlayerCheckpoint(playerid);
  GivePlayerMoney(playerid,25000);
  GameTextForAll("~r~Agents Win ~n~~r~$10000",5000,0);
  agents[playerid] = 1;

Plz help me if Im wrong!
Reply
#6

Quote:
Originally Posted by Tigerbeast11
Quote:
Originally Posted by Redgie
My bad sorry, GetPlayerTeam[i] should be GetPlayerTeam(i)

Updated my post
Thnx, but I still get the same errors.

Here is the pastebin link...
http://pastebin.com/m3ae232a3

P.S: How can i make it check which the winning team is? Would I use a variable like
pawn Код:
new agents[MAX_PLAYERS];
?

And then when the that team wins...
pawn Код:
DisablePlayerCheckpoint(playerid);
  GivePlayerMoney(playerid,25000);
  GameTextForAll("~r~Agents Win ~n~~r~$10000",5000,0);
  agents[playerid] = 1;

Plz help me if Im wrong!
Woohoo! It compiles!

pawn Код:
for(new i = 0; i <= MAX_PLAYERS; i++)
{
  if(IsPlayerConnected(i) && GetPlayerTeam[i] == teamid)//Replace "teamid" with the variable determinning the winning team
  {
    GivePlayerMoney(i,amount);//Replace "amount" with the amount of money you want to reward each team member with
  }
  return 1;
}
Should be...

pawn Код:
for(new i = 0; i <= MAX_PLAYERS; i++)
{
  if(IsPlayerConnected(i) && GetPlayerTeam(i) == teamid)//Notice the (i) instead of [i]
  {
    GivePlayerMoney(i,amount);//Replace "amount" with the amount of money you want to reward each team member with
  }
  return 1;
}
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)