19.08.2016, 10:40
[Include] weapon-config.inc - Damage system with many features
19.08.2016, 12:26
Gonna compile now. Will edit back with results.
// Now I don't get errors with a_mysql, but instead I get errors with YSI
How do I make YSI compatible with weapon-config? Do I remove the OnPlayerGiveDamage and the OnPlayerTakeDamage lines from YSI?
// Now I don't get errors with a_mysql, but instead I get errors with YSI
Код:
C:\-redacted for privacy--\pawno\include\YSI\y_hooks/impl.inc(2343) : error 021: symbol already defined: "OnPlayerTakeDamage" C:\-redacted for privacy--\pawno\include\YSI\y_hooks/impl.inc(2390) : error 021: symbol already defined: "OnPlayerGiveDamage"
19.08.2016, 14:10
Well, the reason you get this error is because I prevent people from accidentally using OnPlayerGiveDamage/OnPlayerTakeDamage.
Those should never be used.
Either you can remove the from YSI (ugly solution), or add this between weapon-config and the first YSI include:
Those should never be used.
Either you can remove the from YSI (ugly solution), or add this between weapon-config and the first YSI include:
pawn Код:
#if defined _ALS_OnPlayerGiveDamage
#undef OnPlayerGiveDamage
#else
#define _ALS_OnPlayerGiveDamage
#endif
#define OnPlayerGiveDamage NULL_OnPlayerGiveDamage
#if defined NULL_OnPlayerGiveDamage
forward NULL_OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid, bodypart);
#endif
#if defined _ALS_OnPlayerTakeDamage
#undef OnPlayerTakeDamage
#else
#define _ALS_OnPlayerTakeDamage
#endif
#define OnPlayerTakeDamage NULL_OnPlayerTakeDamage
#if defined NULL_OnPlayerTakeDamage
forward NULL_OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart);
#endif
19.08.2016, 15:50
(
Последний раз редактировалось FilipeSilvens; 19.08.2016 в 16:29.
)
Quote:
Well, the reason you get this error is because I prevent people from accidentally using OnPlayerGiveDamage/OnPlayerTakeDamage.
Those should never be used. Either you can remove the from YSI (ugly solution), or add this between weapon-config and the first YSI include: pawn Код:
|
// edit: just noticed i need to adapt my whole script to this include, this is more complicated than i thought
19.08.2016, 16:28
Look at the documentation on GitHub. Use OnPlayerDamage.
19.08.2016, 17:00
Actually it wasnt that hard. I figured it out. Now it works. But I have two issues. When I set a player's HP to 0, they don't die, any way to fix that? Second issue: The linux version of sky (.so) doesn't work (people don't lose health) but it works perfectly with the windows version (.dll), do you have a download link for the updated .so? I would really like to use this include on my server, because it's amazing and would cut off the health hackers. I would compile it myself but I can only compile the DLL version, I have no idea how to compile the .so version on windows.
19.08.2016, 17:32
I'm using this SKY Linux version
http://www.mediafire.com/download/fa...54m1ocq/SKY.so
By the way, are you using YSF? If yes, that could cause the problem with the "not losing health".
http://www.mediafire.com/download/fa...54m1ocq/SKY.so
By the way, are you using YSF? If yes, that could cause the problem with the "not losing health".
19.08.2016, 18:42
(
Последний раз редактировалось FilipeSilvens; 19.08.2016 в 19:27.
)
Quote:
I'm using this SKY Linux version
http://www.mediafire.com/download/fa...54m1ocq/SKY.so By the way, are you using YSF? If yes, that could cause the problem with the "not losing health". |
//Working perfectly, looks like I had an old version of SKY. thanks!
19.08.2016, 18:47
Quote:
Actually it wasnt that hard. I figured it out. Now it works. But I have two issues. When I set a player's HP to 0, they don't die, any way to fix that? Second issue: The linux version of sky (.so) doesn't work (people don't lose health) but it works perfectly with the windows version (.dll), do you have a download link for the updated .so? I would really like to use this include on my server, because it's amazing and would cut off the health hackers. I would compile it myself but I can only compile the DLL version, I have no idea how to compile the .so version on windows.
|
19.08.2016, 19:37
For example:
and also:
The code looks messy cuz it's just an example.
Код:
// OnPlayerDamage if(issuerid != playerid && weapon == 34 && bodypart == 9 && IsAHitman(issuerid) && GoChase[issuerid] == playerid) { new szMessage[64 + MAX_PLAYER_NAME]; new takemoney = floatround((PINFO[playerid][Bounty] / 4) * 2); GivePlayerCash(issuerid, takemoney); GivePlayerCash(playerid, -takemoney); format(szMessage, sizeof(szMessage),"Hitman %s has executed %s with a Sniper Rifle and collected $%d.",GetPlayerNameEx(issuerid),GetPlayerNameEx(playerid),takemoney); SendMessageToAllEx(COLOR_YELLOW, szMessage); format(szMessage, sizeof(szMessage),"You have been executed."); SendClientMessageEx(playerid, COLOR_YELLOW, szMessage); SetPlayerHealth(playerid, 0.0); // < Right here }
Код:
CMD:killplayer(playerid, params[]) { if(PlayerInfo[playerid][pAdmin] >= 4) { { new giveplayerid; if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /killplayer [player]"); SetPlayerHealth(giveplayerid, 0.0); // Also here } } return 1; }
03.09.2016, 20:15
I've had a small problem with weapon-config, I'm not sure what's wrong.
The problem is, Once The player hits 0 or less than 0, The player stops taking damage and doesn't die.
PHP код:
public OnPlayerDamage(&playerid, &Float:amount, &issuerid, &weapon, &bodypart)
{
new Float:hp;
if(team[playerid] == 1)
{
if(weapon == 34)
{
GetPlayerHealth(playerid, hp);
SetPlayerHealth(playerid, hp -34);
}
}
return 1;
}
11.09.2016, 10:29
slice Please help
i use fcnpc plugin for my gamemod but when npc attacks player that player doesn't take any damage
please help
i use fcnpc plugin for my gamemod but when npc attacks player that player doesn't take any damage
please help
18.09.2016, 08:51
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.
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.
Код:
#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>
18.09.2016, 09:48
Quote:
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. Код:
#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> |
pawn Код:
#define WC_CUSTOM_VENDING_MACHINES false
#include <weapon-config>
18.09.2016, 11:03
Quote:
I've had a small problem with weapon-config, I'm not sure what's wrong.
PHP код:
|
18.09.2016, 14:50
How do I add headshot system,can someone give me an example?
And also,How do I set damage for specific weapons?
And also,How do I set damage for specific weapons?
18.09.2016, 17:29
Quote:
How do I add headshot system,can someone give me an example?
And also,How do I set damage for specific weapons? |
Код:
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 }
18.09.2016, 17:50
18.09.2016, 18:02
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.
http://forum.sa-mp.com/showpost.php?...&postcount=577
If you have more questions or are stuck on something, do ask.
18.09.2016, 22:33
Quote:
Here are a couple examples, I encourage you to read it as I have written them specifically for this post.
Код:
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 } |
« Next Oldest | Next Newest »
Users browsing this thread: 17 Guest(s)