[SOLVED] Anti Teleport for life
#1

Hello people

I need to put a blocker to say that when a user wants to teleport with little life when you block it 70% of life ...

had tried

forward Float: GetHealth (playerid);
Float: GetHealth (playerid)
(
new Float: health;
GetPlayerHealth (playerid, health);
return health;
)

if (GetHealth (playerid) <99) return SendClientMessage (playerid, WHITE, "You can not teleport with less then 99 health!");

but I get error in the gm ....

Please help me to put that command or find another that works well

greetings and thanks for the help! xD

PD: Sorry my bad English, use the ****** translator :P
Reply
#2

What do you mean ? and put the PAWNO code in [/pawn]
Reply
#3

Check out the bits after the "//" comments

pawn Код:
if(strcmp(cmd, "/teleport", true) == 0)
{
  new Float: health; // You have to store the players health here
   
  GetPlayerHealth(playerid,health); // Here you can get the players current health
   
  if(health <= 99) return SendClientMessage(playerid,YOUR_COLOR_HERE,"Naw! You dont haz enough health"); // This will stop the command if his health is below 100
   
  // If the command goes this far then he can be teleported below!
  SetPlayerInterior(playerid,interior);
  SetPlayerPos(playerid,x,y,z);
  SetPlayerFacingAngle(playerid,angle);

  return 1;
}
Reply
#4



pawn Код:
if(strcmp(cmd, "/teleport", true) == 0)
{
  new health; // You have to store the players health here
   
  GetPlayerHealth(playerid,health); // Here you can get the players current health
   
  if(health <= 99) return SendClientMessage(playerid,YOUR_COLOR_HERE,"Naw! You dont haz enough health"); // This will stop the command if his health is below 100
   
  // If the command goes this far then he can be teleported below!
  SetPlayerInterior(playerid,interior);
  SetPlayerPos(playerid,x,y,z);
  SetPlayerFacingAngle(playerid,angle);

  return 1;
}
health isnt float
Reply
#5

um, yes it is
Reply
#6

Quote:
Originally Posted by dice7
um, yes it is
What he said ^^

See https://sampwiki.blast.hk/wiki/GetPlayerHealth
Reply
#7

Quote:
Originally Posted by dkmatias20
but I get error in the gm ....
What do you mean by that? Where do you get an error?
Reply
#8

Quote:
Originally Posted by brett7

pawn Код:
if(strcmp(cmd, "/teleport", true) == 0)
{
  new health; // You have to store the players health here
   
  GetPlayerHealth(playerid,health); // Here you can get the players current health
   
  if(health <= 99) return SendClientMessage(playerid,YOUR_COLOR_HERE,"Naw! You dont haz enough health"); // This will stop the command if his health is below 100
   
  // If the command goes this far then he can be teleported below!
  SetPlayerInterior(playerid,interior);
  SetPlayerPos(playerid,x,y,z);
  SetPlayerFacingAngle(playerid,angle);

  return 1;
}
health isnt float
thanks! code and use that served me!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)