team problem. - 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)
+--- Thread: team problem. (
/showthread.php?tid=452456)
team problem. -
kurt225 - 21.07.2013
Hello everyone,
On my server there are two teams :
Mercenaries and
Ninjas.
My problem is, when a ninja enters the last checkpoint, I want all Mercs to be teleported to another location.
I tried :
Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
if(gTeam[playerid] == NINJA)
{
if(checkpointid == ordi3)
{
SendClientMessage(playerid,0x00FF0000, "gate opened..");
SetPlayerPos(gTeam[playerid] = MERC, 211.8117,1811.8708,21.8672);
}
}
I also tried this :
Код:
public OnPlayerEnterDynamicCP(playerid, checkpointid)
{
if(gTeam[playerid] == NINJA)
{
if(checkpointid == ordi3)
{
SendClientMessage(playerid,0x00FF0000, "gate opened..");
if(gTeam[playerid] == MERC)
{
SetPlayerPos(playerid, 211.8117,1811.8708,21.8672);
}
}
}
.... Still not working.. Help
Re: team problem. -
arakuta - 21.07.2013
You have to pass a loop through all players, and check if the passed player is from the team you want
try this:
pawn Код:
// Where you want to teleport mercenaries
for(new a; a < MAX_PLAYERS; ++a)
{
if(IsPlayerConnected(a))
{
if(gTeam[a] == MERC)
SetPlayerPos(a,x,y,z);
}
}
If you want more information, read this:
https://sampwiki.blast.hk/wiki/Loops
Re: team problem. -
kurt225 - 21.07.2013
Yipee that works ! Thx !!!!