Raised This Month: $ Target: $400
 0% 

Please help code dosent works


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 07-05-2014 , 14:29   Re: Please help code dosent works
Reply With Quote #1

There are wrong things in your code all over the place. I wrote you a example, where you can get some thoughts of. It's not testet nor compiled by me, you have to test it yourself.

PHP Code:
#include <amxmodx> 
#include <cstrike> 
#include <hamsandwich> 

new iLastCTKillsiLastCT

public plugin_init() 
{
    
RegisterHam(Ham_Killed"player""hamKilledPost"true)
    
RegisterHam(Ham_TakeDamage"player""hamTakeDamagePre"false)

    
register_logevent("eventRoundStart"2"1=Round_Start")
}

public 
eventRoundStart()
{
    
iLastCT = -1
    iLastCTKills 
0
}

public 
hamKilledPost(victimattackershouldgib)
{
    if(
iLastCT == -&& cs_get_user_team(victim) == CS_TEAM_CT)
    {
        new 
iPlayers[32], iNum
        get_players
(iPlayersiNum"ae""CT")

        if(
iNum == 1)
        {
            
iLastCT iPlayers[0]

            return 
HAM_IGNORED
        
}
    }

    if(
attacker == iLastCT && iLastCTKills 20 && cs_get_user_team(victim) == CS_TEAMS_T)
    {
        
iLastCTKills++
    }
}

public 
hamTakeDamagePre(const victim, const inflictor, const attackerFloat:damage, const iDamageType
{
    if(
victim == attacker)
    {
        return 
HAM_IGNORED
    
}

    if(
attacker != iLastCT)
    {
        return 
HAM_IGNORED
    
}
    
    
SetHamParamFloat(4damage * (iLastCTKills 0.1))
        
    return 
HAM_IGNORED

Normaly I wouldn't post code in this way, but since so much is wrong in your code, it may help you more.

Last edited by mottzi; 07-05-2014 at 16:25.
mottzi is offline
Send a message via MSN to mottzi
xDoctor
Member
Join Date: Jul 2013
Old 07-05-2014 , 14:45   Re: Please help code dosent works
Reply With Quote #2

Quote:
Originally Posted by mottzi View Post
There are wrong things in your code all over the place. I wrote you a example, where you can get some thought of. It's not testet not compiled by me, you have to test it yourself.

PHP Code:
#include <amxmodx> 
#include <cstrike> 
#include <hamsandwich> 

new iLastCTKillsiLastCT

public plugin_init() 
{
    
RegisterHam(Ham_Killed"player""hamKilledPost"true)
    
RegisterHam(Ham_TakeDamage"player""hamTakeDamagePre"false)

    
register_logevent("eventRoundStart"2"1=Round_Start")
}

public 
eventRoundStart()
{
    
iLastCT = -1
    iLastCTKills 
0
}

public 
hamKilledPost(victimattackershouldgib)
{
    if(
iLastCT == -&& cs_get_user_team(victim) == CS_TEAM_CT)
    {
        new 
iPlayers[32], iNum
        get_players
(iPlayersiNum"ae""CT")

        if(
iNum == 1)
        {
            
iLastCT iPlayers[0]

            return 
HAM_IGNORED
        
}
    }

    if(
attacker == iLastCT && iLastCTKills 20 && cs_get_user_team(victim) == CS_TEAMS_T)
    {
        
iLastCTKills++
    }
}

public 
hamTakeDamagePre(const victim, const inflictor, const attackerFloat:damage, const iDamageType
{
    if(
victim == attacker)
    {
        return 
HAM_IGNORED
    
}

    if(
attacker != iLastCT)
    {
        return 
HAM_IGNORED
    
}
    
    
SetHamParamFloat(4damage * (iLastCTKills 0.1))
        
    return 
HAM_IGNORED

Normaly I wouldn't post code in this way, but since so much is wrong in your code, it may help you more.
can you add the hudmessage ?

and you did only when some one die's

i want always

even at start round if is alone.


and the Bonus damage starts from 100% = Normal Damage.

200% = X2 Damage
xDoctor is offline
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 07-05-2014 , 16:17   Re: Please help code dosent works
Reply With Quote #3

Quote:
Originally Posted by xDoctor View Post
can you add the hudmessage ?
Why? You posted in scripting help and I gave you an example. You could try to modify it yourself now. If things don't work you can ask again here.

Quote:
Originally Posted by xDoctor View Post
and you did only when some one die's

i want always

even at start round if is alone.
Then You need to do
PHP Code:
new iPlayers[32], iNum 
get_players
(iPlayersiNum"ae""CT"

if(
iNum == 1

    
iLastCT iPlayers[0

    
//return HAM_IGNORED 

on the newround event. You might also want do check for last CT on client_disconnect().


Quote:
Originally Posted by xDoctor View Post
and the Bonus damage starts from 100% = Normal Damage.

200% = X2 Damage
For each kill you get 10% bonus damage. You can get a max. of 200% bonus damage.

1 kill -> 1.1 * damage (110% damage)
2 kills -> 1.2 * damage (120% damage)
.
.
.
10 kills -> 2.0 * damage (200% damage)
.
.
.
19 kills -> 2.9 * damage (290%)
20 kills -> 3.0 * damage (300%)

You can modify it in this line:
PHP Code:
if(attacker == iLastCT && iLastCTKills 20 && cs_get_user_team(victim) == CS_TEAMS_T
mottzi is offline
Send a message via MSN to mottzi
xDoctor
Member
Join Date: Jul 2013
Old 07-05-2014 , 16:29   Re: Please help code dosent works
Reply With Quote #4

Quote:
Originally Posted by mottzi View Post
Why? You posted in scripting help and I gave you an example. You could try to modify it yourself now. If things don't work you can ask again here.


Then You need to do
PHP Code:
new iPlayers[32], iNum 
get_players
(iPlayersiNum"ae""CT"

if(
iNum == 1

    
iLastCT iPlayers[0

    
//return HAM_IGNORED 

on the newround event. You might also want do check for last CT on client_disconnect().



For each kill you get 10% bonus damage. You can get a max. of 200% bonus damage.

1 kill -> 1.1 * damage (110% damage)
2 kills -> 1.2 * damage (120% damage)
.
.
.
10 kills -> 2.0 * damage (200% damage)
.
.
.
19 kills -> 2.9 * damage (290%)
20 kills -> 3.0 * damage (300%)

You can modify it in this line:
PHP Code:
if(attacker == iLastCT && iLastCTKills 20 && cs_get_user_team(victim) == CS_TEAMS_T
is that alright ?

PHP Code:
#include < amxmodx > 
#include < cstrike > 
#include < hamsandwich > 

new iLastCTKillsiLastCT

public plugin_init() 
{
    
RegisterHam(Ham_Killed"player""hamKilledPost"true )
    
    
RegisterHam(Ham_TakeDamage"player""hamTakeDamagePre"false )

    
register_logevent("eventRoundStart"2"1=Round_Start")
}

public 
client_putinserverclient )
    
set_task1.0"Information"client );
    
public 
eventRoundStartclient )
{
    
iLastCT = -1
    
    iLastCTKills 
0
    
    
new iPlayers[32], iNum  
    
    get_players
(iPlayersiNum"ae""CT")  

    if(
iNum == 1)  
    {  
        
iLastCT iPlayers[0]  

    }
}

public 
hamKilledPost(victimattackershouldgib)
{
    if(
iLastCT == -&& cs_get_user_team(victim) == CS_TEAM_CT )
    {
        new 
iPlayers[32], iNum
        
        get_players
(iPlayersiNum"ae""CT")

        if(
iNum == 1)
        {
            
iLastCT iPlayers[0]

            return 
HAM_IGNORED
        
}
    }
    
    if( 
attacker == iLastCT && iLastCTKills 10 && cs_get_user_team(victim) == CS_TEAM_T )
    {
        
iLastCTKills += 1;
    }
    
    return 
1;
}

public 
hamTakeDamagePre(const victim, const inflictor, const attackerFloat:damage, const iDamageType
{
    if( 
victim == attacker )
        return 
HAM_IGNORED

    
if(attacker != iLastCT )
        return 
HAM_IGNORED
    
    SetHamParamFloat
(4damage * (iLastCTKills 0.1 ) )
        
    return 
HAM_IGNORED;
}  

public 
Informationclient )
{
    if( !
is_user_aliveclient ) )
        return 
1;
        
    if( 
client == iLastCT )
    {
        
set_hudmessage025500.300.7806.01.0 )
                    
        
show_hudmessageclient"Power Attack [ %i% ]^n [ %s%s%s%s%s%s%s%s%s%s ]"100 iLastCTKills 10,
        
iLastCTKills "-" "+",
        
iLastCTKills "-" "+",
        
iLastCTKills "-" "+",
        
iLastCTKills "-" "+",
        
iLastCTKills "-" "+",
        
iLastCTKills "-" "+",
        
iLastCTKills "-" "+",
        
iLastCTKills "-" "+",
        
iLastCTKills "-" "+",
        
iLastCTKills 10 "-" "+" )
    }
    
    else if( 
client != iLastCT )
    
    {
        
set_hudmessage025500.300.7806.01.0 )
        
        
show_hudmessageclient"Health: [ %i ]^n Armor: [ %i ]"get_user_healthclient ), get_user_armorclient ) );
    }
    
    return 
1;

xDoctor 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 21:14.


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