SA-MP Forums Archive
Player bleeding - 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: Player bleeding (/showthread.php?tid=331586)



Player bleeding - ChristofferHoffmann - 05.04.2012

Hello, I've asked before about a bleeding system. I have the ideas, but I simply need some help to make them realistic.

I'm trying to learn some of the basics of scripting, and together with that I had an idea for a bleeding system. The idea was that when the players health got below.. let's say 30 - then a timer would start, and he would start loosing health until he gets /heal'ed or gets to a sprunk and get his health over 30. If he of course gets it over 30, it'll stop. I suppose I have to somehow make it check "OnPlayerUpdate" if his health starts to go below 30 and then it should implement the timer which will make him loose health, let's say every 10-15 second.

Could someone provide me with some code, and explain how It'll work? Or can someone give me some tips on how to get started.


Re: Player bleeding - Aira - 05.04.2012

I'm really sorry but i can't provide any Code as i am also in a learning stage within the part of "OnPlayerUpdate".
But i suggest you start on browsing for some Filterscripts which is similar or which has OnPlayerUpdate that gets the persons ARMOR or.. Speaking of that lemme get a link of a FS i know..

https://sampforum.blast.hk/showthread.php?pid=1010610#pid1010610
There


Re: Player bleeding - Harish - 05.04.2012

hi create a timer and check the health and do some process..


Re: Player bleeding - Harish - 05.04.2012

like
pawn Код:
SetTimerEx("bleedchk",10000,1,"d",playerid) //on playerconnect
forward bleedchk(playerid);
public bleedchk(playerid)
{
new float:hp;
 GetPlayerHealth(playerid,hp);
if(hp<=30)
SetPlayerHealth(playerid,hp-5);
SendClientMessage(playerid,0xFFFFF,"You are bleeding");
}



Re: Player bleeding - Aira - 05.04.2012

Quote:
Originally Posted by Harish
Посмотреть сообщение
like
pawn Код:
SetTimerEx("bleedchk",10000,1,"d",playerid) //on playerconnect
forward bleedchk(playerid);
public bleedchk(playerid)
{
new float:hp;
GetPlayerHealth(playerid,hp);
if(hp<=30)
SetPlayerHealth(playerid,hp-5);
SendClientMessage(playerid,0xFFFFF,"You are bleeding");
}
By the way umm Thread Starter,
SetTimerEx("bleedchk",10000,1,"d",playerid) - Thats 10 Seconds.


Re: Player bleeding - Ezay - 05.04.2012

Ugh, Everyone's Too Quick fo' Me

@Harish Thanks for Helping this Member

What Harish Said Will Work,

Bassically Setting a Timer,
Using a Forward to Drop the Health Based on the Timer
The Time Format is in Milliseconds, I'd Think You'd Know.
Код:
600000 = 60 Minutes
Cheers,

Ezay \o/


Re: Player bleeding - ChristofferHoffmann - 05.04.2012

I'm starting to understand the basics behind it, thank you I'll try to play around with the code and see if I can get it to work Much appreciate the help from all of you


Re: Player bleeding - Ezay - 05.04.2012

If you Have Any Issues, Feel Free to Post Back Here Again.

Cheers

Ezay \o/


Re: Player bleeding - ChristofferHoffmann - 05.04.2012

I get

Код:
C:\Users\Christoffer\Documents\Modtagne filer\samp03\samp03\gamemodes\NGRP_nomysql.pwn(7797) : warning 213: tag mismatch
I get that warning from the code


Re: Player bleeding - Ezay - 05.04.2012

Thats Fine, Warnings, Dont Really Matter (With That Said They CAN DO WEIRD THINGS TO YOUR SCRIPT)

Tag Mismatch Usually Means That a Tag is in the Wronge Place