Damage
#1

Hey, i've just found this cool script in wiki and put it my mod, the problem is, its only pooping up the message in chat when I AM SCHOOTING...is there any way to make so it will pop up if someone is shooting me? and make it so its not spamming only one message per 5 second?

Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
    if(damagedid != INVALID_PLAYER_ID)
    {
        new string[128], player[MAX_PLAYER_NAME], damaged[MAX_PLAYER_NAME], weapon[24];
        GetPlayerName(playerid, player, sizeof(player));
        GetPlayerName(damagedid, damaged, sizeof(damaged));
        GetWeaponName(weaponid, weapon, sizeof (weapon));

        format(string, sizeof(string), "[ DAMAGE ] {FF0000}%s {FFFFFF}dostal {FF0000}%.0f zranenie {FFFFFF}od hraca {228B22}%s{FFFFFF}. Zbran: %s", damaged, amount, player, weapon);
        SendClientMessageToAll(0xFFFFFFFF, string);
    }
    return 1;
}
Reply
#2

*Edit, that was the 5 seconds part.

You can do it that way:

pawn Код:
new bool:GetMessage;

forward WillGetMessage();
public WillGetMessage()
{
    GetMessage = true;
    return 1;
}

public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
    if(damagedid != INVALID_PLAYER_ID)
    {
        if(GetMessage)
        {
            new string[128], player[MAX_PLAYER_NAME], damaged[MAX_PLAYER_NAME], weapon[24];
            GetPlayerName(playerid, player, sizeof(player));
            GetPlayerName(damagedid, damaged, sizeof(damaged));
            GetWeaponName(weaponid, weapon, sizeof (weapon));
           
            GetMessage = false;
            SetTimer("WillGetMessage", 5000, 0);

            format(string, sizeof(string), "[ DAMAGE ] {FF0000}%s {FFFFFF}dostal {FF0000}%.0f zranenie {FFFFFF}od hraca {228B22}%s{FFFFFF}. Zbran: %s", damaged, amount, player, weapon);
            SendClientMessageToAll(0xFFFFFFFF, string);
        }
    }
    return 1;
}
Haven't tested it, I think it will work.
Reply
#3

No, this one isnt even working, nothing happens when shooting
Reply
#4

anyone?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)