SA-MP Forums Archive
[Include] weapon-config.inc - Damage system with many features - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Filterscripts (https://sampforum.blast.hk/forumdisplay.php?fid=17)
+---- Forum: Includes (https://sampforum.blast.hk/forumdisplay.php?fid=83)
+---- Thread: [Include] weapon-config.inc - Damage system with many features (/showthread.php?tid=563387)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24


Re: weapon-config.inc - Damage system with many features - Slice - 16.09.2015

Quote:
Originally Posted by RogerCosta
Посмотреть сообщение
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;
}
Your OnPlayerDamage is wrong..

pawn Код:
public OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart)
The reason the ampersands are there (&) is you can edit all arguments.

For example, if you want to make interior damage reverse (if you damage someone in an interior, you will lose damage and not the other player) do this:

pawn Код:
public OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart)
{
    if (GetPlayerInterior(playerid) != 0 && issuerid != INVALID_PLAYER_ID) {
        new tmp = playerid;
        playerid = issuerid;
        issuerid = playerid;
    }

    return 1;
}



Re: weapon-config.inc - Damage system with many features - RogerCosta - 16.09.2015

Thanks Slice. Compile normaly.

Other quenstion: my scripts int OnPlayerDeath, i move to OnPlayerDamageDone?

*I'm NikO from server GangZone Interior system


Re: weapon-config.inc - Damage system with many features - Crayder - 16.09.2015

Quote:
Originally Posted by RogerCosta
Посмотреть сообщение
Thanks Slice. Compile normaly.

Other quenstion: my scripts int OnPlayerDeath, i move to OnPlayerDamageDone?

*I'm NikO from server GangZone Interior system
OnPlayerDeath is still called normally. OnPlayerDamageDone and OnPlayerDeath are two completely different callbacks. One is called when damaged is completely processed and the other is called when a death is processed.


Re: weapon-config.inc - Damage system with many features - Jerry[TH] - 18.09.2015

I need have with these errors
pawno\include\weapon-config.inc(2824) : error 025: function heading differs from prototype
\pawno\include\weapon-config.inc(3071) : error 025: function heading differs from prototype

please help


Re: weapon-config.inc - Damage system with many features - Patchwerk - 18.09.2015

Fixed Slice

Код:
public OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart)
{
    if (GetPlayerInterior(playerid) != 0 && issuerid != INVALID_PLAYER_ID) {
        new tmp = playerid;
        playerid = issuerid;
        issuerid = tmp;
    }

    return 1;
}



Re: weapon-config.inc - Damage system with many features - RogerCosta - 18.09.2015

Quote:
Originally Posted by Jerry[TH]
Посмотреть сообщение
I need have with these errors
pawno\include\weapon-config.inc(2824) : error 025: function heading differs from prototype
\pawno\include\weapon-config.inc(3071) : error 025: function heading differs from prototype

please help
Show your OnPlayer(Take/Give)Damage. Also, Weapon-Config adds OnPlayerDamage, this function replace Take/Give functions.

--

Link SKY plugin for Linux Server 0.3.7 R2-1, please? Or R2

*Sorry my bad english.


Re: weapon-config.inc - Damage system with many features - blastdap - 19.09.2015

I'm having a lil' problem here, player picks pickup on death, how i can fix that? :/


Re: weapon-config.inc - Damage system with many features - Crayder - 19.09.2015

Quote:
Originally Posted by blastdap
Посмотреть сообщение
I'm having a lil' problem here, player picks pickup on death, how i can fix that? :/
The player doesn't actually die, so pickups are able to be picked up by the "dead" player. The simplest solutions would be either spread the pickups out away from the player or create the pickups after the player has spawned. If I were you I would do the second one.


Re: weapon-config.inc - Damage system with many features - Patchwerk - 19.09.2015

Or you can use "IsPlayerDying"
something like this
Code:
public OnPlayerPickUpPickup(playerid, pickupid){
if(IsPlayerDying(playerid)) return 0;

//all other things here
if(pickupid....)
return 1;
}



Re: weapon-config.inc - Damage system with many features - blastdap - 19.09.2015

Quote:
Originally Posted by Slice
View Post
I tried to prevent them from being picked up, but it's rather tricky.

I would suggest you create the pickups in OnPlayerDeathFinished, instead of OnPlayerDeath.
Yea, i put it in this callback and now works like a charm ty again.

BTW, there some errors in WC's github page like:

Quote:
Code:
SetCustomFallDamageMachines(bool:toggle);
Toggle vending machines (they are removed and disabled by default)

and

Quote:
Code:
public OnPlayerDeathFinished(playerid);
When the death animation has finished and the player has been sent to respawn




Re: weapon-config.inc - Damage system with many features - RogerCosta - 20.09.2015

Slice or Crayder, in OnPlayerPrepareDeath:
Code:
public OnPlayerPrepareDeath(playerid, animlib[32], animname[32], &anim_lock, &respawn_time)
{
    // P_SHOOTEDBODY detect bodypart player shooted, in OnPlayerDamageDone
    respawn_time = 5000;
    anim_lock = 1;
	if(PLAYER_INFO[playerid][P_SHOOTEDBODY] != -1)
	{
		if(PLAYER_INFO[playerid][P_SHOOTEDBODY] == SHOOTED_FRONT_CHEST)
		{
		    animlib = "PED";
		    animname = "KO_shot_stom";
		}
		else if(PLAYER_INFO[playerid][P_SHOOTEDBODY] == SHOOTED_FRONT_HEAD)
		{
		    animlib = "PED";
		    animname = "KO_shot_face";
		}
		else if(PLAYER_INFO[playerid][P_SHOOTEDBODY] == SHOOTED_FRONT_TORSO)
		{
		    animlib = "PED";
		    animname = "KO_shot_stom";
		}
		else if(PLAYER_INFO[playerid][P_SHOOTEDBODY] == SHOOTED_BACK_TORSO)
		{
		    animlib = "PED";
		    animname = "KO_skid_back";
		}
		else if(PLAYER_INFO[playerid][P_SHOOTEDBODY] == SHOOTED_BACK_HEAD)
		{
			animlib = "FINALE";
		    animname = "FIN_Land_Die";
		}
	}
	else
	{
		animlib = "PED";
	    animname = "KO_skid_back";
	}
	PLAYER_INFO[playerid][P_SHOOTEDBODY] = -1;
	return true;
}
Its correct? Or or I have to use ApplyAnimation (if yes, i don't understand options animlib[32] and animname[32] in functions)

---

Issue here: After player death (with killerid != INVALID_PLAYER_ID), server crashs. If i type /kill, set health to 0.0, dies normaly, and no crash. I put in pastebin my OnPlayerDeath, OnPlayerPrepareDeath, OnPlayerDamage(Done): http://pastebin.com/hEXwzW2u

i make comments in pastebin, ok?

Edit: i use SAMP Server Linux 0.3.7 R2-1 on my server.


Re: weapon-config.inc - Damage system with many features - Slice - 20.09.2015

Could you use crashdetect and show me the server log output?


Re: weapon-config.inc - Damage system with many features - ExTaZZ69 - 20.09.2015

Slice, can you add a function like TogglePlayerDamageInformer to show/hide the damage informer textdraws?


Re: weapon-config.inc - Damage system with many features - RogerCosta - 20.09.2015

Quote:
Originally Posted by Slice
View Post
Could you use crashdetect and show me the server log output?
Yes, one moment.

Quote:
Originally Posted by ExTaZZ69
View Post
Slice, can you add a function like TogglePlayerDamageInformer to show/hide the damage informer textdraws?
SetDamageFeed(false); ?


Re: weapon-config.inc - Damage system with many features - M0HAMMAD - 20.09.2015

Very nice include !


Re: weapon-config.inc - Damage system with many features - ExTaZZ69 - 20.09.2015

Quote:
Originally Posted by RogerCosta
View Post
SetDamageFeed(false); ?
Oh, thanks a lot . But i think is not per player function.


Re: weapon-config.inc - Damage system with many features - ExTaZZ69 - 20.09.2015

(Double post )


Re: weapon-config.inc - Damage system with many features - Jeroen52 - 20.09.2015

Quote:
Originally Posted by ExTaZZ69
View Post
Oh, thanks a lot . But i think is not per player function.
Indeed it isn't, I'm waiting for a per player function as well.


Re: weapon-config.inc - Damage system with many features - Slice - 20.09.2015

There's a button to make a pull request on GitHub. It's easy to add features!


Re: weapon-config.inc - Damage system with many features - Jeroen52 - 20.09.2015

Quote:
Originally Posted by Slice
View Post
There's a button to make a pull request on GitHub. It's easy to add features!
I might give it a go.