Reduce damage ...?
#1




Ok , i'm trying to create a damage system..

When the player have weapon skill == 1 te reduce game 50%

when is == 5 to don't reduce.

As you can see in the screen i upgraded my weapon skill to 2 , and the damage still 46 was... how can i make it works ?
This is my system
pawn Код:
public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid, bodypart)
{
    new string[128], victim[MAX_PLAYER_NAME], attacker[MAX_PLAYER_NAME];
    new weaponname[24];
    GetPlayerName(playerid, attacker, sizeof (attacker));
    GetPlayerName(damagedid, victim, sizeof (victim));

    GetWeaponName(weaponid, weaponname, sizeof (weaponname));
    format(string, sizeof(string), "%s has made %.0f damage to %s, weapon: %s", attacker, amount, victim, weaponname);
    SendClientMessageToAll(0xFFFFFFFF, string);
    new Float:HP;
    GetPlayerHealth(damagedid, HP);
    new Float: newamount;
    if(PlayerInfo[playerid][WeaponSkills] == 1)
    {
        newamount = amount - 50;
    }
    if(PlayerInfo[playerid][WeaponSkills] == 2) { newamount = amount - 40; }
    if(PlayerInfo[playerid][WeaponSkills] == 3) { newamount = amount - 30; }
    if(PlayerInfo[playerid][WeaponSkills] == 4) { newamount = amount - 20; }
    if(PlayerInfo[playerid][WeaponSkills] == 5) { newamount = amount; }
    if(weaponid != 0)
    {
        SetPlayerHealth(damagedid, HP-newamount);
    }
    return 1;
}
Reply
#2

Help
Reply
#3

Using a switch instead of all those if's would be both quicker and maybe fix your bug, otherwise try using OnPlayerTakeDamage.
Also, just to mention, there's no reason to put brackets around this when you're using single functions, it won't cause bugs but just saying.
pawn Код:
{ newamount = amount - 20; }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)