26.09.2017, 21:18
Quote:
This is my OnPlayerDamage. When I compile with the cbug part my pawn library stops working.
PHP код:
|
PHP код:
public OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart)
{
/*
* Explaining OnPlayerDamage a bit.
* OnPlayerDamage is called whenever a player has been damaged, you can use this to modify the amount of damage.
* OnPlayerDamage MUST return a value, if you return `1` it will issue the playerid the `amount` on behalf of the `issuerid`, if you return `0` no damage will be issued.
* Parameters:
* • `playerid`: The player that receives the damage.
* • `amount`: The amount of damage that will be issued.
* • `issuerid`: The player that issued the damage.
* • `weapon`: The weaponid of the weapon that is used to issue the damage.
* • `bodypart`: The bodypart that has been damaged/shot, you can use this to make a headshot system or increase/decrease damage depending on bodypart.
*/
if(issuerid != INVALID_PLAYER_ID && playerid != INVALID_PLAYER_ID) // Check if the issuer (issuerid) is a valid player and the receiver (playerid) is a valid player
{
if(weapon == 24) // Check if the weapon is a deagle
amount = 32; // Set the damage to 32
if(weapon == 30) // ak47
amount = 6;
if(weapon == 31) // m4
amount = 6;
if(weapon == 29) // mp5
amount = 5;
if(weapon == 33) // rifle cuntgun
amount = 17;
}
new avg_rate = AverageShootRate(issuerid, 2);
// Lower rapid fire damage
if (avg_rate != -1) {
if (weapon == WEAPON_DEAGLE && avg_rate < 500)
amount *= 0.50;
else if (weapon == WEAPON_SHOTGSPA && avg_rate < 250)
amount *= 0.50;
}
return 1; // Return 1 to issue the damage
}
PHP код:
if(issuerid != INVALID_PLAYER_ID && playerid != INVALID_PLAYER_ID) // Check if the issuer (issuerid) is a valid player and the receiver (playerid) is a valid player
{
if(weapon == 24) // Check if the weapon is a deagle
amount = 32; // Set the damage to 32
if(weapon == 30) // ak47
amount = 6;
if(weapon == 31) // m4
amount = 6;
if(weapon == 29) // mp5
amount = 5;
if(weapon == 33) // rifle cuntgun
amount = 17;
}
PHP код:
SetWeaponDamage(WEAPON_DEAGLE, DAMAGE_TYPE_STATIC, 32.0);
SetWeaponDamage(WEAPON_AK47, DAMAGE_TYPE_STATIC, 6.0);
SetWeaponDamage(WEAPON_M4, DAMAGE_TYPE_STATIC, 6.0);
SetWeaponDamage(WEAPON_MP5, DAMAGE_TYPE_STATIC, 5.0);
SetWeaponDamage(WEAPON_RIFLE, DAMAGE_TYPE_STATIC, 17.0);