Raised This Month: $ Target: $400
 0% 

help me edit a script!!


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mikaelnatan13
Member
Join Date: Apr 2020
Old 06-04-2020 , 19:08   help me edit a script!!
Reply With Quote #1

I was wondering if you could help me with a script

wanted to show adding up all the hits to know how much total damage I gave

script

PHP Code:
#include <amxmodx>

#define PLUGIN "CS Revo: Danos causados"
#define VERSION "1.0"
#define AUTHOR "Wilian M."

new xMsgSync[2]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("Damage""xOnDamage""b""2!0""3=0""4!0")    
    
    
xMsgSync[0] = CreateHudSyncObj()    
    
xMsgSync[1] = CreateHudSyncObj()
}

public 
xOnDamage(id)
{
    static 
xAttackerxDamage
    
    xAttacker 
get_user_attacker(id)
    
xDamage read_data(2)
    
    
set_hudmessage(255000.450.5000.13.00.10.1)
    
ShowSyncHudMsg(idxMsgSync[1], "%i"xDamage)    
    
    if(
is_user_connected(xAttacker))
    {
        
set_hudmessage(0100200, -1.00.5500.13.00.020.02)
        
ShowSyncHudMsg(xAttackerxMsgSync[0], "%i"xDamage)        
    }


Last edited by Bugsy; 06-04-2020 at 19:55.
mikaelnatan13 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-04-2020 , 19:55   Re: help me edit a script!!
Reply With Quote #2

Please use php tags when posting code.
__________________
Bugsy is offline
mikaelnatan13
Member
Join Date: Apr 2020
Old 06-04-2020 , 22:37   Re: help me edit a script!!
Reply With Quote #3

Quote:
Originally Posted by Bugsy View Post
Please use php tags when posting code.
ok
mikaelnatan13 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-04-2020 , 22:48   Re: help me edit a script!!
Reply With Quote #4

Here are some tips:

Define xDamage globally, as an array, sized using MAX_PLAYERS + 1.

In xOnDamage, you would do xDamage[ id ] += read_data( 2 ).

Set the slot value to 0 on client_disconnect(). Or at new round if that is when you want it reset. If you want to reset everyone, you can use arrayset().
__________________
Bugsy is offline
mikaelnatan13
Member
Join Date: Apr 2020
Old 06-04-2020 , 22:56   Re: help me edit a script!!
Reply With Quote #5

Quote:
Originally Posted by Bugsy View Post
Here are some tips:

Define xDamage globally, as an array, sized using MAX_PLAYERS + 1.

In xOnDamage, you would do xDamage[ id ] += read_data( 2 ).

Set the slot value to 0 on client_disconnect(). Or at new round if that is when you want it reset. If you want to reset everyone, you can use arrayset().
sorry i'm very new to this script business and i didn't understand very well
mikaelnatan13 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-04-2020 , 23:06   Re: help me edit a script!!
Reply With Quote #6

You should have posted in Suggestions/Requests if you are not trying to code this yourself.

Here's what I just said, see if you can figure out where it goes.
PHP Code:
//Make this global (placed towards the top of the plugin, delete xDamage in the xOnDamage function
new xDamageMAX_PLAYERS 

//Replace 
xDamage read_data(2)
//with
xDamagexAttacker ] += read_data
__________________

Last edited by Bugsy; 06-04-2020 at 23:07.
Bugsy is offline
mikaelnatan13
Member
Join Date: Apr 2020
Old 06-04-2020 , 23:22   Re: help me edit a script!!
Reply With Quote #7

Quote:
Originally Posted by Bugsy View Post
You should have posted in Suggestions/Requests if you are not trying to code this yourself.

Here's what I just said, see if you can figure out where it goes.
PHP Code:
//Make this global (placed towards the top of the plugin, delete xDamage in the xOnDamage function
new xDamageMAX_PLAYERS 

//Replace 
xDamage read_data(2)
//with
xDamagexAttacker ] += read_data
it would look something like this

PHP Code:
#include <amxmodx>

#define PLUGIN "CS Revo: Danos causados"
#define VERSION "1.0"
#define AUTHOR "Wilian M."

new xMsgSync[2]
new 
xDamageMAX_PLAYERS ]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("Damage""xOnDamage""b""2!0""3=0""4!0")    
    
    
xMsgSync[0] = CreateHudSyncObj()    
    
xMsgSync[1] = CreateHudSyncObj()
}

public 
xOnDamage(id)
{
    static 
xAttackerxDamage
    
    xAttacker 
get_user_attacker(id)
    
xDamagexAttacker ] += read_data
    
    
set_hudmessage(255000.450.5000.13.00.10.1)
    
ShowSyncHudMsg(idxMsgSync[1], "%i"xDamage)    
    
    if(
is_user_connected(xAttacker))
    {
        
set_hudmessage(0100200, -1.00.5500.13.00.020.02)
        
ShowSyncHudMsg(xAttackerxMsgSync[0], "%i"xDamage)        
    }


Last edited by mikaelnatan13; 06-04-2020 at 23:25.
mikaelnatan13 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 06-04-2020 , 23:27   Re: help me edit a script!!
Reply With Quote #8

You forgot to delete xDamage in xOnDamge. "static xAttacker , xDamage" , delete ", xDamage"

And everywhere else you see xDamage in xOnDamage, you need to change it to xDamage[ xAttacker ]. This will reflect the total damage issued, not the single amount of damage.
__________________
Bugsy is offline
mikaelnatan13
Member
Join Date: Apr 2020
Old 06-04-2020 , 23:35   Re: help me edit a script!!
Reply With Quote #9

Quote:
Originally Posted by Bugsy View Post
You forgot to delete xDamage in xOnDamge. "static xAttacker , xDamage" , delete ", xDamage"

And everywhere else you see xDamage in xOnDamage, you need to change it to xDamage[ xAttacker ]. This will reflect the total damage issued, not the single amount of damage.
like this
PHP Code:
#include <amxmodx>

#define PLUGIN "CS Revo: Danos causados"
#define VERSION "1.0"
#define AUTHOR "Wilian M."

new xMsgSync[2]
new 
xDamageMAX_PLAYERS ]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_event("Damage""xOnDamage""b""2!0""3=0""4!0")    
    
    
xMsgSync[0] = CreateHudSyncObj()    
    
xMsgSync[1] = CreateHudSyncObj()
}

public 
xOnDamage(id)
{
    static 
xAttacker
    
    xAttacker 
get_user_attacker(id)
    
xDamagexAttacker ] += read_data
    
    
set_hudmessage(255000.450.5000.13.00.10.1)
    
ShowSyncHudMsg(idxMsgSync[1], "%i"xDamage [xAttacker])    
    
    if(
is_user_connected(xAttacker))
    {
        
set_hudmessage(0100200, -1.00.5500.13.00.020.02)
        
ShowSyncHudMsg(xAttackerxMsgSync[0], "%i"xDamage [xAttacker])        
    }


Last edited by mikaelnatan13; 06-04-2020 at 23:38.
mikaelnatan13 is offline
mikaelnatan13
Member
Join Date: Apr 2020
Old 06-04-2020 , 23:40   Re: help me edit a script!!
Reply With Quote #10

the code would look like this?

Last edited by mikaelnatan13; 06-04-2020 at 23:44.
mikaelnatan13 is offline
Reply



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

Forum Jump


All times are GMT -4. The time now is 16:57.


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