Bleed system
#1

can someone teach me type, when the player takes damage, it starts bleeding? I tried to make a code already in "OnPlayerTakeDamage" but my player taking damage while riding ...
Reply
#2

Quote:
Originally Posted by StarPeens
Посмотреть сообщение
can someone teach me type, when the player takes damage, it starts bleeding? I tried to make a code already in "OnPlayerTakeDamage" but my player taking damage while riding ...
Well, actually you must choose another callback.

You can take OnPlayerUpdate or make a timer.

Код:
new Float:old_h[MAX_PLAYERS]; //Write it @the top
public OnPlayerUpdate(playerid)
{
    new Float:h;
    GetPlayerHealth(playerid,h);
    if(h < old_h[playerid])
    {
        old_h[playerid] = h;
        //Here start the Blood!
    }
    else if(h != old_h[playerid]) old_h[playerid] = h;
}
Greekz
Reply
#3

@Kaliber: your code dont make sense. OnPlayerUpdate is quiet fast and not work in regular intervals. The callback name is self explainatory and Whats wrong with OnPlayerTakeDamage?

OnPlayerTakeDamage would be perfect. Further, in case of bleeding, you must express more. The thing striking to my mind currently is using SetPlayerAttachedObject. Using a modelid and attaching it to the respected player.
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{
       SetPlayerAttachedObject(playerid, ...);//attach a bleeding type object to player
}
Just in case you want to remove it on spawn:
pawn Код:
public OnPlayerSpawn(playerid)
{
        RemovePlayerAttachedObject(playerid, ...);
}
Reply
#4

Quote:
Originally Posted by Gammix
Посмотреть сообщение
@Kaliber: your code dont make sense. OnPlayerUpdate is quiet fast and not work in regular intervals.
My Code make sense -.-

Your Code fails, because he said, that he want blood even if the player is falling or sth else.

So the Callback OnPlayerTakeDamage didn't get called.

So read my text again...and then think about it.
Reply
#5

Please dont become a faggot. I have posted the link to the callback. You must read the wiki about OnPlayerTakeDamage and secondally you claim my code wont work. Please give a reason or any evidence.
And i dont think so you understand bleeding.
Reply
#6

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
My Code make sense -.-

Your Code fails, because he said, that he want blood even if the player is falling or sth else.

So the Callback OnPlayerTakeDamage didn't get called.

So read my text again...and then think about it.
His code is absolutely correct, OnPlayerTakeDamage is called when the player takes damage, why would you need to detect it manually in OnPlayerUpdate?
Reply
#7

Quote:
Originally Posted by Gammix
Посмотреть сообщение
Please dont become a faggot.
You must talk...oh jesus...but u didn't understand my Code...

Код:
His code is absolutely correct, OnPlayerTakeDamage is called when the player takes damage, why would you need to detect it manually in OnPlayerUpdate?
Did you all read the first post?

Код:
I tried to make a code already in "OnPlayerTakeDamage" but my player taking damage while riding ...
Reply
#8

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
You must talk...oh jesus...but u didn't understand my Code...

Код:
His code is absolutely correct, OnPlayerTakeDamage is called when the player takes damage, why would you need to detect it manually in OnPlayerUpdate?
Did you all read the first post?

Код:
I tried to make a code already in "OnPlayerTakeDamage" but my player taking damage while riding ...
That does not mean you should use OnPlayerUpdate.

pawn Код:
public OnPlayerTakeDamage(...)
{
       if(IsPlayerInAnyVehicle(playerid))
       {
               return 0;
        }
        return 1;
}
Reply
#9

I did see that, although i don't understand it fully, if it's because you don't want to take damage while "riding", then use a method to prevent it.
Etc. checking if he's riding with GetVehicleModel would be simple.
Or if you want him to bleed while riding, then just apply the bleeding effect there as well, using OnPlayerUpdate should always be prevented.
Reply
#10

Quote:
Originally Posted by Kaliber
Посмотреть сообщение
You must talk...oh jesus...but u didn't understand my Code...

Код:
His code is absolutely correct, OnPlayerTakeDamage is called when the player takes damage, why would you need to detect it manually in OnPlayerUpdate?
Did you all read the first post?

Код:
I tried to make a code already in "OnPlayerTakeDamage" but my player taking damage while riding ...
Well OnPlayerUpdate is definitely not the way to fix it...

What we 'need' here is to see his attempt at the OnPlayerTakeDamage code, so we can edit it to his likings... Also, the above posted didn't give a very detailed description of what he actually wants.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)