SA-MP Forums Archive
Team problems - 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: Team problems (/showthread.php?tid=101300)



Team problems - SlashPT - 09.10.2009

hey guys im having a little problem so i have my automatic gates with one team but when it have me in team it open but if i put two players in the team it only open for ultimate guy i puted in team i think the team can only have one player so i think if with one define or something can define team to more players so it maybe can start works

thanks for see


Re: Team problems - SlashPT - 10.10.2009

so ppl no one? plz help me


Re: Team problems - dice7 - 10.10.2009

pawn Код:
if(gTeam[playerid] == team_something)
{
  open gate
}
or you could show your code


Re: Team problems - SlashPT - 10.10.2009

public CheckGate4()
{
for(new i = 0; i < GetMaxPlayers(); i++)
if(PlayerInfo[i][pTeam] == 2 || (PlayerInfo[i][pTeam] == 100))
{
if(!IsPlayerConnected(i)) continue;
if(PlayerToPoint(10.0, i, 2335.227, 2443.460, 8.261) && OpenGate[i] == 0)
{
MoveObject(PoliciaLV2, 2335.227, 2443.460, -2.261, 5);
OpenGate[i] = 1;
}
else if(!PlayerToPoint(10.0, i, 1881.8, 2152.2, 10. && OpenGate[i] == 0)
{
MoveObject(PoliciaLV2, 2335.227, 2443.460, 8.261, 5);
OpenGate[i] = 0;
}
}
}



Re: Team problems - Virtual1ty - 10.10.2009

use pawn tags


Re: Team problems - Virtual1ty - 10.10.2009

Quote:
Originally Posted by Voute_Foder
public CheckGate4()
{
for(new i = 0; i < GetMaxPlayers(); i++)
if(PlayerInfo[i][pTeam] == 2 || (PlayerInfo[i][pTeam] == 100))
{
if(!IsPlayerConnected(i)) continue; - ??
if(PlayerToPoint(10.0, i, 2335.227, 2443.460, 8.261) && OpenGate[i] == 0)
{
MoveObject(PoliciaLV2, 2335.227, 2443.460, -2.261, 5);
OpenGate[i] = 1;
}
else if(!PlayerToPoint(10.0, i, 1881.8, 2152.2, 10. && OpenGate[i] == 0)
{
MoveObject(PoliciaLV2, 2335.227, 2443.460, 8.261, 5);
OpenGate[i] = 0;
}
}
}
also i dont get this line:
if(!IsPlayerConnected(i)) continue;

so basically what you are saying is : if the player isnt connected, continue?? ??


Re: Team problems - dice7 - 10.10.2009

Learn Pawn, then help people -.-'

pawn Код:
if(PlayerToPoint(10.0, i, 2335.227, 2443.460, 8.261) && OpenGate == 0) /*if gate is closed, open it (put value to 1)*/
    {
      MoveObject(PoliciaLV2, 2335.227, 2443.460, -2.261, 5);
     OpenGate = 1;
    }
    else if(!PlayerToPoint(10.0, i, 1881.8, 2152.2, 10.00 && OpenGate == 0)/*else if gate is closed, close it ???*/
    {
      MoveObject(PoliciaLV2, 2335.227, 2443.460, 8.261, 5);
      OpenGate = 0;
Also, your PlayerInfo value is universal for all players or what ?
You need to have it indexed by playerids, so every player will have its own info
Like:
pawn Код:
PlayerInfo[playerid][pTeam] == 2



Re: Team problems - SlashPT - 10.10.2009

i only copied for the wiki samp it have this


Re: Team problems - SlashPT - 10.10.2009

enum pInfo
{
pPassword[128],
pKills,
pDeaths,
pCash,
pBank,
pTeam,
pBanned,
};

new PlayerInfo[MAX_PLAYERS][pInfo];


Re: Team problems - SlashPT - 10.10.2009

so i removed this
pawn Код:
else if(!PlayerToPoint(10.0, i, 1881.8, 2152.2, 10.00 && OpenGate == 0)/*else if gate is closed, close it ???*/
to this

pawn Код:
else if(!PlayerToPoint(10.0, i, 1881.8, 2152.2, 10.00))
but continue dont working