SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Help Archive

 
 
Thread Tools Display Modes
Old 01/04/2009, 12:35 PM   #1
Outbreak
Huge Clucker
 
Join Date: Dec 2008
Posts: 303
Reputation: 3
Default AllowInteriorWeapons....But disable damage...

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.
Outbreak is offline  
Old 01/04/2009, 01:11 PM   #2
Frank_Tesla
Little Clucker
 
Join Date: Nov 2008
Posts: 40
Reputation: 0
Default Re: AllowInteriorWeapons....But disable damage...

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

Code:
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;
}

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

Frank_Tesla is offline  
Old 01/04/2009, 01:15 PM   #3
Frank_Tesla
Little Clucker
 
Join Date: Nov 2008
Posts: 40
Reputation: 0
Default Re: AllowInteriorWeapons....But disable damage...

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.
Frank_Tesla is offline  
Old 01/04/2009, 01:31 PM   #4
Outbreak
Huge Clucker
 
Join Date: Dec 2008
Posts: 303
Reputation: 3
Default Re: AllowInteriorWeapons....But disable damage...

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.
Outbreak is offline  
Old 01/04/2009, 01:39 PM   #5
Frank_Tesla
Little Clucker
 
Join Date: Nov 2008
Posts: 40
Reputation: 0
Default Re: AllowInteriorWeapons....But disable damage...

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:

Code:
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.
Frank_Tesla is offline  
Old 01/04/2009, 04:20 PM   #6
Outbreak
Huge Clucker
 
Join Date: Dec 2008
Posts: 303
Reputation: 3
Default Re: AllowInteriorWeapons....But disable damage...

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
Outbreak is offline  
Old 01/04/2009, 04:24 PM   #7
Mikep
High-roller
 
Join Date: Apr 2008
Posts: 1,042
Reputation: 10
Default Re: AllowInteriorWeapons....But disable damage...

Just set their health to 10000 when they go in, no need for timers.
Mikep is offline  
Old 01/04/2009, 05:49 PM   #8
Outbreak
Huge Clucker
 
Join Date: Dec 2008
Posts: 303
Reputation: 3
Default Re: AllowInteriorWeapons....But disable damage...

its ok, done it. its solved..

pawn Code:
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;
}
Outbreak is offline  
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
AllowInteriorWeapons(); possible bug? pagie1111 Help Archive 9 05/10/2009 01:07 AM
AllowInteriorWeapons Lightning[SV] Help Archive 8 09/09/2009 11:44 AM
AllowInteriorWeapons ded Help Archive 2 04/09/2009 12:18 PM
AllowInteriorWeapons DevilRevenge Help Archive 0 14/03/2009 01:07 PM


All times are GMT. The time now is 04:25 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.