Raised This Month: $ Target: $400
 0% 

[Help] small plugin fix [Easy]


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
New and Clueless
Senior Member
Join Date: Dec 2015
Old 01-05-2016 , 14:21   [Help] small plugin fix [Easy]
Reply With Quote #1

hi this is a critical hit plugin, you get a random critical chance hit for this plugin on any random hit, and it is way too frequent, i want to make it only hit maybe 1 time in 3 clips (90 m4a1 or ak ammo)
so like 1:100 odds or something like that but it hits way too often, here is the plugin:

https://forums.alliedmods.net/showth...t=critical+hit

here is code
Spoiler


i was changing these numbers:
Code:
if( random_num( 0, 100 ) < random_num( 0, 100 ) < random_num( 0, 100 ) )


Code:
if( random_num( 0, 100000000 ) < random_num( 0, 100000000 ) < random_num( 0, 100000000 ) )
from testing it seems to have made it less frequent but not like i want it, its still doing like 5 crits every 30 ammo or even more than that. thank you!

Last edited by New and Clueless; 01-05-2016 at 14:22.
New and Clueless is offline
New and Clueless
Senior Member
Join Date: Dec 2015
Old 01-05-2016 , 15:06   Re: [Help] small plugin fix [Easy]
Reply With Quote #2

i also have another problem, for this plugin, i keep getting: ML_NOTFOUND REWARDS

https://forums.alliedmods.net/showth...ewards&page=18

it says on this to "1. Re-download the multi-lingual file(.txt).
It had a typing mistake and 2 of the messages couldn't
be shown being displayed as a "ML_NOTFOUND" error.
Now it's fixed..." but i cant find multi lingual file for download, so any ideas how to fix this bug?

here is code:
Spoiler


here is the .txt file included with this plugin
Spoiler

Last edited by New and Clueless; 01-05-2016 at 15:13.
New and Clueless is offline
Chihuahuax
Senior Member
Join Date: Oct 2014
Location: Malaysia
Old 01-05-2016 , 22:36   Re: [Help] small plugin fix [Easy]
Reply With Quote #3

Quote:
Originally Posted by New and Clueless View Post
hi this is a critical hit plugin, you get a random critical chance hit for this plugin on any random hit, and it is way too frequent, i want to make it only hit maybe 1 time in 3 clips (90 m4a1 or ak ammo)
so like 1:100 odds or something like that but it hits way too often, here is the plugin:

https://forums.alliedmods.net/showth...t=critical+hit

here is code
Spoiler


i was changing these numbers:
Code:
if( random_num( 0, 100 ) < random_num( 0, 100 ) < random_num( 0, 100 ) )


Code:
if( random_num( 0, 100000000 ) < random_num( 0, 100000000 ) < random_num( 0, 100000000 ) )
from testing it seems to have made it less frequent but not like i want it, its still doing like 5 crits every 30 ammo or even more than that. thank you!
What you've done is just changing the digits.
The ratio is still the same so I assume that your problem is not yet solved

Try
PHP Code:
if (random_num(01000) == 0
(Chance to get critical hit = 0.1%)

Last edited by Chihuahuax; 01-05-2016 at 22:41.
Chihuahuax is offline
Send a message via Skype™ to Chihuahuax
New and Clueless
Senior Member
Join Date: Dec 2015
Old 01-06-2016 , 01:12   Re: [Help] small plugin fix [Easy]
Reply With Quote #4

Quote:
Originally Posted by Chihuahuax View Post
What you've done is just changing the digits.
The ratio is still the same so I assume that your problem is not yet solved

Try
PHP Code:
if (random_num(01000) == 0
(Chance to get critical hit = 0.1%)
yes you are right, i cant compile it though, i replaced

Code:
		if( random_num( 0, 100000000 ) < random_num( 0, 100000000 ) < random_num( 0, 100000000 ) )


Code:
if (random_num(0, 1000) == 0)
and got this
Code:
//// zp_zcritical_hits_worseone.sma
// C:\Program Files (x86)\Steam\steamapps\common\Half-Life\cstrike\addons\amxmod
x\scripting\zp_zcritical_hits_worseone.sma(47) : error 029: invalid expression,
assumed zero
//
// 1 Error.
// Could not locate output file compiled\zp_zcritical_hits_worseone.amx (compile
 failed).
//
// Compilation Time: 0.11 sec
// ----------------------------------------
sorry i am noob , i dont know what i would do without you guys
New and Clueless is offline
Kakarot47
Senior Member
Join Date: May 2015
Location: Pakistan
Old 01-06-2016 , 06:53   Re: [Help] small plugin fix [Easy]
Reply With Quote #5

You need to learn dude
you need to understant about sequence
and you need to get understant about error mean


Sorry for bad english if its bad so
__________________



AssasinSniperNightmare ModArmageddon ModApolacyps Mod
Kakarot47 is offline
Send a message via Skype™ to Kakarot47
Kakarot47
Senior Member
Join Date: May 2015
Location: Pakistan
Old 01-06-2016 , 06:56   Re: [Help] small plugin fix [Easy]
Reply With Quote #6

Try out this critical plugin i hope it will work

PHP Code:
/*                    [ZP] Addon: Critical Hit
                by !Morte
    
    #Description :
            Make a random critical hit when you are shooting an a enemy
    
    #Cvars : 
            zp_criticalhit_damage "3.0" // Damage Multiplier
            
    #Credits : 
            meTaLiCroSS: From his "custom form" :P

    #Changelog : 
            v1.0: Plugin Release
            v1.1: Added some sounds and effects
            v1.2: Code fix, delete some redundant things and change some other things
*/

#include < amxmodx >
#include < hamsandwich >
#include < fakemeta >
#include < fun >
#include < zombieplague >

new const sound_critical[] = "critical_hit/critical_hit.wav"

new cvar_criticaldamage
new gSyncHud

public plugin_precache( ) engfuncEngFunc_PrecacheSoundsound_critical )

public 
plugin_init( )
{
    
register_plugin"Critical Hits""1.2""!Morte" )
    
    
cvar_criticaldamage register_cvar"zp_criticalhit_damage""3.0" )
    
    
RegisterHamHam_TakeDamage"player""fw_TakeDamage" )
    
    
gSyncHud CreateHudSyncObj( );
}

public 
fw_TakeDamagevictiminflictorattackerFloat:damagedamage_type )
{    
    if( !
zp_get_user_zombieattacker ) )
    {
        if (
random_num(01000) == 0)
        {
            
SetHamParamFloat4damage *= get_pcvar_floatcvar_criticaldamage ) )
            
            
client_cmdattacker"spk ^"%s^""sound_critical )
            
            
set_hudmessage02550, -1.0, -1.006.01.10.00.0)
            
ShowSyncHudMsgattackergSyncHud"%d^nCritical Hit!"floatrounddamage ) )
        }
        
        
SetHamParamFloat4damage )
    }
    
    return 
HAM_IGNORED;

__________________



AssasinSniperNightmare ModArmageddon ModApolacyps Mod
Kakarot47 is offline
Send a message via Skype™ to Kakarot47
New and Clueless
Senior Member
Join Date: Dec 2015
Old 01-06-2016 , 11:48   Re: [Help] small plugin fix [Easy]
Reply With Quote #7

Quote:
Originally Posted by Kakarot47 View Post
Try out this critical plugin i hope it will work

PHP Code:
/*                    [ZP] Addon: Critical Hit
                by !Morte
    
    #Description :
            Make a random critical hit when you are shooting an a enemy
    
    #Cvars : 
            zp_criticalhit_damage "3.0" // Damage Multiplier
            
    #Credits : 
            meTaLiCroSS: From his "custom form" :P

    #Changelog : 
            v1.0: Plugin Release
            v1.1: Added some sounds and effects
            v1.2: Code fix, delete some redundant things and change some other things
*/

#include < amxmodx >
#include < hamsandwich >
#include < fakemeta >
#include < fun >
#include < zombieplague >

new const sound_critical[] = "critical_hit/critical_hit.wav"

new cvar_criticaldamage
new gSyncHud

public plugin_precache( ) engfuncEngFunc_PrecacheSoundsound_critical )

public 
plugin_init( )
{
    
register_plugin"Critical Hits""1.2""!Morte" )
    
    
cvar_criticaldamage register_cvar"zp_criticalhit_damage""3.0" )
    
    
RegisterHamHam_TakeDamage"player""fw_TakeDamage" )
    
    
gSyncHud CreateHudSyncObj( );
}

public 
fw_TakeDamagevictiminflictorattackerFloat:damagedamage_type )
{    
    if( !
zp_get_user_zombieattacker ) )
    {
        if (
random_num(01000) == 0)
        {
            
SetHamParamFloat4damage *= get_pcvar_floatcvar_criticaldamage ) )
            
            
client_cmdattacker"spk ^"%s^""sound_critical )
            
            
set_hudmessage02550, -1.0, -1.006.01.10.00.0)
            
ShowSyncHudMsgattackergSyncHud"%d^nCritical Hit!"floatrounddamage ) )
        }
        
        
SetHamParamFloat4damage )
    }
    
    return 
HAM_IGNORED;

alright, only thing i see you changed was extra bracket, thanks dude, im willing to learn if someone is willing to teach

edit: the plugin works perfectly, the chance is 1 in 1000 now isnt it? because it took me alot to get that extra random crit

Last edited by New and Clueless; 01-06-2016 at 11:49.
New and Clueless is offline
New and Clueless
Senior Member
Join Date: Dec 2015
Old 01-06-2016 , 19:44   Re: [Help] small plugin fix [Easy]
Reply With Quote #8

any idea what this is?
Code:
L 01/07/2016 - 00:32:43: [ZP] Invalid Player (0)
L 01/07/2016 - 00:32:43: [AMXX] Displaying debug trace (plugin "zp_zreward_critical_hits.amxx")
L 01/07/2016 - 00:32:43: [AMXX] Run time error 10: native error (native "zp_get_user_zombie")
L 01/07/2016 - 00:32:43: [AMXX]    [0] zp_zreward_critical_hits.sma::fw_TakeDamage (line 45)
New and Clueless is offline
Chihuahuax
Senior Member
Join Date: Oct 2014
Location: Malaysia
Old 01-06-2016 , 21:01   Re: [Help] small plugin fix [Easy]
Reply With Quote #9

That error is shown when you killed yourself (e.g. sinking in pool of poison, killed by trigger_hurt)

Code:
/*                    [ZP] Addon: Critical Hit
                by !Morte
    
    #Description :
            Make a random critical hit when you are shooting an a enemy
    
    #Cvars : 
            zp_criticalhit_damage "3.0" // Damage Multiplier
            
    #Credits : 
            meTaLiCroSS: From his "custom form" :P

    #Changelog : 
            v1.0: Plugin Release
            v1.1: Added some sounds and effects
            v1.2: Code fix, delete some redundant things and change some other things
*/

#include < amxmodx >
#include < hamsandwich >
#include < fakemeta >
#include < fun >
#include < zombieplague >

new const sound_critical[] = "critical_hit/critical_hit.wav"

new cvar_criticaldamage
new gSyncHud

public plugin_precache( ) engfunc( EngFunc_PrecacheSound, sound_critical )

public plugin_init( )
{
    register_plugin( "Critical Hits", "1.2", "!Morte" )
    
    cvar_criticaldamage = register_cvar( "zp_criticalhit_damage", "3.0" )
    
    RegisterHam( Ham_TakeDamage, "player", "fw_TakeDamage" )
    
    gSyncHud = CreateHudSyncObj( );
}

public fw_TakeDamage( victim, inflictor, attacker, Float:damage, damage_type )
{    
    if( victim != attacker && is_user_connected(attacker) && !zp_get_user_zombie( attacker ) )
    {
        if (random_num(0, 1000) == 0)
        {
            SetHamParamFloat( 4, damage *= get_pcvar_float( cvar_criticaldamage ) )
            
            client_cmd( attacker, "spk ^"%s^"", sound_critical )
            
            set_hudmessage( 0, 255, 0, -1.0, -1.0, 0, 6.0, 1.1, 0.0, 0.0, 1 )
            ShowSyncHudMsg( attacker, gSyncHud, "%d^nCritical Hit!", floatround( damage ) )
        }
        
        SetHamParamFloat( 4, damage )
    }
    
    return HAM_IGNORED;
}

Last edited by Chihuahuax; 01-06-2016 at 21:01.
Chihuahuax is offline
Send a message via Skype™ to Chihuahuax
New and Clueless
Senior Member
Join Date: Dec 2015
Old 01-07-2016 , 01:17   Re: [Help] small plugin fix [Easy]
Reply With Quote #10

Quote:
Originally Posted by Chihuahuax View Post
That error is shown when you killed yourself (e.g. sinking in pool of poison, killed by trigger_hurt)

Code:
/*                    [ZP] Addon: Critical Hit
                by !Morte
    
    #Description :
            Make a random critical hit when you are shooting an a enemy
    
    #Cvars : 
            zp_criticalhit_damage "3.0" // Damage Multiplier
            
    #Credits : 
            meTaLiCroSS: From his "custom form" :P

    #Changelog : 
            v1.0: Plugin Release
            v1.1: Added some sounds and effects
            v1.2: Code fix, delete some redundant things and change some other things
*/

#include < amxmodx >
#include < hamsandwich >
#include < fakemeta >
#include < fun >
#include < zombieplague >

new const sound_critical[] = "critical_hit/critical_hit.wav"

new cvar_criticaldamage
new gSyncHud

public plugin_precache( ) engfunc( EngFunc_PrecacheSound, sound_critical )

public plugin_init( )
{
    register_plugin( "Critical Hits", "1.2", "!Morte" )
    
    cvar_criticaldamage = register_cvar( "zp_criticalhit_damage", "3.0" )
    
    RegisterHam( Ham_TakeDamage, "player", "fw_TakeDamage" )
    
    gSyncHud = CreateHudSyncObj( );
}

public fw_TakeDamage( victim, inflictor, attacker, Float:damage, damage_type )
{    
    if( victim != attacker && is_user_connected(attacker) && !zp_get_user_zombie( attacker ) )
    {
        if (random_num(0, 1000) == 0)
        {
            SetHamParamFloat( 4, damage *= get_pcvar_float( cvar_criticaldamage ) )
            
            client_cmd( attacker, "spk ^"%s^"", sound_critical )
            
            set_hudmessage( 0, 255, 0, -1.0, -1.0, 0, 6.0, 1.1, 0.0, 0.0, 1 )
            ShowSyncHudMsg( attacker, gSyncHud, "%d^nCritical Hit!", floatround( damage ) )
        }
        
        SetHamParamFloat( 4, damage )
    }
    
    return HAM_IGNORED;
}
works perfectly, thank you!
New and Clueless 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 18:38.


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