Simple question, Related to PlayerHealth -
Le3aT - 21.05.2014
I want to do something like, If the health of the player = 0, Then set his pos to a position that i want
Re: Simple question, Related to PlayerHealth -
SickAttack - 21.05.2014
pawn Код:
new Float:hp;
GetPlayerHealth(playerid, hp);
if(hp <= 0)
{
SetPlayerPos(playerid, X, Y, Z);
}
Re: Simple question, Related to PlayerHealth -
Abagail - 21.05.2014
Well if the players health is 0 then they should be dying anyway. In that case, why not use the OnPlayerDeath function? As said in your statement you are trying to set their position whilst their HP is 0. You can do it like this,
When OnPlayerDeath is called teleport them to the coordinates. If you want them to have low health whilst at the place just set their health low to something like 20, or even 5 if applicable.
What I'm trying to say:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
if(playerid == killerid) return 0;
SetPlayerPos(playerid, -, -, -);
return 1;
}
Re: Simple question, Related to PlayerHealth -
Le3aT - 21.05.2014
Alright, I'm newbie. I made a place called /dm that gives health and armour.. etc, But if he dies, He has to go to /dm again, Which is annoying. So, I thought that if he gets 0 health, then he tp's back to that place
Re: Simple question, Related to PlayerHealth -
K9IsGodly - 21.05.2014
Quote:
Originally Posted by Le3aT
Alright, I'm newbie. I made a place called /dm that gives health and armour.. etc, But if he dies, He has to go to /dm again, Which is annoying. So, I thought that if he gets 0 health, then he tp's back to that place
|
PHP код:
new Float:hp
GetPlayerHealth(playerid, hp);
if(hp <= 0)
{
// now because you want them to tp back to the /dm place:
SetPlayerPos(playerid, x,y,z);
SetPlayerHealth(playerid, 5); // change the 5 to what you want them to have when they are tped to that place.
}
Re: Simple question, Related to PlayerHealth -
Le3aT - 21.05.2014
but that will tp them to the place whenever he dies, I want if he joined the /dm
Re: Simple question, Related to PlayerHealth -
K9IsGodly - 21.05.2014
Quote:
Originally Posted by Le3aT
but that will tp them to the place whenever he dies, I want if he joined the /dm
|
If you plugin the co-ordinates of your /dm area into the command I gave you it will work, because it will be tping him to the place and then it will set his health to 5. If you want him to be set back there with more health, armor, and guns, then just add that in, assuming you know how.
I.E.
SetPlayerArmor
SetPlayerHealth
GivePlayerWeapon
Re: Simple question, Related to PlayerHealth -
Le3aT - 21.05.2014
alright, where shall i put that ? Under my command ?
Re: Simple question, Related to PlayerHealth -
Le3aT - 21.05.2014
Delete this, Wrongly posted