Posts: 69
Threads: 24
Joined: Aug 2015
Reputation:
0
Hello, I have just got back to scripting and i know how to go about this but i do not want to risk messing anything up,
i want to add when a player is at 20 hp it will send a message saying Low Health but i fear if i script it the way im thinking it will be longer and i think it will spam at each hp under 20 low health. Please help.
Posts: 539
Threads: 30
Joined: Feb 2015
Reputation:
0
Set a timer ongamemodeinit and on the public function check if the player has 20 hp and if so do whatever you want there.
Posts: 69
Threads: 24
Joined: Aug 2015
Reputation:
0
So like, I made a Timer, and a forward, and i just need help with the public function.
CheckLowHP = SetTimer("CheckLowHP", 900000, 1);
forward CheckLowHP();
Posts: 249
Threads: 26
Joined: Jan 2011
Reputation:
0
Adding a timer is completly unnecessary!
Why wouldnt you do a check at his health at OnPlayerTakeDamage instead?
Posts: 69
Threads: 24
Joined: Aug 2015
Reputation:
0
Thats what i was thinking of but i thought it would spam Low Health at every hp lower than 20. could you explain?
Posts: 249
Threads: 26
Joined: Jan 2011
Reputation:
0
Do something like this.
new lowhealth [MAX_PLAYERS]
public OnPlayerSpawn
lowhealth[playerid]=0;
public OnPlayerTakeDamage
Check if health is below 20
If so
Check if lowhealth[playerid]==0
If so
Send a text message and lowhealth[playerid]=1;
Posts: 1,147
Threads: 109
Joined: Jul 2013
Reputation:
0
Use Sellize's code, that'll work.