[Include] weapon-config.inc - Damage system with many features

Jeroen52 and JustMe.77, i tried and error continues showing. I tried too remove others includes, and error continues

Line of error:
Quote:

#if defined _ALS_OnPlayerDamage
#undef OnPlayerDamage
#else
#define _ALS_OnPlayerDamage
#endif
#define OnPlayerDamage WC_OnPlayerDamage
#if defined WC_OnPlayerDamage
forward WC_OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart);
#endif

Fixed

In line: forward WC_OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart);
i change to: forward WC_OnPlayerDamage(playerid, Float:amount, issuerid, weapon, bodypart);

Compiled. Thanks for helping JustMe.77 and Jeroen52.

Public OnPlayerDeath is called? how do i know who is killerid (like OnPlayerDeath) in Weapon Config System?

*Sorry my bad english, please.

Example, in OnPlayerDamageDone:
Quote:

public OnPlayerDamageDone(playerid, Float:amount, issuerid, weapon, bodypart)
{
new Float:Health;
GetPlayerHealth(playerid, Health);
if(Health < amount)
{
// Playerid death...
SendDeathMessage(issuerid, playerid, weapon);
// ...
}
return 1;
}

Right?
Reply

issuerid is the killerid

Also why did you remove the ampersands (&) from WC_OnPlayerDamage? They are there so you can modify the values.
Reply

Slice, OnPlayerDamageDone is called when player "death" or only is called "OnPlayerDamage" return 1?

Yeah, if player deaths, of course onplayerdamage is return 1, but ex: playerid health = 50 and damage (amount) = 20 (return 1), in this case, onplayerdamagedone is called too?

--
Quote:

Also why did you remove the ampersands (&) from WC_OnPlayerDamage? They are there so you can modify the values.

I have no idea why removed ampersands. I downloaded include, and i put #include <weapon-config> and <SKY> on top of gamemode, except a_samp, and press de butom F5 for compile, showing error in the line 5426:
Quote:

weapon-config.inc(5426) : error 025: function heading differs from prototype

--
You have plugin SKY for 0.3.7 R2-1 compiled for Windows?

Thanks for helping .
Reply

Thank you man ! I need this.
rep ++ ; :P
Reply

I dunno what is happening but when i use an "damage indicator" (who shows a gun above your head) script on OnPlayerDamage, all the self damage (like Rocket launcher, falls, fire) don't work, and when i use this script in OnPlayerDamageDone the self damage are all bugged (like fall gives -100 damage but i'm no dying, or Rocket Launcher doing 0 damage or fire inflict damage but i'm not dying etc...)


This is the code i'm using:
Code:
KillTimer(Player[issuerid][P_OBJ_TIMER]);
	if(Player[issuerid][P_ARMAPLAYER] != 0) DestroyObject(Player[issuerid][P_ARMAPLAYER]);
    Player[issuerid][P_ARMAPLAYER] = CreateObject(weaponObj[weapon], 0, 0, 0, 0, 0, 0);
	AttachObjectToPlayer(Player[issuerid][P_ARMAPLAYER], issuerid, 0, 0, 1.35, 0, 0, 0);
	Player[issuerid][P_OBJ_TIMER][0] = SetTimerEx("HideWeaponObject", 1000, false, "i", issuerid);
	Player[issuerid][P_OBJ_TIMER][1] = 1;
Reply

Do you check if issuerid is INVALID_PLAYER_ID? Otherwise you will get an array out of bounds error, which will cause the problems you describe.
Reply

Quote:
Originally Posted by Slice
View Post
Do you check if issuerid is INVALID_PLAYER_ID? Otherwise you will get an array out of bounds error, which will cause the problems you describe.
OMG, Ty Slice, it worked!! you're is best

you don't know how i'm happy bro!

Fixed code:
Quote:

if(issuerid == !INVALID_PLAYER_ID)
{
KillTimer(Player[issuerid][P_OBJ_TIMER]);
if(Player[issuerid][P_ARMAPLAYER] != 0) DestroyObject(Player[issuerid][P_ARMAPLAYER]);
Player[issuerid][P_ARMAPLAYER] = CreateObject(weaponObj[weapon], 0, 0, 0, 0, 0, 0);
AttachObjectToPlayer(Player[issuerid][P_ARMAPLAYER], issuerid, 0, 0, 1.35, 0, 0, 0);
Player[issuerid][P_OBJ_TIMER][0] = SetTimerEx("HideWeaponObject", 1000, false, "i", issuerid);
Player[issuerid][P_OBJ_TIMER][1] = 1;
}

(I'm learning pawn, that is why i'm have difficult in a "simple" thing ;-; )

rep ++
Reply

Slice, you have a link SKY plugin compiled for windows server 0.3.7 R2-1? I do not know compile plugins :/
Reply

Is there is any way to use DamagePlayer() inside OnPlayerDamage ?
Reply

Quote:
Originally Posted by Fungi
View Post
Is there is any way to use DamagePlayer() inside OnPlayerDamage ?
OnPlayerDamage is where you should finish processing and add finishing touches to the damage. If you return 1 the damage will be done anyways so why would you want to use DamagePlayer in that callback at all?
Reply

Quote:
Originally Posted by Crayder
View Post
OnPlayerDamage is where you should finish processing and add finishing touches to the damage. If you return 1 the damage will be done anyways so why would you want to use DamagePlayer in that callback at all?
Well, i would like to make a headshot system.. if body part == 9 and weapon == 34 The player dies instantly. But using damageplayer in onplayerdamage callback will lead to endless loop (because damageplayer calls onplayerdamage)
Reply

Quote:
Originally Posted by blastdap
View Post
OMG, Ty Slice, it worked!! you're is best

you don't know how i'm happy bro!

Fixed code:


(I'm learning pawn, that is why i'm have difficult in a "simple" thing ;-; )

rep ++
You did one thing wrong though! Do it like this intead:
pawn Code:
if (issuerid != INVALID_PLAYER_ID)
Reply

Slice, i downloaded weapon-config and put include folder, in gamemode

Code:
#include <a_samp>
#include <weapon-config>
#include <SKY>
but shows error: weapon-config.inc(5426) : error 025: function heading differs from prototype
Reply

Quote:
Originally Posted by Fungi
View Post
Well, i would like to make a headshot system.. if body part == 9 and weapon == 34 The player dies instantly. But using damageplayer in onplayerdamage callback will lead to endless loop (because damageplayer calls onplayerdamage)
Exactly my point. You don't need to use DamagePlayer at all in that callback. Just do the following:
pawn Code:
public OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart)
{
    if(bodypart == 9 && weapon == 34)
        amount = 100.0;
    return 1;
}
That will cause the player to die in OnPlayerDamageDone.
Reply

Quote:
Originally Posted by Crayder
View Post
Exactly my point. You don't need to use DamagePlayer at all in that callback. Just do the following:
pawn Code:
public OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart)
{
    if(bodypart == 9 && weapon == 34)
        amount = 100.0;
    return 1;
}
That will cause the player to die in OnPlayerDamageDone.
Oh thanks. I didnt know it works that way
Reply

If you want someone to die (even if they have armour or 99999 health), just set amount to 0.0.

@RogerCosta: Update your samp inlcludes and show me your code
Reply

I updated samp includes, and error continues

Code:
#include <a_samp>
#include <weapon-config>
#include <SKY>
#include <zcmd>
#include <sscanf2>
#include <foreach>
#include <SII>
#include <cpstream>
#include "../include/gl_common.inc"
Line of error (in red):
Code:
#if defined _ALS_OnPlayerDamage
	#undef OnPlayerDamage
#else
	#define _ALS_OnPlayerDamage
#endif
#define OnPlayerDamage WC_OnPlayerDamage
#if defined WC_OnPlayerDamage
	forward WC_OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart);
#endif
If i don't use OnPlayerDamage, and run F5 for compile, compile normally. But, i put OnPlayerDamage, and f5 for compile, show error above

*Sorry for my bad english
Reply

Show me your OnPlayerDamage, OnPlayerWeaponShot, OnPlayerDamageDone
Reply

Edit: OnPlayerDamage and OnPlayerDamageDone is empty, and OnPlayerWeaponShot i don't use in my script.
Код:
public OnPlayerDamageDone(playerid, Float:amount, issuerid, weapon, bodypart)
{
	return 1;
}

public OnPlayerDamage(playerid, Float:amount, issuerid, weapon, bodypart)
{	
	return 1;
}
Reply

EDIT: Never mind figured it out.
Reply


Forum Jump:


Users browsing this thread: 9 Guest(s)