AllowInteriorWeapons....But disable damage...
#1

I've been working on disabling interior weapon damage but allowing weapons inside interiors..

I need this for a DM thing im going to do in one interior, where i'll enable weapon damage..

My problem is i have it so a player goes into an interior, their health + armour is saved...

Once in the interior, their health and armour goes to 10000 on a timer.. then when they exit the interior their health and armour is restored back to before they went in to the interior..

This means that if a player goes into burger shot, they cant heal themselves, or in ammunation they cant buy armour..

So how can i make it so a player goes into an interior, but weapon damage, including nades, is disabled? Without the players health or armour being effected in any way.
Reply
#2

If you are using a custom door script it will be fairly easy:

Код:
forward OneSecondTimer();
new Float:HealthUponEntry[MAX_PLAYERS];
new Float:ArmourUponEntry[MAX_PLAYERS];
new PlayerIsInvincible[MAX_PLAYERS];

public OnGameModeInit()  
{
  SetTimer("OneSecondTimer",60000, true);
}

public OnPlayerConnect(playerid)
{
  HealthUponEntry[playerid] = 0.00;
  ArmourUponEntry[playerid] = 0.00;
  PlayerIsInvincible[playerid] = 0;
}

public OneSecondTimer()
{
  for(new i = 0; i < MAX_PLAYERS; i++;)
  {
    if(PlayerIsInvincible[i] == 1)
    {
       SetPlayerHealth(playerid,220);
       SetPlayerArmour(playerid,220);
    }
  }
  return 0;
}

----------------------------------------------

if(strcmp(text, "/enter", true)
{ 
  if(playerisatentrance ) // PlayerToPoint etc
  {
    new Float:health;
    GetPlayerHealth(playerid,health);
    HealthUponEntry[playerid] = health;
    new Float:armour;
    GetPlayerArmour(playerid,armour);
    ArmourUponEntry[playerid] = armour;
    PlayerIsInvincible[playerid] = 1;
  }
  return 1;
}

if(strcmp(text, "/exit", true)
{ 
  if(playerisatexit ) // PlayerToPoint etc
  {
    PlayerIsInvincible[playerid] = 0;
    SetPlayerHealth(playerid,HealthUponEntry[playerid]);
    SetPlayerArmour(playerid,ArmourUponEntry[playerid];
  }
  return 1;
}

----------------------------------------------

Reply
#3

I'm fairly sure you can't successfully set a player's health to 10,000. Which is why I made the timer. I could be wrong.
Reply
#4

i've done sometihng similar to that, but its not what im looking for... I've set the player to 10000 health + armour on a 500ms timer so they cant be damaged..

I want it so their health and armour isnt effected in any way... Stays the same as it is weather they're in an interior or not..

I've thought of another idea, just looking to see if theres any code that would help.. To do with teams and anti team killing.
Reply
#5

I was under the impression going through a door triggers this event. But that everywhere outside this room their helath and armor is normal? Incorrect? You could freeze their Health and Armor so that it appears to not change:

Код:
public OneSecondTimer()
{
  for(new i = 0; i < MAX_PLAYERS; i++;)
  {
    if(PlayerIsInvincible[i] == 1)
    {
       SetPlayerHealth(playerid,HealthUponEntry[playerid]);
       SetPlayerArmour(playerid,ArmourUponEntry[playerid]);
    }
  }
  return 0;
}
And change it to a 100 millisecond timer. You can't tell the script to actually freeze a player's health and armor.Any real solution would be an illusion to the player. But I'm no longer familiar with what you want, since I think you are describing it ambiguously and you haven't provided any sample code.
Reply
#6

Yerah i had it under OnPlayerInteriorChange. Thent hat triggered a timer. and the timer was giving them 10000 health and armour... then as they left once outside their health and armour would return to the same as it was before they went in.

I've done it different now.. Set the players onto the same teams. So they cant kill eachother in interiors, then change them to individual teams when they leave the interior.

Thanks though for your replies
Reply
#7

Just set their health to 10000 when they go in, no need for timers.
Reply
#8

its ok, done it. its solved..

pawn Код:
public OnPlayerInteriorChange(playerid,newinteriorid,oldinteriorid)
{

    if(newinteriorid > 0)
    {
      if(PlayerInBF[playerid] == 1)
      {
        SetPlayerTeam(playerid, playerid);
         }
            else
             {
                 SetPlayerTeam(playerid, TEAM_INTERIOR);
        }
    }
   
    if(newinteriorid == 0)
    {
        IntChangeDelay[playerid] = SetTimerEx("ChangeInt", 1000, 0, "i", playerid);
    }

  return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)