SA-MP Forums Archive
For Global Players (ALL) And not just a playerid. - 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: For Global Players (ALL) And not just a playerid. (/showthread.php?tid=108444)



For Global Players (ALL) And not just a playerid. - BP13 - 14.11.2009

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid, gTeam)
{
    if (pickupid == bomba)
    {
        if(BombArmed[gTeam] == false && DM21[playerid] == true) //with gteam in there I want all effects to apply to EVERYONE in the server and not just a player ID. This code is not working..
        {
            GetPlayerPos(playerid, BombX[playerid], BombY[playerid], BombZ[playerid]);
            GetXYInFrontOfPlayer(playerid, BombX[playerid], BombY[playerid], 0.7);
            SendClientMessage(playerid, 0x0066FFAA, "Bomb Planted (exploding in 10 seconds).");
            ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
            BombObject1[playerid] = CreateObject(1252, BombX[playerid], BombY[playerid], BombZ[playerid] - 0.8,270,0,0);
            BombTime = SetTimerEx("BombTimer",30000,0, "d", playerid);
            BombArmed[gTeam] = true;
        }
        else if(BombArmed[gTeam] == true && DM21[playerid] == true)
        {
            SendClientMessage(playerid, 0x0066FFAA, "The bomb is armed (30 Seconds) Do not let it become diffused!");
        }
        else if(BombArmed[gTeam] == true && DM20[playerid] == true)
        {
            ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
            Difusing = SetTimerEx("Difusingbomba",5000,0, "d", playerid);
      BombArmed[playerid] = false;
        }
        else if(BombArmed[gTeam] == false && DM20[playerid] == true)
        {
            SendClientMessage(playerid, 0x0066FFAA, "This is bombsite A. You must not let the terrorists arm it");
        }
        return 1;
    }
    if (pickupid == bombb)
    {
        if(BombArmed2[gTeam] == false && DM21[playerid] == true)
        {
            GetPlayerPos(playerid, BombX[playerid], BombY[playerid], BombZ[playerid]);
            GetXYInFrontOfPlayer(playerid, BombX[playerid], BombY[playerid], 0.7);
            SendClientMessage(playerid, 0x0066FFAA, "Bomb Planted (exploding in 10 seconds).");
            ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
            BombObject2[playerid] = CreateObject(1252, BombX[playerid], BombY[playerid], BombZ[playerid] - 0.8,270,0,0);
            BombTime2 = SetTimerEx("BombTimer2",30000,0, "d", playerid);
            BombArmed2[gTeam] = true;
        }
        else if(BombArmed2[gTeam] == true && DM21[playerid] == true)
        {
            SendClientMessage(playerid, 0x0066FFAA, "The bomb is armed (30 Seconds) Do not let it become diffused!");
        }
        else if(BombArmed2[gTeam] == true && DM20[playerid] == true)
        {
            ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
            BombSiteB = SetTimerEx("BombSiteBdiffuse",30000,0, "d", playerid);
      SendClientMessage(playerid, 0x0066FFAA, "Bomb B Diffused");
      BombArmed2[playerid] = false;
        }
        else if(BombArmed2[gTeam] == false && DM20[playerid] == true)
        {
            SendClientMessage(playerid, 0x0066FFAA, "This is bombsite B. You must not let the terrorists arm it");
        }
        return 1;
    }



Re: gteam help - GaGlets(R) - 14.11.2009

and pproblem is ?


Re: gteam help - dice7 - 14.11.2009

Just loop through all players


Re: gteam help - BP13 - 14.11.2009

Quote:
Originally Posted by dice7
Just loop through all players
Code to do this is? What should it look like?

- The problem is that I got it working with one playerid (the one who is doing the pickup) but to others it will not take into account that its already picked up.


Re: gteam help - BP13 - 14.11.2009

Please can I have some help. How do I use a bool or anything to make it happen for everyone not just the playerid.


Re: gteam help - BP13 - 14.11.2009

Ok maybe this will make it more clear. Where it says MAX_PLAYERS in this I want the condition to apply to all of the players and not just a playerid. How do I define and use this?

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if (pickupid == bomba)
    {
        if(BombArmed[MAX_PLAYERS] == false && DM21[playerid] == true)
        {
            GetPlayerPos(playerid, BombX[playerid], BombY[playerid], BombZ[playerid]);
            GetXYInFrontOfPlayer(playerid, BombX[playerid], BombY[playerid], 0.7);
            SendClientMessage(playerid, 0x0066FFAA, "Bomb Planted (exploding in 10 seconds).");
            ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
            BombObject1[playerid] = CreateObject(1252, BombX[playerid], BombY[playerid], BombZ[playerid] - 0.8,270,0,0);
            BombTime = SetTimerEx("BombTimer",30000,0, "d", playerid);
            BombArmed[MAX_PLAYERS] = true;
        }
        else if(BombArmed[MAX_PLAYERS] == true && DM21[playerid] == true)
        {
            SendClientMessage(playerid, 0x0066FFAA, "The bomb is armed (30 Seconds) Do not let it become diffused!");
        }
        else if(BombArmed[MAX_PLAYERS] == true && DM20[playerid] == true)
        {
            ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
            Difusing = SetTimerEx("Difusingbomba",5000,0, "d", playerid);
      BombArmed[MAX_PLAYERS] = false;
        }
        else if(BombArmed[MAX_PLAYERS] == false && DM20[playerid] == true)
        {
            SendClientMessage(playerid, 0x0066FFAA, "This is bombsite A. You must not let the terrorists arm it");
        }
        return 1;
    }
    if (pickupid == bombb)
    {
        if(BombArmed2[MAX_PLAYERS] == false && DM21[playerid] == true)
        {
            GetPlayerPos(playerid, BombX[playerid], BombY[playerid], BombZ[playerid]);
            GetXYInFrontOfPlayer(playerid, BombX[playerid], BombY[playerid], 0.7);
            SendClientMessage(playerid, 0x0066FFAA, "Bomb Planted (exploding in 10 seconds).");
            ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
            BombObject2[playerid] = CreateObject(1252, BombX[playerid], BombY[playerid], BombZ[playerid] - 0.8,270,0,0);
            BombTime2 = SetTimerEx("BombTimer2",30000,0, "d", playerid);
            BombArmed2[MAX_PLAYERS] = true;
        }
        else if(BombArmed2[MAX_PLAYERS] == true && DM21[playerid] == true)
        {
            SendClientMessage(playerid, 0x0066FFAA, "The bomb is armed (30 Seconds) Do not let it become diffused!");
        }
        else if(BombArmed2[MAX_PLAYERS] == true && DM20[playerid] == true)
        {
            ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 0, 0, 0, 0);
            BombSiteB = SetTimerEx("BombSiteBdiffuse",30000,0, "d", playerid);
      SendClientMessage(playerid, 0x0066FFAA, "Bomb B Diffused");
      BombArmed2[MAX_PLAYERS] = false;
        }
        else if(BombArmed2[MAX_PLAYERS] == false && DM20[playerid] == true)
        {
            SendClientMessage(playerid, 0x0066FFAA, "This is bombsite B. You must not let the terrorists arm it");
        }
        return 1;
    }