SA-MP Forums Archive
need simple help with this script - 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: need simple help with this script (/showthread.php?tid=585429)



need simple help with this script - LovelySoomro - 13.08.2015

this health system edit on onplayerupdate or onplayertakedamage plz help me


Re: need simple help with this script - iTakelot - 13.08.2015

Usage OnPlayerUpdate ex:

PHP код:
public OnPlayerUpdate(playerid){
    new 
Float:health;
    
GetPlayerHealth(playerid,health);
    if (
health 50.0) {SendClientMessage(playerid, -1#Warning);}
    
return true;




Re: need simple help with this script - LovelySoomro - 13.08.2015

but bro this is not attach with cmds how i attach this with cmd when player take damage and cmd stop work and sendclientmessage you cannot use this cmd while you in a fight or lossing health -_-


Re: need simple help with this script - LovelySoomro - 13.08.2015

samp hard scripters plz help me i am new learn scripting


Re: need simple help with this script - jlalt - 13.08.2015

lol this is example:
PHP код:
CMD:killme(playerid,params[]) {
new 
Float:health;
GetPlayerHealth(playerid,health);
if (
health 99.0) { SendClientMessage(playerid, -1"Your health full can't use this command :)");}
else {
SetPlayerHealth(playerid,0);
}
return 
1;

If you did not understand send your code and tell us what you want to make the code fail


Re: need simple help with this script - LovelySoomro - 13.08.2015

trying this


Re: need simple help with this script - LovelySoomro - 13.08.2015

forward dialog3(playerid);
public dialog3(playerid)
{
SetTimerEx( "dialog3", 15000, false, "i",playerid);
SendClientMessage(playerid,red,"[NGP]: you cannot use cmds while you in a fight or lossing health");
return 1;
}

i create this and attach with cmd but its not work


Re: need simple help with this script - jlalt - 13.08.2015

PHP код:
forward dialog3(playerid);
public 
dialog3(playerid)
{
new 
Float:health;
GetPlayerHealth(playerid,health);
if (
health 80.0) {
SendClientMessage(playerid,red,"[NGP]: you cannot use cmds while you in a fight or lossing health");
}else{
SetTimerEx"dialog3"15000false"i",playerid);
}
return 
1;




Re: need simple help with this script - LovelySoomro - 13.08.2015

but cmd working i want cmd not work when some one take damage for 10 sec


Re: need simple help with this script - jlalt - 13.08.2015

make your health 79 and try to use it

Edit:
On player get demage for 10 seconds will can't use this command and if died / 10 seconds left without demage will be able to use it
PHP код:

public OnPlayerTakeDamage(playeridissueridFloatamountweaponidbodypart)
{
    
SetPVarInt(playerid,"health22",1);
    
SetTimerEx"health21"10000false"i",playerid);
    return 
1;
}
public 
OnPlayerDeath(playeridkilleridreason)
{
SetPVarInt(playerid,"health22",0);
return 
1;
}
forward dialog3(playerid);
public 
dialog3(playerid)
{
if(
GetPVarInt(playerid"health22") == 1) {
SendClientMessage(playerid,-1,"[NGP]: you cannot use cmds while you in a fight or lossing health");
}else{
SetTimerEx"dialog3"15000false"i",playerid);
}
return 
1;
}
forward health21(playerid);
public 
health21(playerid)
{
SetPVarInt(playerid,"health22",0);
return 
1;

PS: if didn't work give me your command