SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 03/09/2016, 08:15 PM   #571
hossa
Huge Clucker
 
hossa's Avatar
 
Join Date: Dec 2011
Location: Around here.
Posts: 470
Reputation: 194
Default Re: weapon-config.inc - Damage system with many features

I've had a small problem with weapon-config, I'm not sure what's wrong.

PHP Code:
public OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart)
{
    new 
Float:hp;
    if(
team[playerid] == 1)
    {
        if(
weapon == 34)
        {
            
GetPlayerHealth(playeridhp);
            
SetPlayerHealth(playeridhp -34);
        }
    }
    return 
1;

The problem is, Once The player hits 0 or less than 0, The player stops taking damage and doesn't die.
__________________

Contact me: Private Message
hossa is offline   Reply With Quote
Old 11/09/2016, 10:29 AM   #572
AlirezaHypeR
Little Clucker
 
Join Date: Aug 2016
Posts: 1
Reputation: 0
Default Re: weapon-config.inc - Damage system with many features

slice Please help
i use fcnpc plugin for my gamemod but when npc attacks player that player doesn't take any damage
please help
AlirezaHypeR is offline   Reply With Quote
Old 18/09/2016, 08:51 AM   #573
Dodo9655
Big Clucker
 
Dodo9655's Avatar
 
Join Date: Sep 2008
Location: Romania
Posts: 150
Reputation: 29
Default Re: weapon-config.inc - Damage system with many features

This include seems to cause FPS drops. I have tested both the Linux and Windows versions of SKY plugin.
Without this include and without SKY plugin I get ~90 FPS.

With them both, I get drops down to ~45 FPS but this only happens strangely when looking at a certain area around the 0.0 0.0 0.0 location.

Code:
#include <a_samp>
#undef MAX_PLAYERS
#define MAX_PLAYERS (5)

#define FIXES_Single 1
#define FIX_GetWeaponName 0
#define FIX_GetPlayerWeapon 0
#define FIX_AllowTeleport 0
#define FIX_OnPlayerDeath 0
#define FIX_Kick 0
#define FIX_BODYPARTS 0
#include <fixes>

#include <weapon-config>
#include <a_mysql>
#include <streamer>
#include <sscanf2>
#include <YSI\y_timers>
#include <YSI\y_iterate>
#include <Pawn.CMD>
#include <easyDialog>
#include <VehModEx>
Dodo9655 is offline   Reply With Quote
Old 18/09/2016, 09:48 AM   #574
Slice
High-roller
 
Join Date: Mar 2008
Posts: 1,831
Reputation: 1607
Default Re: weapon-config.inc - Damage system with many features

Quote:
Originally Posted by Dodo9655 View Post
This include seems to cause FPS drops. I have tested both the Linux and Windows versions of SKY plugin.
Without this include and without SKY plugin I get ~90 FPS.

With them both, I get drops down to ~45 FPS but this only happens strangely when looking at a certain area around the 0.0 0.0 0.0 location.

Code:
#include <a_samp>
#undef MAX_PLAYERS
#define MAX_PLAYERS (5)

#define FIXES_Single 1
#define FIX_GetWeaponName 0
#define FIX_GetPlayerWeapon 0
#define FIX_AllowTeleport 0
#define FIX_OnPlayerDeath 0
#define FIX_Kick 0
#define FIX_BODYPARTS 0
#include <fixes>

#include <weapon-config>
#include <a_mysql>
#include <streamer>
#include <sscanf2>
#include <YSI\y_timers>
#include <YSI\y_iterate>
#include <Pawn.CMD>
#include <easyDialog>
#include <VehModEx>
That is because RemoveBuilding causes lag at 0, 0, 0. This include uses RemoveBuilding to remove vending machines. If you do not wish to have that functionality, you can so this:
pawn Code:
#define WC_CUSTOM_VENDING_MACHINES false
#include <weapon-config>
Slice is offline   Reply With Quote
Old 18/09/2016, 11:03 AM   #575
Jeroen52
Gangsta
 
Jeroen52's Avatar
 
Join Date: Oct 2008
Location: The Netherlands
Posts: 882
Reputation: 74
Default Re: weapon-config.inc - Damage system with many features

Quote:
Originally Posted by hossa View Post
I've had a small problem with weapon-config, I'm not sure what's wrong.

PHP Code:
public OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart)
{
    new 
Float:hp;
    if(
team[playerid] == 1)
    {
        if(
weapon == 34)
        {
            
GetPlayerHealth(playeridhp);
            
SetPlayerHealth(playeridhp -34);
        }
    }
    return 
1;

The problem is, Once The player hits 0 or less than 0, The player stops taking damage and doesn't die.
What are you trying to accomplish?
__________________
Jeroen52 is offline   Reply With Quote
Old 18/09/2016, 02:50 PM   #576
Fairuz
Huge Clucker
 
Fairuz's Avatar
 
Join Date: Sep 2015
Location: Indonesia
Posts: 467
Reputation: 89
Default Re: weapon-config.inc - Damage system with many features

How do I add headshot system,can someone give me an example?
And also,How do I set damage for specific weapons?
__________________
Los Santos based Cops and Robbers with many features.
178.128.82.211:7777
Fairuz is offline   Reply With Quote
Old 18/09/2016, 05:29 PM   #577
Jeroen52
Gangsta
 
Jeroen52's Avatar
 
Join Date: Oct 2008
Location: The Netherlands
Posts: 882
Reputation: 74
Default Re: weapon-config.inc - Damage system with many features

Quote:
Originally Posted by Dice_ View Post
How do I add headshot system,can someone give me an example?
And also,How do I set damage for specific weapons?
Here are a couple examples, I encourage you to read it as I have written them specifically for this post.
Code:
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(IsBulletWeapon(weapon) && bodypart == BODY_PART_HEAD) // Check if the weapon can fire bullets, and if the shot bodypart is a head.
			amount *= 1.3; // Multiply the amount by 1.3
		
		if(weapon == WEAPON_RIFLE && bodypart == BODY_PART_HEAD) // Check if the weapon is the cuntgun, and if the shot bodypart is a head.
			amount = 72; // Set the damage to 72
		
		if(weapon == WEAPON_SNIPER && bodypart == BODY_PART_HEAD) // Check if the weapon is a sniper rifle, and if the shot bodypart is a head.
			amount = 99.90; // Set the damage to 99.90
			
	}
	
	/*  
	 *  Another example below is how to make on-duty admins immune to all types of damage.
	 *  Replace the examples with the equivalent of your admin system.
	 */
	
	if(playerAdminLevel(playerid) > 2) // Checking if the player is above a specific admin level
	{
		if(InAdminMode[playerid] >= 1 || pInfo[playerid][pGodMode] == 1) // Check if the player is in either admin mode or godmode
		{
			return 0; // If you return 0, the damage will not be issued.
		}
	}
	return 1; // Return 1 to issue the damage
}
__________________
Jeroen52 is offline   Reply With Quote
Old 18/09/2016, 05:50 PM   #578
hossa
Huge Clucker
 
hossa's Avatar
 
Join Date: Dec 2011
Location: Around here.
Posts: 470
Reputation: 194
Default Re: weapon-config.inc - Damage system with many features

Quote:
Originally Posted by Jeroen52 View Post
What are you trying to accomplish?
Modify sniper damage to 34 instead of default damage.
__________________

Contact me: Private Message
hossa is offline   Reply With Quote
Old 18/09/2016, 06:02 PM   #579
Jeroen52
Gangsta
 
Jeroen52's Avatar
 
Join Date: Oct 2008
Location: The Netherlands
Posts: 882
Reputation: 74
Default Re: weapon-config.inc - Damage system with many features

Quote:
Originally Posted by hossa View Post
Modify sniper damage to 34 instead of default damage.
I have just posted this reply, this should answer your question.

http://forum.sa-mp.com/showpost.php?...&postcount=577

If you have more questions or are stuck on something, do ask.
__________________
Jeroen52 is offline   Reply With Quote
Old 18/09/2016, 10:33 PM   #580
Fairuz
Huge Clucker
 
Fairuz's Avatar
 
Join Date: Sep 2015
Location: Indonesia
Posts: 467
Reputation: 89
Default Re: weapon-config.inc - Damage system with many features

Quote:
Originally Posted by Jeroen52 View Post
Here are a couple examples, I encourage you to read it as I have written them specifically for this post.
Code:
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(IsBulletWeapon(weapon) && bodypart == BODY_PART_HEAD) // Check if the weapon can fire bullets, and if the shot bodypart is a head.
			amount *= 1.3; // Multiply the amount by 1.3
		
		if(weapon == WEAPON_RIFLE && bodypart == BODY_PART_HEAD) // Check if the weapon is the cuntgun, and if the shot bodypart is a head.
			amount = 72; // Set the damage to 72
		
		if(weapon == WEAPON_SNIPER && bodypart == BODY_PART_HEAD) // Check if the weapon is a sniper rifle, and if the shot bodypart is a head.
			amount = 99.90; // Set the damage to 99.90
			
	}
	
	/*  
	 *  Another example below is how to make on-duty admins immune to all types of damage.
	 *  Replace the examples with the equivalent of your admin system.
	 */
	
	if(playerAdminLevel(playerid) > 2) // Checking if the player is above a specific admin level
	{
		if(InAdminMode[playerid] >= 1 || pInfo[playerid][pGodMode] == 1) // Check if the player is in either admin mode or godmode
		{
			return 0; // If you return 0, the damage will not be issued.
		}
	}
	return 1; // Return 1 to issue the damage
}
Ah thanks a lot!
__________________
Los Santos based Cops and Robbers with many features.
178.128.82.211:7777
Fairuz is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with weapon damage system thanks JessThompson Scripting Help 7 15/07/2014 01:01 PM
[FilterScript] New Weapon Damage System [0.3z] RenSoprano Filterscripts 6 17/01/2014 06:03 AM
[FilterScript] Weapon damage system [v1.0] Darnell Filterscripts 74 21/10/2013 08:53 PM
[FilterScript] Weapon Damage System Donicans Filterscripts 14 06/11/2012 01:22 PM
[FilterScript] Realistic Weapon Damage And Death System [V1.0][New Cool FS] Nirzor Filterscripts 6 08/08/2012 05:34 AM


All times are GMT. The time now is 12:06 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.