teleport to avoid death - 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)
+--- Thread: teleport to avoid death (
/showthread.php?tid=586615)
teleport to avoid death -
ahameed4755 - 23.08.2015
is there any filterscript that can stop teleport to avoid death
because i have a dm server and people can teleport to avoid death.
Re: teleport to avoid death -
Michael B - 23.08.2015
Try this:
PHP код:
public OnPlayerUpdate(playerid)
{
if(GetPlayerHealth(playerid) < 50);
AllowPlayerTeleport( playerid, 0 );
SendClientMessage(playerid, -1, "You cannot teleport anymore!");
return 1;
}
Do you have a /go command as well?
Re: teleport to avoid death -
Evocator - 23.08.2015
This function is deprecated.
Re: teleport to avoid death -
jlalt - 23.08.2015
hope you like this example:
PHP код:
#include a_samp
#include zcmd
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
SetPVarInt(playerid,"notp",1);
SetTimerEx( "notp", 10000, false, "i",playerid);
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
SetPVarInt(playerid,"notp",0);
return 1;
}
CMD:sfa(playerid,params[]){
if(GetPVarInt(playerid, "notp") == 1) SendClientMessage(playerid,-1,"ERROR: You can't tp at this moment");
else if(GetPVarInt(playerid, "notp") == 0) {
SetPlayerPos(playerid, -1657.5400,-164.9457,14.1484);
}
return 1;
}
forward notp(playerid);
public notp(playerid)
{
SetPVarInt(playerid,"notp",0);
return 1;
}
Re: teleport to avoid death -
J0sh... - 23.08.2015
Quote:
Originally Posted by jlalt
hope you like this example:
PHP код:
#include a_samp
#include zcmd
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
SetPVarInt(playerid,"notp",1);
SetTimerEx( "notp", 10000, false, "i",playerid);
return 1;
}
CMD:sfa(playerid,params[]){
if(GetPVarInt(playerid, "notp") == 1) SendClientMessage(playerid,-1,"ERROR: You can't tp at this moment");
SetPlayerPos(playerid, -1657.5400,-164.9457,14.1484);
return 1;
}
forward notp(playerid);
public notp(playerid)
{
SetPVarInt(playerid,"notp",0);
return 1;
}
|
Gets shot lots of times. (eg. MG) that will trigger the timer many times. Bad way sonny.
Re: teleport to avoid death -
jlalt - 23.08.2015
Quote:
Originally Posted by Jamester
Gets shot lots of times. (eg. MG) that will trigger the timer many times. Bad way sonny.
|
alrady tested and you wrong mate.
Re: teleport to avoid death -
J0sh... - 23.08.2015
Quote:
Originally Posted by jlalt
alrady tested and you wrong mate.
|
Nope, it clearly says when player gets hurt set this timer. You have no check that if the timer is already active.