team problem.
#1

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
Reply
#2

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
Reply
#3

Yipee that works ! Thx !!!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)