Giter Site home page Giter Site logo

samp-weapon-config's Introduction

weapon-config.inc

This is an include that provides a more consistent and responsive damage system with many new features.

It's pretty much plug-and-play if you don't have any filterscripts that interfere with the health or death events.

How to use

  1. #include <weapon-config> before any other script

  2. Replace OnPlayerGiveDamage and OnPlayerTakeDamage with just one callback:

    public OnPlayerDamage(&playerid, &Float:amount, &issuerid, &WEAPON:weapon, &bodypart)
  3. Add config functions in OnGameModeInit (or any other places, they can be called at any time). Recommended:

    public OnGameModeInit() {
        SetVehiclePassengerDamage(true);
        SetDisableSyncBugs(true);
    }

Requirements

This include file requires the SKY or Pawn.RakNet plugin.

Note: SKY has a higher priority if the user has not included any of these dependencies before weapon-config (it will automatically try to include SKY and only then Pawn.RakNet, if fail with the first). Also, SKY will take precedence if both dependencies are included (it will use the SKY plugin instead of Pawn.RakNet).

Features

  • Server-side health
    • Impossible to use health hacks on lagcomp mode
    • Any type of damage can be modified/prevented, even falling 1000m from the sky
    • Vending machines are controlled server-side (buildings removed and objects created)
    • Paused players can be killed (with death animations) and their HP bars always show the correct values
  • Destroy vehicles with a passenger but no driver
  • Custom falling damage (optional)
    • Adjust the damage and at which speed a player will die
  • Sounds and on-screen TextDraw indicators of damage given/taken
    • Also shows another player's damage feed when spectating
  • New weapon types detected:
    • WEAPON_PISTOLWHIP - When you punch someone with a gun
    • WEAPON_VEHICLE_M4 - Vehicles with M4 guns (e.g. Rustler)
    • WEAPON_VEHICLE_MINIGUN - Vehicles with miniguns (e.g. Hunter)
    • WEAPON_VEHICLE_ROCKETLAUNCHER - Vehicles with projectiles (e.g. Rhino)
    • WEAPON_HELIBLADES - Helikill
    • WEAPON_CARPARK - When you park your car on someone
  • Extensive sanity checking on shots:
    • Modified weapon.dat is automatically detected
    • Shot vector, player distance, and much more is examined
    • A callback is invoked for each so-called "rejected hit" so that the player is informed. A few of these are:
      • Inflicting damage when already dead (due to lag)
      • Hit a player too far from the shot hit position (due to severe lag or cheating)
      • Hitting/shooting too fast (due to severe lag or cheating)
  • Modify every weapon's damage amount
    • To a single value
    • To multiple values depending on the shot distance
    • With custom logic in a callback, for example:
      • Increase damage for headshots
      • Increase/lower damage for combos
      • Lower damage for c-bug rapid fire
  • Knife sync fixed in both lagcomp and no-lagcomp
  • New death animations and respawn logic
    • Customize respawn time globally and for each death
    • Fully customizable animations, with a nice set of defaults
    • Different animation depending on weapon/bodypart, for example:
      • Headshots make you fall back with both hands in your face
      • Shotgun kills make you fly backward like in GTA:VC (unless killed from behind)

Implementation details

All players are given infinite health and set to the same team. Damage is counted by the script whenever OnPlayer(Give/Take)Damage is called. The real GetPlayerHealth is never read by the include file.

The players healthbars are modified by editing SA-MP packets, so they are very responsive.

The death animations are applied as "forcesync" and even the facing angle is force synced (with SKY or Pawn.RakNet). This allows perfect animations even for laggy/paused players.

The real OnPlayerDeath is never called from the SA-MP server (only in some rare cases). A player never actually dies in their game - they just see a death animation applied and get respawned.

Many SA-MP functions are hooked to provide new values (such as GetPlayerState, (Get/Set)Player(Health/Armour), GetPlayerTeam).

Caveats

At the moment, filterscripts are not fully supported. If you need to modify the health, go into spec mode, change the virtual world, and more then you should do it through the gamemode.

A simple workaround is to just do something like this:

// In the gamemode
forward SetHealth(playerid, Float:health);
public SetHealth(playerid, Float:health) {
    SetPlayerHealth(playerid, health);
}
// In the filterscript
CallRemoteFunction("SetHealth", "if", playerid, health);

API

Callbacks

Existing callbacks

OnPlayerGiveDamage and OnPlayerTakeDamage are removed. Use OnPlayerDamage (see below).

OnPlayerDeath and OnPlayerWeaponShot are called as usual.

New callbacks

public OnPlayerDamage(&playerid, &Float:amount, &issuerid, &WEAPON:weapon, &bodypart)

Called when damage is about to be inflicted on a player Most arguments can be modified (e.g. the damage could be adjusted)

  • playerid - The player who is about to get damaged
  • amount - The amount of damage about to get inflicted (0.0 means all HP) This will not always be the same in OnPlayerDamageDone, for example: if amount is 50.0 and you have 10.0, only 10.0 will be reported in OnPlayerDamageDone
  • weapon - The weapon used to inflict the damage
  • bodypart - The bodypart

Return 0 to prevent the damage from being inflicted

public OnPlayerDamageDone(playerid, Float:amount, issuerid, WEAPON:weapon, bodypart)

Called after damage has been inflicted

Same parameters as above, but they can not be modified

Return value ignored

public OnPlayerPrepareDeath(playerid, animlib[32], animname[32], &anim_lock, &respawn_time)

Before the death animation is applied

  • playerid - The player that is about to die
  • animlib - The anim lib to play (change to empty string for no animation)
  • animname - The anim name to play
  • anim_lock - The "lock" parameter in ApplyAnimation
  • respawn_time - The time (in milliseconds) until the player respawns

Return value ignored

public OnPlayerDeathFinished(playerid)

When the death animation has finished and the player has been sent to respawn

  • playerid - The player

Return value ignored

public OnRejectedHit(playerid, hit[E_REJECTED_HIT])

When a shot or damage given is rejected See E_REJECTED_HIT and GetRejectedHit for more

  • playerid - The player whose hit was rejected
  • hit - An enum containing information about the rejected hit

Return value ignored

public OnInvalidWeaponDamage(playerid, damagedid, Float:amount, WEAPON:weaponid, bodypart, error, bool:given)

When a player takes or gives invalid damage (WC_* errors above)

  • playerid - The player that inflicted the damage
  • damagedid - The player that took or was given a hit
  • amount - The damage amount inflicted
  • weaponid - The weapon used
  • bodypart - The bodypart
  • error - Which error (see the enum containing WC_NO_ERROR)
  • given - true means that playerid reported the damage in OnPlayerGiveDamage, false means that damagedid reported the damage in OnPlayerTakeDamage

Return value ignored

Functions

AverageShootRate(playerid, shots, &multiple_weapons = 0);

The average time (in milliseconds) between shots.

  • playerid - The player
  • hits - Number of hits to average on (max 10)
  • multiple_weapons - Will be set to 1 if different weapons were used in the last shots

Returns -1 if there is not enough data to calculate the rate, otherwise the average time is returned.

AverageHitRate(playerid, hits, &multiple_weapons = 0);

Same as above, but for hits inflicted with OnPlayerGiveDamage

DamagePlayer(playerid, Float:amount, issuerid = INVALID_PLAYER_ID, WEAPON:weaponid = WEAPON_UNKNOWN, bodypart = BODY_PART_UNKNOWN, bool:ignore_armour = false);

Inflict a hit on a player. All callbacks except OnPlayerWeaponShot will be called.
Note: do not use it inside OnPlayerDamage as you can just modify amount there

  • ignore_armour - When true will do damage straight to health, and not armour.
Float:GetPlayerHealth(playerid, &Float:health = 0.0);

Hooked version of the original, which also returns the value

Float:GetPlayerArmour(playerid, &Float:armour = 0.0);

Hooked version of the original, which also returns the value

GetRejectedHit(playerid, idx, output[], maxlength = sizeof(output));

Get a string explaining why the hit was rejected at idx (max. WC_MAX_REJECTED_HITS - 1)

SetRespawnTime(ms);

Set the respawn time in milliseconds

GetRespawnTime();

Get the respawn time

IsBulletWeapon(WEAPON:weaponid);

Returns true if the weapon shoots bullets

IsHighRateWeapon(WEAPON:weaponid);

Returns true if the weapon's damage can be reported in high rates to the server (such as fire)

IsMeleeWeapon(WEAPON:weaponid);

Returns true if it's a melee weapon (including WEAPON_PISTOLWHIP)

IsPlayerDying(playerid);

Returns true if the player is between the dying animation and spawning

WC_IsPlayerSpawned(playerid);

Returns true if the player is spawned and not in a dying animation

WC_IsPlayerPaused(playerid);

Returns true if the player is paused (AFK) within last two seconds

GetWeaponName(WEAPON:weaponid, weapon[], len = sizeof(weapon));

Hooked version of the native, fixed and containing custom weapons (such as pistol whip)

ReturnWeaponName(WEAPON:weaponid);

Return the weapon name (uses the fixed GetWeaponName)

SetCustomFallDamage(bool:toggle, Float:damage_multiplier = 25.0, Float:death_velocity = -0.6);

Toggle custom falling damage

SetCustomVendingMachines(bool:toggle);

Toggle vending machines (they are removed and disabled by default)

SetCbugAllowed(bool:enabled, playerid = INVALID_PLAYER_ID);

Toggle anti-cbug per player or globally. (Using no playerid param will default all users to default)

bool:GetCbugAllowed(playerid = INVALID_PLAYER_ID);

Check if users anti-cbug is toggled. (Using no playerid param will show the global toggle value)

SetDamageFeed(bool:toggle);

Toggle damage feed for all

SetDamageFeedForPlayer(playerid, toggle = -1);

Toggle damage feed for player

IsDamageFeedActive(playerid = -1);

Returns true if damage feed is active for player (for all, if playerid passed as -1)

SetDamageSounds(taken, given);

Set sounds when damage is given and taken (0 to disable)

SetVehiclePassengerDamage(bool:toggle);

Allow vehicles to be damaged when they have a passenger and no driver

SetVehicleUnoccupiedDamage(bool:toggle);

Allow vehicles to be damaged when they don't have any players inside them

SetWeaponDamage(WEAPON:weaponid, damage_type, Float:amount, Float:...);

Modify a weapon's damage

  • weaponid - The weapon to modify
  • damage_type - One of the following:
    • DAMAGE_TYPE_MULTIPLIER Multiply the original damage inflicted by amount This is default for melee, grenades, and other weapons that inflict different amounts of damage (shotguns excluded)
    • DAMAGE_TYPE_STATIC Inflict a specific amount of damage for each hit For shotguns, this modifies the value for each bullet that hit the player Combat shotgun shoots 8 bullets, other shotguns shoot 15
    • DAMAGE_TYPE_RANGE_MULTIPLIER Same as DAMAGE_TYPE_MULTIPLIER, but the damage depends on the distance
    • DAMAGE_TYPE_RANGE Same as DAMAGE_TYPE_STATIC, but the damage depends on the distance
  • amount - The amount of damage
  • ... - If damage_type contains RANGE, the arguments should be a list of ranges and damage For example:
    SetWeaponDamage(WEAPON_SNIPER, DAMAGE_TYPE_RANGE, 40.0, 20.0, 30.0, 60.0, 20.0);
    This will make sniper damage:
    • 40 if distance is less than 20
    • 30 if distance is less than 60
    • 20 for any other distance
Float:GetWeaponDamage(WEAPON:weaponid);

Get the amount of damage of a weapon

SetWeaponMaxRange(WEAPON:weaponid, Float:range);

Set the max range of a weapon. The default value is those from weapon.dat Because of a SA-MP bug, weapons can (and will) exceed this range. This script, however, will block those out-of-range shots and give a rejected hit.

Float:GetWeaponMaxRange(WEAPON:weaponid);

Get the max range of a weapon

SetWeaponShootRate(WEAPON:weaponid, max_rate);

Set the max allowed shoot rate of a weapon. Could be used to prevent C-bug damage or allow infinite shooting if a script uses GivePlayerWeapon to do so.

GetWeaponShootRate(WEAPON:weaponid);

Get the max allowed shoot rate of a weapon

SetCustomArmourRules(bool:armour_rules, bool:torso_rules);

Toggle the custom armour rules on and off. Both are disabled by default.

  • armour_rules - Toggle all of the rules. When off, nothing is affected. Armour is affected as it normally would. When on, weapons can be set to either damage armour before health or just take health and never damage armour.
  • torso_rules - Toggle all torso-only rules. When off, all weapons will have effects no matter which bodypart is 'hit'. When on, weapons with the torso_only rule (of SetWeaponArmourRule) on will only damage armour when the torso is 'hit' (and when it's off, armour is damaged no matter which body part is 'hit').
SetWeaponArmourRule(WEAPON:weaponid, bool:affects_armour, bool:torso_only);

Set custom rules for a weapon. The defaults aren't going to comfort EVERYONE, so everyone needs the ability to modify the weapons themselves.

  • weaponid - The ID of the weapon to modify the rules of.
  • affects_armour - Whether this weapon will distribute damage over armour and health or just damage health directly.
  • torso_only - Whether this weapon will only damage armour when the 'hit' bodypart is the torso or all bodyparts. Only works when torso_rules are enabled using SetCustomArmourRules.
EnableHealthBarForPlayer(playerid, bool:enable);

Show or hide health bar for player.

samp-weapon-config's People

Contributors

2col avatar abagail avatar adrfranklin avatar alasnkz avatar alilogic avatar bronzal avatar crayder avatar cypka avatar ino42o avatar kaperstone avatar kolor4do avatar mysy00 avatar nexiustailer avatar nickdodd25 avatar omcho420 avatar oscar-broman avatar rt-2 avatar swthorn avatar sysadminjeroen avatar y-less avatar zbyss avatar ziggi avatar zile42o avatar zorono avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

samp-weapon-config's Issues

More weapon slots

This is something I thought of and mostly wrote years ago, but never released and subsequently lost. I realised that it was quite simple to bypass the weapon slot limit in the same way as I do classes in y_classes - just have three.

Say player is holding a weapon in slot 7, you give them another weapon from (say) slots 6 and 8 (in reality, fists and camera, or other mostly non-deadly weapons will be best). When you detect that they switched to the weapon in slot 6, you know that they changed weapons down, and you can give and arm the correct weapon. If they switch to the weapon in slot 8, they changed up, and again you give them the new weapon accordingly. That next weapon could be a different slot 7 weapon, or any other weapon at all. Just make sure that the sentinel weapons are also updated if required (e.g. giving them an actual slot 6 weapon will prevent the use of slot 6 for detecting a change).

You could get very clever and make those sentinel weapons ones they actually own, or make it so that instead of cycling through all weapons in one slot before moving on to the next slot, you cycle through one of each entirely before moving on to the next ones - would be harder to code, but would lead to less flickering.

issuerid can't damage playerid if his weapon skill is under 200.

This is an odd bug.

So I was testing some new code with someone, and noticed that the deagle did not do any damage on his side when he shot me.

I have looked everywhere in the code, and commented out a lot of stuff, when he said something along "what if it has to do with weapon skill?", I thought that it wouldn't work, but I was desperate to try to fix this bug.

I tested it out and whenever I set his weapon skill to max, he could do damage to me.
I tested it some more and determined that any weapon skill below 200 can't damage with the deagle.

The issue is reproduceable on my normal server, so it isn't only confined to a specific revision or the debug server.

I do not have any functions to get the weapon skill level of a certain player, I only set it to a specific amount according to their score or admin level.

If I fucked up, please do say so.

[Weapon IDs] Run time error 4: "Array index out of bounds"

cc: @oscar-broman

I have recently ran my gamemode in debug mode and got some stacktraces, most of them were due to my own fault but I have seen some that appear to directly trace back to weapon-config.

[06:06:48] [debug] Run time error 4: "Array index out of bounds"
[06:06:48] [debug]  Accessing element at index 48 past array upper bound 46
[06:06:48] [debug] AMX backtrace:
[06:06:48] [debug] #0 00347668 in public WC_OnPlayerDamage (&playerid=@0x005f326c, &Float:amount=@0x005f3270, &issuerid=@0x005f3274, &weapon=@0x005f3278, &bodypart=@0x005f327c) at SFCRRPG.pwn:2715
[06:06:48] [debug] #1 0003986c in public OnPlayerDamage (&playerid=@0x005f326c, &Float:amount=@0x005f3270, &issuerid=@0x005f3274, &weapon=@0x005f3278, &bodypart=@0x005f327c) at C:\Users\Jeroen\Documents\git\SONA\sona-cnr\pawno\include\weapon-config\weapon-config.inc:5448
[06:06:48] [debug] #2 000315b8 in InflictDamage (playerid=6, Float:amount=2.64000, issuerid=4, weaponid=48, bodypart=27, bool:ignore_armour=false) at C:\Users\Jeroen\Documents\git\SONA\sona-cnr\pawno\include\weapon-config\weapon-config.inc:4608
[06:06:48] [debug] #3 0002754c in public OnPlayerGiveDamage (playerid=4, damagedid=6, Float:amount=2.64000, weaponid=48, bodypart=27) at C:\Users\Jeroen\Documents\git\SONA\sona-cnr\pawno\include\weapon-config\weapon-config.inc:3219
[06:06:48] [debug] Run time error 4: "Array index out of bounds"
[06:06:48] [debug]  Accessing element at index 48 past array upper bound 46
[06:06:48] [debug] AMX backtrace:
[06:06:48] [debug] #0 00347668 in public WC_OnPlayerDamage (&playerid=@0x005f326c, &Float:amount=@0x005f3270, &issuerid=@0x005f3274, &weapon=@0x005f3278, &bodypart=@0x005f327c) at SFCRRPG.pwn:2715
[06:06:48] [debug] #1 0003986c in public OnPlayerDamage (&playerid=@0x005f326c, &Float:amount=@0x005f3270, &issuerid=@0x005f3274, &weapon=@0x005f3278, &bodypart=@0x005f327c) at C:\Users\Jeroen\Documents\git\SONA\sona-cnr\pawno\include\weapon-config\weapon-config.inc:5448
[06:06:48] [debug] #2 000315b8 in InflictDamage (playerid=6, Float:amount=2.64000, issuerid=4, weaponid=48, bodypart=27, bool:ignore_armour=false) at C:\Users\Jeroen\Documents\git\SONA\sona-cnr\pawno\include\weapon-config\weapon-config.inc:4608
[06:06:48] [debug] #3 0002754c in public OnPlayerGiveDamage (playerid=4, damagedid=6, Float:amount=2.64000, weaponid=48, bodypart=27) at C:\Users\Jeroen\Documents\git\SONA\sona-cnr\pawno\include\weapon-config\weapon-config.inc:3219
[06:06:49] [debug] Run time error 4: "Array index out of bounds"
[06:06:49] [debug]  Accessing element at index 48 past array upper bound 46
[06:06:49] [debug] AMX backtrace:
[06:06:49] [debug] #0 00347668 in public WC_OnPlayerDamage (&playerid=@0x005f326c, &Float:amount=@0x005f3270, &issuerid=@0x005f3274, &weapon=@0x005f3278, &bodypart=@0x005f327c) at SFCRRPG.pwn:2715
[06:06:49] [debug] #1 0003986c in public OnPlayerDamage (&playerid=@0x005f326c, &Float:amount=@0x005f3270, &issuerid=@0x005f3274, &weapon=@0x005f3278, &bodypart=@0x005f327c) at C:\Users\Jeroen\Documents\git\SONA\sona-cnr\pawno\include\weapon-config\weapon-config.inc:5448
[06:06:49] [debug] #2 000315b8 in InflictDamage (playerid=6, Float:amount=2.64000, issuerid=4, weaponid=48, bodypart=27, bool:ignore_armour=false) at C:\Users\Jeroen\Documents\git\SONA\sona-cnr\pawno\include\weapon-config\weapon-config.inc:4608
[06:06:49] [debug] #3 0002754c in public OnPlayerGiveDamage (playerid=4, damagedid=6, Float:amount=2.64000, weaponid=48, bodypart=27) at C:\Users\Jeroen\Documents\git\SONA\sona-cnr\pawno\include\weapon-config\weapon-config.inc:3219

Prevent hacked weapons

hook GivePlayerWeapon and reject damage if it's a hacked weapon. (inf ammo hacks with non-hacked weapons can be monitored with lagcomp on as well)

Original damage sound possible?

Hello,
We all know that the damage sound used by this plugin is not exactly the same than in the real game.
Is there a way we can change this, honestly you reproduced all the anims and it is really really great work.
It is almost perfect in fact, the only thing that I find annoying is that last little bit, the damage sound, otherwise everything is almost like real.
Do you think there is a way to put the real sound, is it just because you haven't found them yet? Or is it known to be impossible to find those sounds?

Thank you,
rt-2

GetPlayerPos problem for AFK players

I noticed that if i kill a player who is AFK, his coordinates are the same with the old ones after his respawn. Can this be fixed somehow?
I think it can be done by saveing the position of the player after OnPlayerSpawn and hook GetPlayerPos to return these values.
Thanks!

stock IsPlayerSpawned crash, changed to Public works

I got "runtime error 11: devided by zero" in OnPlayerWeaponShot, unless I change the IsPlayerSpawned stock function into a forwarded public function.

Now everything works fine,, weird.
Thought I'd let you guys know...

Thank you,
rt-2

SetCustomFallDamage Parachute Bug

The player loses his health almost 90 per cent on respawn after dying using his parachute, when SetCustomFallDamage is set to false. All other things works fine when it is set to true. This same situation is applicable for this (#17) bug too.
sa-mp-032
sa-mp-033
sa-mp-034

Blood

0.3.7 RC2 Object ID: 19836

Attach that to the player if he died from bullets, vehicle collision, explosions, and other blood causing death when he is for sure on the ground.

Runtime errors

Hi,

After spawn i have some runtime errors

[31/08/2015 20:21:04] SetPlayerHealth (playerid = 0 health = 8000100.00000, result = 1);
[31/08/2015 20:21:04] SetPlayerArmour (playerid = 0 armour = 0.00000, result = 1);
[31/08/2015 20:21:25] SetPlayerHealth (playerid = 0 health = 8000100.00000, result = 1);
[31/08/2015 20:21:25] SetPlayerArmour (playerid = 0 armour = 0.00000, result = 1);
[31/08/2015 20:21:26] [debug] Run time error 4: "Array index out of bounds"
[31/08/2015 20:21:26] [debug] AMX backtrace:
[31/08/2015 20:21:26] [debug] #0 0017ac60 in public WC_OnPlayerDamage (&playerid=@0406a08c 0, &Float:amount=@0406a090 1.91351, &issuerid=@0406a094 65535, &weapon=@0406a098 54, &bodypart=@0406a09c 3) at D:\PAWN\VillageLife\gamemodes\VillageLife/Player/Death.pwn:22
[31/08/2015 20:21:26] [debug] #1 000b5be0 in public OnPlayerDamage (&playerid=@0406a08c 0, &Float:amount=@0406a090 1.91351, &issuerid=@0406a094 65535, &weapon=@0406a098 54, &bodypart=@0406a09c 3) at D:\PAWN\Pawno Patched\include\weapon-config.inc:4940
[31/08/2015 20:21:26] [debug] #2 000ae430 in InflictDamage (playerid=0, Float:amount=1.91351, issuerid=65535, weaponid=54, bodypart=3) at D:\PAWN\Pawno Patched\include\weapon-config.inc:4126
[31/08/2015 20:21:26] [debug] #3 000a33c8 in public ac_OnPlayerUpdate (playerid=0) at D:\PAWN\Pawno Patched\include\weapon-config.inc:2578
[31/08/2015 20:21:26] [debug] #4 00083214 in ?? (playerid=0, ... <1073741822 arguments>) at D:\PAWN\VillageLife\gamemodes\VillageLife/AntiCheat/AC.pwn:3336
[31/08/2015 20:21:26] [debug] #5 00019e84 in public FIXES_OnPlayerUpdate (... <1 argument>) at D:\PAWN\Pawno Patched\include\YSI\..\YSI_Players\..\YSI_Data\..\YSI_Coding\..\YSI_Internal\y_cgen.inc:31
[31/08/2015 20:21:26] [debug] #6 000086f8 in public OnPlayerUpdate (playerid=0) at D:\PAWN\Pawno Patched\include\fixes.inc:4657

Increase player damage

Hi,

I think this sounds nice. Something like SetPlayerWeaponDamage or IncreaseWeaponDamage
What you think? I should look on it when I wil have time.

Cheers

Player killed on <= 0.0 damage

This may be somewhat of a non-issue, but I'm posting it here anyways for discussion purposes.

https://github.com/oscar-broman/samp-weapon-config/blob/3acad301fe85bed5479111fe49d7b6191b696eab/weapon-config.inc#L4640..L4642

https://github.com/oscar-broman/samp-weapon-config/blob/3acad301fe85bed5479111fe49d7b6191b696eab/weapon-config.inc#L4646..L4648

Whenever you inflict 0.0 or less damage to someone, the player dies.

I am fairly certain that this is not a bug, but those who are inexperienced with the weapon-config code might think that this is a bug or that the include is bugged.

I'm even going to use this to make an easy instakill weapon.

Death Skipping sometimes hangs

I seemed to have found a weird issue where i return 0 under OnPlayerDamage, basically a god mode, and i blow up in a vehicle and weapon config respawns you/skips death like its suppose to.

But sometimes it hangs. The user will stay frozen. And sometimes the user gets put into class selection. The class selection one seems less common than the frozen user one.

This is the debug output.

[15:25:06] Vehicle id: 904 died from playerid: 0
[15:25:07] (wc) OnPlayerDeath(0 died by 255 from 65535)
[15:25:07] [death] nickd25 died 255
[15:25:07] (wc:0) OnPlayerTakeDamage(0 took 3.300000 from 65535 by 54 on bodypart 3)
[15:25:07] (wc:0) Requested class: 309
[15:25:07] (wc:0) Skipping death - class selection skipped
[15:25:07] (wc:0) Death skipped

And that's it. I can however trigger this debug code, which is death skipping being finished.

[15:25:11] (wc:0) Death skip end

I can trigger this by playing an animation from my animation browser, or simply spawning a vehicle.

I have not tested this on a blank mode/server yet, only have on my server. But the only time this seems to happen is when a user blows up in a vehicle when god mode is enabled/returning 0 under onplayerdamage

EDIT: This happened when returning 1 like normal.

I have had the issue again with the user going to class selection. I even got the debug lines.

[Wed Jan 04 05:23:53 PM] (wc) OnPlayerDeath(0 died by 255 from 65535)
[Wed Jan 04 05:23:53 PM] (wc) OnPlayerDamageDone(65535 did 99.000000 to 0 with 51 on bodypart 0)
[Wed Jan 04 05:23:53 PM] [Death] Playerid 0 killed by 65535 reason 51
[Wed Jan 04 05:23:53 PM] 14[DEATH]02[0] 07nickd25 died.
[Wed Jan 04 05:23:53 PM] [death] nickd25 died 255
[Wed Jan 04 05:23:53 PM] Vehicle died id: 969
[Wed Jan 04 05:23:56 PM] (wc:0) Requested class: 310
[Wed Jan 04 05:23:56 PM] (wc:0) True death class selection

Support for YSF

There's a bug if you use weapon - config together with YSF. People are not able to damage anyone anymore.

Hope it will be supported soon

Add a callback for vending machines

Something like this:

public OnPlayerUseVendingMachine(playerid) {
    if (GetPlayerMoney(playerid) > 0) {
        GivePlayerMoney(playerid, -1);

        return 1;
    }

    return 0;
}

SetPlayerHealth Issue

Good evening,

I just set up this include and SKY plugin; Everything is working except one thing: a god cmd i had on my gamemode. This command uses to set the player health to a big amount and a timer refull the health if it decreased

CMD:god(playerid, params[])
{
    if(PlayerInfo[playerid][Level] < 7) return SendClientMessage(playerid, red, "You are not allowed to use this command");
    if(PlayerInfo[playerid][God] == 0)
	{
        PlayerInfo[playerid][God] = 1;
   	    SetPlayerHealth(playerid,100000);
		GivePlayerWeapon(playerid,16,50000); GivePlayerWeapon(playerid,26,50000);
        SendClientMessage(playerid,green,"GodMode ON.");
    }
	else
	{
	    PlayerInfo[playerid][God] = 0;
	    SendClientMessage(playerid,red,"GodMode OFF.");
        SetPlayerHealth(playerid, 100);
	}
	return 1;
}

function GodUpdate()
{
	foreach(new i : Player) if(PlayerInfo[i][God] == 1) SetPlayerHealth(i,100000), RepairVehicle(GetPlayerVehicleID(i)), SetVehicleHealth(GetPlayerVehicleID(i),1000000.0);
	return 1;
}

From now, when I try this: It is like if I did nothing, not increasing the health, like if i have 100 HP

Have you any ideas about what could be the problem

Thanks

Custom Damage Types

It will be very nice if there is a function/way to add custom damage types overcoming the complexities.

Support for player god

  1. Add support for player god.
    Ie, disable all player damage and get/set health.
TogglePlayerWeaponDamage(playerid,toggle);
IsTogglePlayerWeaponDamage(playerid);
  1. Update player loop:
for(new i = 0; i < MAX_PLAYERS; i++){ //bad

for(new i = 0, j = GetPlayerPoolSize(); i <= j; i++){ //good

No health lost when falling off a bike.

I tried ramming walls with an NRG in your server at about 150km/h. My character fell of the bike and made some ouch noises but didn't lose health at all.

Rocket Launcher and Heatseeker (others untested)

When hitting somebody with a missile, they can take a missile straight to the face and only lose ~5 to 7 health. Didn't realize until some random guy came in my server and hit me it the face with a missile.

Deaths in vehicles, bugged.

Plain and simple. Did some testing:

Ended up teleporting to default class spawn with a cigar.

  1. Slain myself in a vehicle (set my own health to -1).
  2. Someone killed me in my car.
  3. Someone killed me in my car, in an interior.

Damage problem

Sometimes with a car the include is bugging or even when 2 players are killing the same guy,,

The guy who is dying "spams" deaths take a look on debug

[03/01/2017 02:17:31] (wc:3) OnPlayerGiveDamage(3 gave 6.600000 to 1 using 32 on bodypart 3) [03/01/2017 02:17:31] (wc:3) OnPlayerGiveDamage(3 gave 6.600000 to 1 using 32 on bodypart 3) [03/01/2017 02:17:31] (wc:3) OnPlayerGiveDamage(3 gave 6.600000 to 1 using 32 on bodypart 3) [03/01/2017 02:17:31] (wc:3) OnPlayerGiveDamage(3 gave 6.600000 to 1 using 32 on bodypart 3) [03/01/2017 02:17:31] (wc:3) OnPlayerGiveDamage(3 gave 6.600000 to 1 using 32 on bodypart 3) [03/01/2017 02:17:31] (wc:3) OnPlayerGiveDamage(3 gave 6.600000 to 1 using 32 on bodypart 9) [03/01/2017 02:17:32] (wc:3) OnPlayerGiveDamage(3 gave 6.600000 to 1 using 32 on bodypart 9) [03/01/2017 02:17:32] (wc:3) OnPlayerGiveDamage(3 gave 6.600000 to 1 using 32 on bodypart 9) [03/01/2017 02:17:32] (wc:3) OnPlayerGiveDamage(3 gave 6.600000 to 1 using 32 on bodypart 6) [03/01/2017 02:17:32] (wc:3) OnPlayerGiveDamage(3 gave 6.600000 to 1 using 32 on bodypart 6) [03/01/2017 02:17:32] (wc:3) OnPlayerGiveDamage(3 gave 6.600000 to 1 using 32 on bodypart 4) [03/01/2017 02:17:32] (wc:3) OnPlayerGiveDamage(3 gave 6.600000 to 1 using 32 on bodypart 4) [03/01/2017 02:17:32] (wc:3) OnPlayerGiveDamage(3 gave 6.600000 to 1 using 32 on bodypart 4) [03/01/2017 02:17:32] {48FFEC}Olรก [ITF]((DI3GO))[FL] seu vip expira em {FF0000}19 Dias, 2 Horas, 13 Minutos e 56 Segundos! [03/01/2017 02:17:32] (wc:3) OnPlayerGiveDamage(3 gave 6.600000 to 1 using 32 on bodypart 7) [03/01/2017 02:17:33] Dialog_OnDialogResponse called: 1 8439 0 -1 [03/01/2017 02:17:34] (wc:0) OnPlayerGiveDamage(0 gave 39.600002 to 3 using 27 on bodypart 3) [03/01/2017 02:17:34] (wc:3) OnPlayerTakeDamage(3 took 29.700000 from 0 by 27 on bodypart 3) [03/01/2017 02:17:35] (wc:0) OnPlayerGiveDamage(0 gave 9.900000 to 3 using 27 on bodypart 8) [03/01/2017 02:17:35] (wc:3) OnPlayerTakeDamage(3 took 39.600002 from 0 by 27 on bodypart 8) [03/01/2017 02:17:35] [H2B]ColoradO 2 voltou do esc [03/01/2017 02:17:36] (wc:0) OnPlayerGiveDamage(0 gave 4.950000 to 3 using 27 on bodypart 6) [03/01/2017 02:17:38] (wc:0) OnPlayerGiveDamage(0 gave 34.650001 to 3 using 27 on bodypart 9) [03/01/2017 02:17:38] (wc:3) OnPlayerTakeDamage(3 took 29.700000 from 0 by 27 on bodypart 9) [03/01/2017 02:17:40] (wc:0) OnPlayerGiveDamage(0 gave 14.850000 to 3 using 27 on bodypart 9) [03/01/2017 02:17:40] (wc:0) OnPlayerGiveDamage(0 gave 19.800001 to 3 using 27 on bodypart 6) [03/01/2017 02:17:40] (wc:3) OnPlayerTakeDamage(3 took 19.800001 from 0 by 27 on bodypart 9) [03/01/2017 02:17:40] (wc:0) OnPlayerGiveDamage(0 gave 34.650001 to 3 using 27 on bodypart 9) [03/01/2017 02:17:41] (wc:3) OnPlayerTakeDamage(3 took 34.650001 from 0 by 27 on bodypart 9) [03/01/2017 02:17:42] (wc:0) OnPlayerGiveDamage(0 gave 24.750001 to 3 using 27 on bodypart 5) [03/01/2017 02:17:43] (wc:3) OnPlayerTakeDamage(3 took 29.700000 from 0 by 27 on bodypart 5) [03/01/2017 02:17:43] (wc:0) OnPlayerGiveDamage(0 gave 14.850000 to 3 using 27 on bodypart 5) [03/01/2017 02:17:43] (wc:3) OnPlayerTakeDamage(3 took 34.650001 from 0 by 27 on bodypart 9) [03/01/2017 02:17:43] (wc:0) OnPlayerGiveDamage(0 gave 24.750001 to 3 using 27 on bodypart 3) [03/01/2017 02:17:43] (wc:3) OnPlayerTakeDamage(3 took 24.750001 from 0 by 27 on bodypart 9) [03/01/2017 02:17:43] (wc:0) OnPlayerGiveDamage(0 gave 29.700000 to 3 using 27 on bodypart 9) [03/01/2017 02:17:44] (wc:3) OnPlayerTakeDamage(3 took 24.750001 from 0 by 27 on bodypart 5) [03/01/2017 02:17:44] (wc:0) OnPlayerGiveDamage(0 gave 14.850000 to 3 using 27 on bodypart 5) [03/01/2017 02:17:44] (wc:3) OnPlayerTakeDamage(3 took 19.800001 from 0 by 27 on bodypart 5) [03/01/2017 02:17:44] (wc:0) OnPlayerGiveDamage(0 gave 24.750001 to 3 using 27 on bodypart 5) [03/01/2017 02:17:44] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 3) [03/01/2017 02:17:44] (wc:3) OnPlayerTakeDamage(3 took 29.700000 from 0 by 27 on bodypart 5) [03/01/2017 02:17:44] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 3) [03/01/2017 02:17:44] (wc:0) OnPlayerGiveDamage(0 gave 14.850000 to 3 using 27 on bodypart 9) [03/01/2017 02:17:44] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 3) [03/01/2017 02:17:44] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 3) [03/01/2017 02:17:45] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 3) [03/01/2017 02:17:45] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 3) [03/01/2017 02:17:45] (wc:3) OnPlayerTakeDamage(3 took 24.750001 from 0 by 27 on bodypart 9) [03/01/2017 02:17:45] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 3) [03/01/2017 02:17:45] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 3) [03/01/2017 02:17:45] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 3) [03/01/2017 02:17:45] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 3) [03/01/2017 02:17:45] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 3) [03/01/2017 02:17:45] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 3) [03/01/2017 02:17:45] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 3) [03/01/2017 02:17:45] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 3) [03/01/2017 02:17:45] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 3) [03/01/2017 02:17:45] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 3) [03/01/2017 02:17:45] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 4) [03/01/2017 02:17:46] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 4) [03/01/2017 02:17:46] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 3) [03/01/2017 02:17:46] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 6) [03/01/2017 02:17:46] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 6) [03/01/2017 02:17:46] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 6) [03/01/2017 02:17:46] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 3) [03/01/2017 02:17:46] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 3) [03/01/2017 02:17:46] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 3) [03/01/2017 02:17:46] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 3) [03/01/2017 02:17:46] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 3) [03/01/2017 02:17:46] [H2B]ColoradO 2 entrou de esc [03/01/2017 02:17:46] (wc:3) OnPlayerGiveDamage(3 gave 6.600000 to 1 using 32 on bodypart 6) [03/01/2017 02:17:46] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 4) [03/01/2017 02:17:46] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 6) [03/01/2017 02:17:46] (wc:3) OnPlayerGiveDamage(3 gave 6.600000 to 1 using 32 on bodypart 6) [03/01/2017 02:17:46] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 4) [03/01/2017 02:17:46] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 6) [03/01/2017 02:17:46] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 3) [03/01/2017 02:17:46] (wc:1) OnPlayerTakeDamage(1 took 6.600000 from 3 by 32 on bodypart 6) [03/01/2017 02:17:46] (wc:3) OnPlayerGiveDamage(3 gave 6.600000 to 1 using 32 on bodypart 6) [03/01/2017 02:17:46] (wc:1) OnPlayerTakeDamage(1 took 6.600000 from 3 by 32 on bodypart 6) [03/01/2017 02:17:46] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 3) [03/01/2017 02:17:46] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 3) [03/01/2017 02:17:46] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 3) [03/01/2017 02:17:46] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 3) [03/01/2017 02:17:46] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 3) [03/01/2017 02:17:46] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 3) [03/01/2017 02:17:46] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 3) [03/01/2017 02:17:46] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 3) [03/01/2017 02:17:46] (wc:0) OnPlayerGiveDamage(0 gave 24.750001 to 3 using 27 on bodypart 9) [03/01/2017 02:17:46] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 4) [03/01/2017 02:17:46] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 3) [03/01/2017 02:17:46] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 4) [03/01/2017 02:17:47] (wc:3) OnPlayerTakeDamage(3 took 24.750001 from 0 by 27 on bodypart 3) [03/01/2017 02:17:47] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 3) [03/01/2017 02:17:47] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 4) [03/01/2017 02:17:47] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 4) [03/01/2017 02:17:47] (wc:0) OnPlayerGiveDamage(0 gave 9.900000 to 3 using 27 on bodypart 6) [03/01/2017 02:17:47] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 3) [03/01/2017 02:17:47] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 4) [03/01/2017 02:17:47] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 3) [03/01/2017 02:17:47] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 4) [03/01/2017 02:17:47] (wc:3) OnPlayerTakeDamage(3 took 34.650001 from 0 by 27 on bodypart 9) [03/01/2017 02:17:47] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 3) [03/01/2017 02:17:47] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 3) [03/01/2017 02:17:47] (wc:0) OnPlayerGiveDamage(0 gave 29.700000 to 3 using 27 on bodypart 3) [03/01/2017 02:17:47] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 3) [03/01/2017 02:17:47] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 3) [03/01/2017 02:17:47] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 3) [03/01/2017 02:17:47] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 3) [03/01/2017 02:17:47] (wc:3) OnPlayerTakeDamage(3 took 24.750001 from 0 by 27 on bodypart 5) [03/01/2017 02:17:47] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 3) [03/01/2017 02:17:47] (wc:0) OnPlayerGiveDamage(0 gave 29.700000 to 3 using 27 on bodypart 9) [03/01/2017 02:17:47] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 3) [03/01/2017 02:17:48] (wc:3) OnPlayerTakeDamage(3 took 24.750001 from 0 by 27 on bodypart 5) [03/01/2017 02:17:48] (wc:0) OnPlayerGiveDamage(0 gave 39.600002 to 3 using 27 on bodypart 3) [03/01/2017 02:17:48] (wc:3) OnPlayerTakeDamage(3 took 34.650001 from 0 by 27 on bodypart 3) [03/01/2017 02:17:49] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 5) [03/01/2017 02:17:49] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 3) [03/01/2017 02:17:49] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 5) [03/01/2017 02:17:49] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 3) [03/01/2017 02:17:49] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 3) [03/01/2017 02:17:49] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 3) [03/01/2017 02:17:49] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 3) [03/01/2017 02:17:49] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 3) [03/01/2017 02:17:49] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 3) [03/01/2017 02:17:49] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 3) [03/01/2017 02:17:49] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 3) [03/01/2017 02:17:49] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 4) [03/01/2017 02:17:50] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 3) [03/01/2017 02:17:50] (wc:1) OnPlayerGiveDamage(1 gave 8.250000 to 0 using 29 on bodypart 4) [03/01/2017 02:17:50] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 3) [03/01/2017 02:17:50] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 4) [03/01/2017 02:17:50] (wc:0) OnPlayerTakeDamage(0 took 8.250000 from 1 by 29 on bodypart 4) [03/01/2017 02:17:50] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 3) [03/01/2017 02:17:50] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 3) [03/01/2017 02:17:50] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 3) [03/01/2017 02:17:50] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 3) [03/01/2017 02:17:50] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 3) [03/01/2017 02:17:50] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 3) [03/01/2017 02:17:50] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 3) [03/01/2017 02:17:50] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 6) [03/01/2017 02:17:50] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 6) [03/01/2017 02:17:50] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 6) [03/01/2017 02:17:51] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 6) [03/01/2017 02:17:51] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 6) [03/01/2017 02:17:51] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 9) [03/01/2017 02:17:51] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 3) [03/01/2017 02:17:51] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 3) [03/01/2017 02:17:51] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 5) [03/01/2017 02:17:51] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 5) [03/01/2017 02:17:51] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 5) [03/01/2017 02:17:51] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 4) [03/01/2017 02:17:51] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 4) [03/01/2017 02:17:51] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 4) [03/01/2017 02:17:52] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 9) [03/01/2017 02:17:52] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 9) [03/01/2017 02:17:52] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 5) [03/01/2017 02:17:52] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 5) [03/01/2017 02:17:52] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 5) [03/01/2017 02:17:52] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 5) [03/01/2017 02:17:52] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 4) [03/01/2017 02:17:52] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 4) [03/01/2017 02:17:53] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 6) [03/01/2017 02:17:53] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 9) [03/01/2017 02:17:53] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 5) [03/01/2017 02:17:53] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 5) [03/01/2017 02:17:53] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 5) [03/01/2017 02:17:53] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 5) [03/01/2017 02:17:53] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 5) [03/01/2017 02:17:53] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 4) [03/01/2017 02:17:53] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 4) [03/01/2017 02:17:53] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 4) [03/01/2017 02:17:54] OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 4) [03/01/2017 02:17:54] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 9) [03/01/2017 02:17:54] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 9) [03/01/2017 02:17:54] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 5) [03/01/2017 02:17:54] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 5) [03/01/2017 02:17:54] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 5) [03/01/2017 02:17:54] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 5) [03/01/2017 02:17:54] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 4) [03/01/2017 02:17:54] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 4) [03/01/2017 02:17:54] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 4) [03/01/2017 02:17:55] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 9) [03/01/2017 02:17:55] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 9) [03/01/2017 02:17:55] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 5) [03/01/2017 02:17:55] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 5) [03/01/2017 02:17:55] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 5) [03/01/2017 02:17:55] (wc:0) OnPlayerGiveDamage(0 gave 6.600000 to 3 using 32 on bodypart 5)

weapon-config crash

[debug] Accessing element at index 65535 past array upper bound 999
[debug] AMX backtrace:
[07:56:02] [debug] #0 000342b0 in AddRejectedHit (playerid=65535, damagedid=2, reason=19, weapon=49, i1=1111883777, i2=0, i3=0) at C:\pawno\include\weapon-config.inc:5308
[debug] #1 00024624 in public OnPlayerTakeDamage (playerid=2, issuerid=65535, Float:amount=49.50000, weaponid=49, bodypart=3) at C:\pawno\include\weapon-config.inc:3373
[debug]

Unreturned death, from InflictDamage

I think PlayerDeath was never called from InflictDamage. Here is the debug:

image

So all the stuff in PlayerDeath that was needed was never called.

I'm not sure if it's needed, just reporting in case it is...

Performance improvements

Performance is not really an issue, but for high rate damage (fire, carpark, drowning, spraycan, extinguisher), things could be improved.

It's not a matter of server lag, but rather it's client lag. If many players in the same place are on fire or something similar, a lot of packets will be sent back and forth.

  • UpdateHealthBar should be throttled. No more than 5 times / second.
  • Often used switch statements could be better of as array lookups (e.g. IsHighRateWeapon).

GMX = Instant Client Crash

I'm pretty sure this would be caused by RemoveBuildingForPlayer being repeated when OnPlayerConnect is called on the same player that was already connected. The 'building' (vending machines in our case) can't be removed twice.

Health, armor, vehicle & wpns going crazy (sync issue)

Hi,
I am having a problem in my server and I am almost sure it is originating from this include.
First of all, I described the issue very well here: rt-2/SA-ARP#4
I have concluded that most of the time (or always) it happens when player1 is in a vehicle.
And it seems like the player2 need to be teleported near player1(in a vehicle). Then if player1 is not moving, it could go crazy, also, sometimes when the player is not moving for a couple of seconds, it also can start happening for nearby players. Player1 does not see his health/armor moving, only the streamed players around.
Instantly if player1 start moving it will stop and return to normal instantly for everyone.
Also, I have found out that while moving the forklift's fork, it also happens, here is a video I recorded to demonstrate: https://www.youtube.com/watch?v=a6Ful1b-kJc
I am not able to "create" this problem on demand, other than moving the forklift's fork.
This issue seem to have something to do with UpdatePlayer or OnPlayerStreamIn, since it happens mostly(but not always) when a player get streamed near another player AND it always stop immediately when the bugged player start moving, but I have no ideas really.

Thank you,
rt-2

Streaming in when exiting (maybe entering) vehicles.

When I exit a vehicle all the dynamic objects around me flash and objects in the distance that should be streamed in are not. This flash causes me to fall through the ground of my maps.

I'm guessing that this has something to do with OnPlayerStateChange because it happens when exiting and sometimes entering vehicles. More specifically I'm guessing it's SKY's functions in WC_SpawnForStreamedIn which is called in OPSC.

EDIT: I was correct before, the cause is SpawnForStreamedIn (pretty sure after a few test attempts). When I comment the following section of OPSC, the bug does not occur.

/*if (newstate == PLAYER_STATE_ONFOOT) {
    if (oldstate == PLAYER_STATE_DRIVER || oldstate == PLAYER_STATE_PASSENGER) {
        new Float:vx, Float:vy, Float:vz;
        GetPlayerVelocity(playerid, vx, vy, vz);

        if (vx*vx + vy*vy + vz*vz <= 0.05) {
            WC_SpawnForStreamedIn(playerid);
        }
    }
}*/

That narrows down to SpawnPlayerForWorld(playerid) because the only other two functions called in that function require players to be online, and I was alone. So this is a SKY bug. I haven't been able to test the other spots SpawnForStreamedIn is called because nobody has been online for me to test the knife stuff on.

EDIT: I made a command to only run SpawnPlayerForWorld, most of the time this bug occurs. Sometimes the bug does not occur. So this is actually a SKY bug.

Shallow Water - No Damage (Screenshot Included)

Damage is (usually) not taken when falling into water from a high height. Sometimes it does kill me, most of the time the debug messages only show OnPlayerTakeDamage. Falling anywhere on land does call other functions, but in shallow (not too shallow, but shallow enough to call OnPlayerTakeDamager) water nothing else is called. I think it only happens when the damage taken is 165.0 (aka Splat Damage.)

sa-mp-145

Trying to bypass the Death Animation.

Yo.

I've finally got my GM to the point where I am getting to work on the death system.

I have it all working (well the parts I want to work) but there's an issue with the death animation that I was hoping you could help me fix. (Skip to *TO THE POINT for a step-by-step explanation).

Under OnPlayerDamage, I switch between the players death state (ALIVE, WOUNDED or DEAD).
If the person is alive, i allow the damage to be done. If the damage >= (health+armour), then I set the persons death state to WOUNDED. At this stage, the death animation is played (as they 'die' according to the weapon-config include) but I freeze them in that animation.

When they're WOUNDED and they take x damage (30 for example), then they are set to the DEAD state.

*TO THE POINT
The issue I am having is that the animation (when they are already in the animation) gets played every time they are shot.
This is how it goes right now:
OnPlayerDamage(..) -> ALIVE -> Damage the player.
OnPlayerDamage(..) -> ALIVE -> Damage the player - Animation Plays (is now WOUNDED).
OnPlayerDamage(..) -> WOUNDED -> Return 0 -> Animation Plays (is now DEAD).
OnPlayerDamage(..) -> DEAD -> Return 0 -> Animation Plays (is still DEAD).

This is how I want it to go:
OnPlayerDamage(..) -> ALIVE -> Damage the player.
OnPlayerDamage(..) -> ALIVE -> Damage the player - Animation Plays (is now WOUNDED).
OnPlayerDamage(..) -> WOUNDED -> Return 0 -> Animation does not play (already playing) and is now DEAD.
OnPlayerDamage(..) -> DEAD -> Return 0 -> Animation does not play (already playing) and is still DEAD.

I tried fixing it on my end but everything I tried failed. I thought returning 0 in OnPlayerDamage would fix it (by never entering OnPlayerDamageDone) but it didn't.

Would be great to have a configuration setting like AllowDeathAnimationToReplay(bool:value) that would not re-apply the death animation if the death animation is already playing.

(Not sure if this makes sense so please let me know if that's the case :D)

Thanks.

Preventing the spawn after the Death Animation finishes.

I think it would be awesome to have the option to completely prevent the spawning of players when their death animation finishes (from OnPlayerPrepareDeath).

I'd love to be able to simply apply the death animation for as long as the 'respawn_time' parameter specifies with -1 being forever.

So basically, being able to prevent OnPlayerDeath.

Example One:
If a player falls to his death from the sky, I'd like to be able to play the animation as usual but instead of the player playing the animation and then despawning, I could let him lay on the ground.

This would be great as well (same thing as above but when the deaths occur inside vehicles):
Example:
If a group of people are in a vehicle and it explodes due to collision/weapon damage, then I could allow them to all play the death animation and then make them all lay where the car exploded in the animation without having to use SetPlayerPos after OnPlayerDeath and OnPlayerSpawn.

Also see: http://forum.sa-mp.com/showpost.php?p=3405048&postcount=91.

It always feels like I explain these sort of things horribly, let me know if I did and I'll try clear it up more :D

Bugs and suggestions

Hey, great plugin - well done! First and foremost, testing on latest 0.3x.

Bugs

  1. Class selection fails unless it's death by a car or something client-side.
  2. Fall damage is just not as accurate as before?
  3. Is the death world thing necessary? It seems to inflict bugs than anything else.

Suggestion

  1. Allow users to easily disable portions of the code with using #define instead of using functions (Toggle{function}(bool: value)

    Should stop compiling unnecessary code that is already disabled by the server. Example:

    #define TOGGLE_DAMAGE_FEED (true)
    
    #if TOGGLE_DAMAGE_FEED == true
    ... operations ...
    #endif
    
  2. Make an addition to this by introducing maybe another optional feature which enables users to access weapon data (GetWeaponDamageFromDistance, GetWeaponDamage, GetWeapon blah blah.)

  3. When the include is stable, it might be great if this was merged altogether with the SKY plugin. (As that plugin really has only things relevant to this include.)

OPD, amount (I think it's something to do with amount) bug.

When using the following code, I sometimes die from falling short distances. Some other times I survive the very long falls.

public OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart)
{
    if (weapon == WEAPON_COLLISION && amount < 7.5) // Ignore low fall damage
        return 0;
    return 1;
}

Hooking OnGiveDamage with y_hooks

Is this possible? I gave it a go but the hooked callback wasn't called.

For the time being I'm using ALS, but it would be great if I could use y_hooks instead.

Cannot read from file: "weapon-config"

Hey.

Whenever I compile my "fresh" gamemode I get this.

\gamemodes\bare.pwn(4) : fatal error 100: cannot read from file: "weapon-config"
Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
1 Error.

You recommended me that I update my include files, which ones do I need to update specificly?

Edit: If someone thats reading this has a working setup, I would greatly appreciate if they could upload/send me the includes for 0.3.7 or something! :p

Banks

While you are in vehicle and falling and try to get out the player receives damage

I noticed while you are in a vehicle (tested only on nrg) and falling and you will try to get out the player will receive damage.

Video: https://www.youtube.com/watch?v=Ub0uJlVBkt0
Info: A friend of mine recorded me while he was spectating me, this way the camera is so close to vehicle (the spec system is a little fk)

Info to reproduce: While falling the vehicle pitch must be something like this https://dl.dropboxusercontent.com/u/51829909/dfdfdf.png (i love paint ๐Ÿ˜„)
The amount of damage you will receive is related to velocity (the higher it is the damage will be even greater)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.