SA-MP Forums Archive
[Solved]Give one team money and not the other... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [Solved]Give one team money and not the other... (/showthread.php?tid=107007)



[Solved]Give one team money and not the other... - Tigerbeast11 - 07.11.2009

Ok!

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


Re: Give one team money and not the other... - Redgie - 07.11.2009

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;
}



Re: Give one team money and not the other... - Tigerbeast11 - 07.11.2009

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??



Re: [Please Help]Give one team money and not the other... - Redgie - 07.11.2009

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

Updated my post


Re: [Please Help]Give one team money and not the other... - Tigerbeast11 - 08.11.2009

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!



Re: [Please Help]Give one team money and not the other... - Tigerbeast11 - 08.11.2009

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;
}