For Global Players (ALL) And not just a playerid.
#1

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

and pproblem is ?
Reply
#3

Just loop through all players
Reply
#4

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.
Reply
#5

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

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


Forum Jump:


Users browsing this thread: 2 Guest(s)