Hmphhh
#1

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);
				}
Reply
#2

// 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.
Reply
#3

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;
}
Reply
#4

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

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.
Reply
#6

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...
Reply
#7

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

        }
Reply
#8

Код:
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!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)