AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Damage Done, By Single Shot. (https://forums.alliedmods.net/showthread.php?t=3570)

Dygear 07-10-2004 00:19

Damage Done, By Single Shot.
 
I want this to be called every time someone is shot, and to the player that did the shooting to be sent a message containing how much damage was done by that shot.

Code:
public damage_color(id){     new dyTeam[32], dyDamage[32]     get_user_team(id, dyTeam, 2)     // Place Damage Done Here, please make it read into dyDamage.     if(dyTeam == "co"){         set_hudmessage(0, 0, 255, -0.50, 0.45, 0, 3.0, 6.0, 0, 0, 3)         show_hudmessage(0,"%s",dyDamage)     }else{         set_hudmessage(255, 0, 0, -0.50, 0.45, 0, 3.0, 6.0, 0, 0, 3)         show_hudmessage(0,"%s",dyDamage)     } }

Ryan 07-10-2004 23:44

Code:
public Ev_Damage( vIndex ) {     new aIndex = get_user_attacker( vIndex );     new iDamage = read_data( 2 );     new szName[32];     get_user_name( vIndex, szName, 31 );     new szMessage[128];     format( szMessage, 127, "You dealt %i damage to %s.", iDamage, szName );     // .. display this message however.     return PLUGIN_CONTINUE; } register_plugin() {     // ... other stuff in here     register_event( "Damage", "Ev_Damage", "b" );     return PLUGIN_CONTINUE; }

Hope this helps :)

jtp10181 07-10-2004 23:47

have a whole plugin that does this....

Code:
#include <amxmod> public on_damage(id) {   new attacker = get_user_attacker(id)   if (is_user_alive(id) && is_user_alive(attacker)) {     new damage = read_data(2)     set_hudmessage(0, 100, 200, -1.0, 0.55, 2, 0.1, 4.0, 0.02, 0.02, 12)     show_hudmessage(attacker,"%i^n", damage)     set_hudmessage(255, 0, 0, 0.45, 0.50, 2, 0.1, 4.0, 0.1, 0.1, 13)     show_hudmessage(id,"%i^n",damage)   }   return PLUGIN_CONTINUE } public plugin_init() {    register_plugin("Damage Done","0.4","Manip")    register_event("Damage", "on_damage", "b", "2!0", "3=0", "4!0")    return PLUGIN_CONTINUE }

its for amx... but I think its an easy port ;)

Dygear 07-11-2004 00:19

Thanks soo much, ill take a look at the code, and tell you if it works out.
(My plugin that is going to use this is not like 95% done.)

[EDIT] IT WORKS, YES, YOU GUYS ROCK!.

Dygear 07-20-2004 05:55

I edited the code for this ever so slightly, and I get errors.

Quote:

Originally Posted by The jtp10181 Way
Code:

The instruction at 0x0041c40a referenced memory at 0x00000008.
The memory could not be read.

Code:
/******************************************************************************** * Plugin name       : Damage Done. * Made by       : Dygear * Modules required  : None * Warranties        : This file is provided as is (no warranties). * Thanks to     : TaL for this idea, and Lud for all of his help and puting *             up with me for soo long. ********************************************************************************/ #include <amxmodx> #include <cstrike> public on_damage(id){     new attacker = get_user_attacker(id)     new damage = read_data(2)     if (is_user_alive(id) && is_user_alive(attacker)){         if (cs_get_user_team(id) == "CS_TEAM_CT"){             set_hudmessage(0, 100, 200, -1.0, 0.50, 2, 0.1, 4.0, 0.02, 0.02, 12)             show_hudmessage(attacker,"%i^n", damage)         }else{             set_hudmessage(255, 0, 0, -1.0, 0.50, 2, 0.1, 4.0, 0.1, 0.1, 13)             show_hudmessage(id,"%i^n",damage)         }     return PLUGIN_CONTINUE } public plugin_init(){     register_plugin("Damage Done","0.1","Dygear")     register_event("Damage", "on_damage", "b", "2!0", "3=0", "4!0")     return PLUGIN_CONTINUE }

Quote:

Originally Posted by The Ryan Way
Code:

The instruction at 0x0041c40a referenced memory at 0x00000008.
The memory could not be read.

Code:
/******************************************************************************** * Plugin name       : Damage Done. * Made by           : Dygear * Modules required  : None * Warranties        : This file is provided as is (no warranties). * Thanks to         : TaL for this idea, and Lud for all of his help and puting *                     up with me for soo long. ********************************************************************************/ #include <amxmodx> #include <cstrike> public ev_damage( vIndex ){     new aIndex = get_user_attacker( vIndex );     new iDamage = read_data( 2 );     if (cs_get_user_team( vIndex ) == "CS_TEAM_CT"){         set_hudmessage(0, 100, 200, -1.0, 0.50, 2, 0.1, 4.0, 0.02, 0.02, 12)         show_hudmessage( vIndex , "%i^n" , iDamage)     }else{         set_hudmessage(255, 0, 0, -1.0, 0.50, 2, 0.1, 4.0, 0.1, 0.1, 13)         show_hudmessage( vIndex , "%i^n" , iDamage)     } } register_plugin(){     register_plugin("Damage Done","0.1","Dygear")     register_event( "Damage", "ev_damage", "b" );     return PLUGIN_CONTINUE; }


Quote:

Originally Posted by The Dygear Way
Code:

The instruction at 0x0041c40a referenced memory at 0x00000008.
The memory could not be read.

Code:
/******************************************************************************** * Plugin name       : Damage Done. * Made by           : Dygear * Modules required  : None * Warranties        : This file is provided as is (no warranties). * Thanks to         : TaL for this idea. *                     Lud for all of his help and puting up with me for soo long. ********************************************************************************/ #include <amxmodx> #include <cstrike> public on_damage(id){     new attacker = get_user_attacker(id)     if (is_user_alive(id) && is_user_alive(attacker)){         if (cs_get_user_team(id) == "CS_TEAM_CT"){             new damage = read_data(2)             set_hudmessage(0, 100, 200, -1.0, 0.50, 2, 0.1, 4.0, 0.02, 0.02, 12)             show_hudmessage(attacker,"%i^n", damage)         }else{             new damage = read_data(2)             set_hudmessage(255, 0, 0, -1.0, 0.50, 2, 0.1, 4.0, 0.1, 0.1, 13)             show_hudmessage(id,"%i^n",damage)         }     }     return PLUGIN_CONTINUE } public plugin_init(){     register_plugin("Damage Done","0.1","Dygear")     register_event("Damage", "on_damage", "b", "2!0", "3=0", "4!0")     return PLUGIN_CONTINUE }


Freecode 07-20-2004 06:19

ur missing a closing bracket }
also in hud messages theres only 4 channels.

Dygear 07-20-2004 06:26

LOL, its allways the stupid littel things.
[EDIT] Still not working.

jtp10181 07-20-2004 08:10

might want to try and put the read_data thing outaside the if blocks and only have it once.

paste your new code and I will tery it out later

AlucarD_fOx 07-22-2004 00:57

Sorry, error in my Iexplorer... :oops:

AlucarD_fOx 07-22-2004 01:01

What´s plugin works correct? I have the bullet_damage and this plugin dont work too, the message of damage dont show in screen of atacker...

Thank´s to help me... :D


All times are GMT -4. The time now is 14:36.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.