Knifing
#1

Solved
Reply
#2

Quote:
Originally Posted by Kitten
Посмотреть сообщение
Ok so i got a code from calgon last night

i never had time to test it
but i tested it today it takes your hp away
how could i make it to lose the player u hit?
uses foreach include
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {
    if(PRESSED(KEY_FIRE)) {
        if(GetPlayerWeapon(playerid) == 4) {
            new
                Float: curHealth,
                Float: knifeDamagePos[3];

            GetPlayerPos(playerid, knifeDamagePos[0], knifeDamagePos[1], knifeDamagePos[2]);
            foreach(Player, i) {
                if(IsPlayerInRangeOfPoint(i, 1, knifeDamagePos[0], knifeDamagePos[1], knifeDamagePos[2])) {
                    GetPlayerHealth(i, curHealth);
                    SetPlayerHealth(i, curHealth-50);
                    return 1;
                }
            }
        }
    }
    return 1;
}
You mean kill the player?
If so, heres the new code:

pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys) {
    if(PRESSED(KEY_FIRE)) {
        if(GetPlayerWeapon(playerid) == 4) {
            new
                Float: curHealth,
                Float: knifeDamagePos[3];

            GetPlayerPos(playerid, knifeDamagePos[0], knifeDamagePos[1], knifeDamagePos[2]);
            foreach(Player, i) {
                if(IsPlayerInRangeOfPoint(i, 1, knifeDamagePos[0], knifeDamagePos[1], knifeDamagePos[2])) {
             SetPlayerHealth(i, 0);
                    return 1;
                }
            }
        }
    }
    return 1;
}
Might need to fix your indentations... I don't know.
Reply
#3

Solved
Reply
#4

Quote:
Originally Posted by Kitten
Посмотреть сообщение
i cant test right now but may i ask,
does this code makes the zombie hits the other player lose hp?
Ummm.... LOL, that's not how you (Kitten) normally talk.
What do you mean?
Reply
#5

Solved
Reply
#6

Solved
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)