[SOLVED] Don't know why it didn't work
#1

i want to disable damage on interiors, soo i made this
pawn Код:
public OnPlayerInteriorChange(playerid,newinteriorid,oldinteriorid)
{
    new Float:Health;
    GetPlayerHealth(playerid, Health);

    if((GetPlayerInterior(playerid) > 0))
  {
    SetPlayerHealth(playerid, 10000000);
    }
    if((GetPlayerInterior(playerid) == 0))
    {
        SetPlayerHealth(playerid, Health);
    }

    return 1;
}
but if u have for example 50.0 of health, when u enter an interior and then go out of it, ur health= 100.0 :S
can someone help me with this?
Reply
#2

What do you want to do ?

.. and your health can't be more than 100.

LG Bearfist
Reply
#3

i want do disable damage on interiors
Reply
#4

which damage on interiors ?
.. there isn't a damage on an interior =O
Reply
#5

sorry for my bad english
i mean
that if u shoot someone (in an interior) the one who get the shoot don't get damage and his health keep been of 100.0
and when u go out u get the same health that u have when u get inside.
Esample:
i get inside the burgershoot with health 50.0
someone shoot at me inside but mi health inside keep been of 100.0
i go outside he burguershoot with health 50.0
Reply
#6

Alright better explanation xD
...
you always have an Interior .. i presume you mean if your Interior isn't 0 .. because your interior
is 0 when you aren't in any house or room .

you could use this function
Код:
public OnPlayerInteriorChange(playerid,newinteriorid,oldinteriorid)
{
  return 1;
}
and activate a Godmode if the newinteriorid is not equal to 0.
Reply
#7

pawn Код:
new Float:OldArmour[MAX_PLAYERS];//Top of your script

public OnPlayerInteriorChange(playerid,newinteriorid,oldinteriorid)
{
    if(newinteriorid > 0)
    {
        GetPlayerArmour(playerid, OldArmour[playerid]);
        SetPlayerArmour(playerid, 10000000);
    }
    else
    {
        SetPlayerArmour(playerid, OldArmour[playerid]);
    }
    return 1;
}
Reply
#8

the problem isn't the godmode
i made one, and it work

Quote:

i get inside the burgershoot with health 50.0
someone shoot at me inside but mi health inside keep been of 100.0

up here i'm ok, my problem is:
Quote:

i go outside he burguershoot with health 50.0

don't know how to set the player old health
Reply
#9

look my example above
Reply
#10

i have this code below to disable weapons in the interiors

pawn Код:
public OnPlayerUpdate(playerid)
{  
    if(GetPlayerInterior(playerid) != 0 && GetPlayerWeapon(playerid) != 0) {
      SetPlayerArmedWeapon(playerid,0); // fists
      return 0; // no syncing until they change their weapon
    }
return 1;
}
or if you want guns you could do

pawn Код:
public OnPlayerUpdate(playerid)
{   new Float:Health;
    new hpin = GetPlayerHealth(playerid, Health);
    new inthp = GetPlayerInterior(playerid);
    if(inthp > 0) {
    GetPlayerHealth(playerid, Health);
    }
    else
    {
    if(hpin > 100) {
    SetPlayerHealth(playerid, 100);
    }
    return 1;
    }
    return 1;
    }
Note: Number Two Not Tested
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)