SA-MP Forums Archive
[SOLVED] Don't know why it didn't work - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: [SOLVED] Don't know why it didn't work (/showthread.php?tid=116446)



[SOLVED] Don't know why it didn't work - TheChaoz - 28.12.2009

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?


Re: Don't know why it didn't work - Bearfist - 28.12.2009

What do you want to do ?

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

LG Bearfist


Re: Don't know why it didn't work - TheChaoz - 28.12.2009

i want do disable damage on interiors



Re: Don't know why it didn't work - Bearfist - 28.12.2009

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


Re: Don't know why it didn't work - TheChaoz - 28.12.2009

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


Re: Don't know why it didn't work - Bearfist - 28.12.2009

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.



Re: Don't know why it didn't work - Dark_Kostas - 28.12.2009

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



Re: Don't know why it didn't work - TheChaoz - 28.12.2009

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


Re: Don't know why it didn't work - Dark_Kostas - 28.12.2009

look my example above


Re: Don't know why it didn't work - fsnameless - 28.12.2009

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