Players doesnt lose health indoors
#1

How to make so that the players wouldnt lose health in certain interiors. their health would freeze when they enter an interior.
Reply
#2

You'd need a timer running that loops every player to check if they're in an interior, and then it would set there health to full..
Reply
#3

I have tried that already, is there any way without the timer?
Reply
#4

What's wrong with using timers?
Reply
#5

pawn Код:
SetPlayerHealth(playerid, Float:0x7F800000);
Reply
#6

no I dont want timer, I want something like "Friendly fire" used in some gang scripts, cause with timers I still die no matter what I do

..I dont want players health to be set to full though, I want their health to freeze to whatever health they had when they entered interior.
Reply
#7

Quote:
Originally Posted by Khelif
no I dont want timer, I want something like "Friendly fire" used in some gang scripts, cause with timers I still die no matter what I do

..I dont want players health to be set to full though, I want their health to freeze to whatever health they had when they entered interior.
how you want it, you need to use a fucking fast timer that you cant get killed by a minigun
Reply
#8

Why use a timer?
Код:
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
  if(newinteriorid == 0) 
  {
    SetPlayerTeam(playerid, NO_TEAM);
  }else if (oldinteriorid == 0)
  {
    SetPlayerTeam(playerid, 1);
  }
}
You could also set the players health to 10000, which is god mode, again without the need for a timer.
Reply
#9

whatever fuck! I want freeeze health! no timers.. FAST timer would only lag my server!

when a player enter interior or area, his health will freeze, thats it! no TIMEERS!
Reply
#10

No need for looping timers and all that....

All i did to get the same result was...

make a team for interiors. When a player enters an interior they get set onto a team, every player enering an interior getsset onto the same team...

So for example...

pawn Код:
#define INT_TEAM 202
pawn Код:
public OnPlayerInteriorChange(playerid,newinteriorid,oldinteriorid)
{
   if(newinteriorid > 0) //If the player enters an interior...
   {
     SetPlayerTeam(playerid, INT_TEAM);
   }

   if(newinteriorid == 0)//if the player leaves the interior and goes back outside...
   {
     SetPlayerTeam(playerid,playerid);//Unique because no player can have the same playerid... so they're all on sepperate teams
   }

return 1;
}
Even with this the players can stall take damage form toher players, but ONLY when leaving the interior.. So i added a 1 second timer to delay the team change from INT_TEAM to playerid. That then made it impossible to damage the player while inside or leaving an interior..

so then it would be...

pawn Код:
public OnPlayerInteriorChange(playerid,newinteriorid,oldinteriorid)
{
   if(newinteriorid > 0) //If the player enters an interior...
   {
     SetPlayerTeam(playerid, INT_TEAM);
   }

   if(newinteriorid == 0)
   {
    IntChangeDelay[playerid] = SetTimerEx("ChangeInt", 1000, 0, "i", playerid);
   }

return 1;
}
pawn Код:
forward ChangeInt(playerid);
public ChangeInt(playerid)
{
    SetPlayerTeam(playerid, playerid);
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)