Death system
#1

Ey, guys I am looking for some one which got time to help me make a death system I have a brief idea, I tried but unfortunately I failed but I do not give up ;P, The reason I haven't posted on the request topic because I don't want people doing it for me I want people to show me how to do it and want to learn from mistakes so next time I will be able to do it all my self. I want it to be simple.

1. When you die you will get a red screen.
2. /fall animation
3. A textdraw timer on your screen of 250 seconds.
4. After the 250 seconds you spawn at the hospital.

Hope some one out there got the chance to help me thanks from advance!

Unknwon1195
Reply
#2

You want to cancel death? Seems a bit boring to sit there for 250 seconds doing nothing..
Reply
#3

I want to add one. I want it at least 120 seconds, if you won't get saved you will die, so people have the chance to rob you or save you..
Reply
#4

If you want to cancel death you'll have to disable native damage by setting everyone's team (SetPlayerTeam) to 1 then using OnPlayerTake/GiveDamage to make your own damage system, and if after the damage is applied their health would be < 1 put them in to dying mode or whatever it is you're trying to do.
Reply
#5

Yah that's why I need help cause I do not know how..
Reply
#6

I just told you.
Reply
#7

You have to explain to me I can't write pawno from my mind I just understand what's there that's all ..
Reply
#8

It's a complex system, which I am not prepared to write FOR you.

I made a revival systsem a while back, feel free to have a look at the code:

http://pastebin.com/RiPPatg2

Please note I just made this as I was bored, so it has bugs and such. You can go up to a bleeding player and hold space to revive them. There are debug messages in various places which will spam. This is NOT a script you can just run on your server and expect to work. Also, it's designed for my server, so probably won't even work for you. Just learn from it.

NOTE: Requires SA:MP 0.3e.
Reply
#9

Well, it's not really all that complex...


pawn Код:
//Info[MAX_PLAYERS][MyEnumName] is just the array i use for my shit...You would use whatever you're using lol

//Inside your player info enum, add - Float:Health and Float:Armor

public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid)
{
    if(!Info[damagedid][Down])
    {
        new Damage;
        switch(weaponid)
        {
            case 31: Damage = 25; //set the damage here for when this switch is over
            //This for instance makes M4 do 25 damage
        }
        if(Info[damagedid][Armor] > Damage) Info[damagedid][Armor] =- Damage;
        else if(Info[damagedid][Armor] == Damage) Info[damagedid][Armor] = 0;
        else if(Info[damagedid][Armor] < Damage && Info[damagedid][Armor] > 0)
        {
            new subval = floatround(Info[damagedid][Armor])-Damage;
            //takes their armor, subtracts 25 from it. Then it adds that negative number to their health
            //For instance, 15 armor -25 = -10. So we subract 10 basically.
            Info[damagedid][Armor] = 0;
            Info[damagedid][Health] += subval;
        }
        else Info[damagedid][Health] -= Damage;

        if(Info[damagedid][Health] < 1)
        {
            //Give them fall animation and show them the textdraw
            Info[damagedid][Down] = true; //inside of our player info enum - bool:Down
            Timer[damagedid] = SetTimer("Died", 120*1000, false);
            SetPlayerHealth(damagedid, 1);
        }
        else //if above isn't the case, we set their hp and armor so it shows on screen - this MIGHT not work correctly...untested
        {
            SetPlayerHealth(damagedid, Info[damagedid][Health]);
            SetPlayerArmor(damagedid, Info[damagedid][Armor]);
        }
    }
    return 1;
}

public Died(playerid)
{
    if(Info[playerid][Down])
    {
        Info[playerid][Down] = false;
        SetPlayerHealth(playerid, 0); //inside of onplayerdeath, do you hospital stuff
    }
    KillTimer(Timer[playerid]);
    return 1;
}

/*
If you're making a command or anything, you can check if the 'target' player is down by doing this

    if(!Info[TARGET_OR_WHATEVER][Down]) return SendClientMessage(playerid, 0xCC0000AA, "That player isn't down!");

The rest isn't really complicated...This was the most complicated part, and it's actually pretty simple

Also, CREATE the textdraw for them when they connect but don't SHOW it until later
*/
The damage formula was taken from an old post of mine and modified a little bit.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)