SA-MP Forums Archive
[SOLVED] Anti Teleport for life - 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: [SOLVED] Anti Teleport for life (/showthread.php?tid=100297)



[SOLVED] Anti Teleport for life - dkmatias20 - 04.10.2009

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


Re: [HELP] Anti Teleport for life - Peter_Corneile - 04.10.2009

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


Re: [HELP] Anti Teleport for life - BMUK - 04.10.2009

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



Re: [HELP] Anti Teleport for life - brett7 - 04.10.2009



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



Re: [HELP] Anti Teleport for life - dice7 - 04.10.2009

um, yes it is


Re: [HELP] Anti Teleport for life - Blacklite - 04.10.2009

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

See https://sampwiki.blast.hk/wiki/GetPlayerHealth


Re: [HELP] Anti Teleport for life - MadeMan - 04.10.2009

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


Re: [HELP] Anti Teleport for life - dkmatias20 - 04.10.2009

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!