Simple question, Related to PlayerHealth
#1

I want to do something like, If the health of the player = 0, Then set his pos to a position that i want
Reply
#2

pawn Код:
new Float:hp;
GetPlayerHealth(playerid, hp);
if(hp <= 0)
{
    SetPlayerPos(playerid, X, Y, Z);
}
Reply
#3

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

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

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
(playeridhp);
if(
hp <= 0)
{
// now because you want them to tp back to the /dm place:
SetPlayerPos(playeridx,y,z);
SetPlayerHealth(playerid5); // change the 5 to what you want them to have when they are tped to that place.

Reply
#6

but that will tp them to the place whenever he dies, I want if he joined the /dm
Reply
#7

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

alright, where shall i put that ? Under my command ?
Reply
#9

Delete this, Wrongly posted
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)