SA-MP Forums Archive
Hmphhh - 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: Hmphhh (/showthread.php?tid=136900)



Hmphhh - RawrTheory - 27.03.2010

Alright so I'm making it so whenever you come in as a passenger in a specific vehicle, let's say an ambulance it sets your health back to full if its not at 100.0, and if it is full, it kicks you out. But for some strange reason it doesn't work. Any help appreciated.

Код:
new Float:health;
	    	GetPlayerHealth(playerid, health);
	    	if(health < 100)
	    	{
	     	 	SetPlayerHealth(playerid, 100);
					
				}
				else
				if(health == 100)
				{
				  	RemovePlayerFromVehicle(playerid);
				}



Re: Hmphhh - Tenshi - 27.03.2010

// Try

~ smaller code:
Код:
	new Float:health;
	GetPlayerHealth(playerid, health);
	if(health == 100){ return RemovePlayerFromVehicle(playerid);}
	if(health < 100) { return SetPlayerHealth(playerid, 100); }
~ basic coding:
Код:
	new Float:health;
	GetPlayerHealth(playerid, health);
	
	if(health == 100)
  {
		RemovePlayerFromVehicle(playerid);
		return 1;
	}

	if(health < 100)
	{
		SetPlayerHealth(playerid, 100);
		return 1;
	}
... both are same.


Re: Hmphhh - Joe Staff - 27.03.2010

Which means you're not fixing anything :P

pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
  if(newstate==PLAYER_STATE_PASSENGER)
  {
    if(GetVehicleModel(GetPlayerVehicleID(playerid))==416)
    {
      new Float:tmphp;
      GetPlayerHealth(playerid,tmphp);
      if(hp<100.0)SetPlayerHealth(playerid,100.0);
      RemovePlayerFromVehicle(playerid);
    }
  }
  return 1;
}



Re: Hmphhh - Tenshi - 27.03.2010

SHOWOFF (j/k) but this is more of a understanding, since "RawrTheory" didn't post if it was placed that way


Re: Hmphhh - RawrTheory - 27.03.2010

Quote:
Originally Posted by Tenshi ™
// Try

~ smaller code:
Код:
	new Float:health;
	GetPlayerHealth(playerid, health);
	if(health == 100){ return RemovePlayerFromVehicle(playerid);}
	if(health < 100) { return SetPlayerHealth(playerid, 100); }
~ basic coding:
Код:
	new Float:health;
	GetPlayerHealth(playerid, health);
	
	if(health == 100)
  {
		RemovePlayerFromVehicle(playerid);
		return 1;
	}

	if(health < 100)
	{
		SetPlayerHealth(playerid, 100);
		return 1;
	}
... both are same.
Doesn't work.
It's the same code except you just added true returns.


Re: Hmphhh - Tenshi - 27.03.2010

Quote:
Originally Posted by Joe Staff
Which means you're not fixing anything :P

pawn Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
  if(newstate==PLAYER_STATE_PASSENGER)
  {
    if(GetVehicleModel(GetPlayerVehicleID(playerid))==416)
    {
      new Float:tmphp;
      GetPlayerHealth(playerid,tmphp);
      if(hp<100.0)SetPlayerHealth(playerid,100.0);
      RemovePlayerFromVehicle(playerid);
    }
  }
  return 1;
}
What about this? you tryed it?

show us a little bit more of the code you are trying to do ...
if anything, post here...


Re: Hmphhh - RawrTheory - 27.03.2010

That didn't work either. Here's the code at the moment.

pawn Код:
if(newstate == PLAYER_STATE_PASSENGER)
        {
            if(GetVehicleModel(GetPlayerVehicleID(playerid))==416)
        {
            new Float:health;
            GetPlayerHealth(playerid, health);
            if(health < 100.0)SetPlayerHealth(playerid, 100); SendClientMessage(playerid, 0x8000FFFF, "Doctor Kit: There ya go! Hello Kitty should do the job."); RemovePlayerFromVehicle(playerid);
            SendClientMessage(playerid, 0xDC500FF, "Doctor Kit: You're fine! Get back in the there.");
                RemovePlayerFromVehicle(playerid);
            }

        }



Re: Hmphhh - Tenshi - 27.03.2010

Код:
public OnPlayerStateChange(playerid,newstate,oldstate)
{
	new vehicle; vehicle = GetPlayerVehicleID(playerid); new ModelID = GetVehicleModel(vehicle);
	#define MEDICVEH ModelID == 416
	if(MEDICVEH && newstate == PLAYER_STATE_PASSENGER)
  {
	  SetPlayerHealth(playerid, 100); RemovePlayerFromVehicle(playerid);
  }

  return 1;
}
no matter whats the health it will fix it to 100% and kicks the player out, whaaapaaa!