Raised This Month: $51 Target: $400
 12% 

Ham_Killed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
LordOfNothing
BANNED
Join Date: Jul 2013
Old 11-03-2013 , 02:34   Ham_Killed
Reply With Quote #1

I can use the same event in the plugin butt call on many time once ?
example :


Code:
RegisterHam(Ham_Killed, "player", "C_HAm_Kill",1);
RegisterHam(Ham_Killed, "player", "C_HAm_Kill_2",1);
LordOfNothing is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 11-03-2013 , 02:47   Re: Ham_Killed
Reply With Quote #2

Quote:
Originally Posted by LordOfNothing View Post
I can use the same event in the plugin butt call on many time once ?
example :


Code:
RegisterHam(Ham_Killed, "player", "C_HAm_Kill",1);
RegisterHam(Ham_Killed, "player", "C_HAm_Kill_2",1);
This is pointless. Since the hooks are exactly the same, you should only use one of them and execute all the code in the one function.

P.S. Your sentence makes no sense.
__________________
fysiks is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-03-2013 , 02:49   Re: Ham_Killed
Reply With Quote #3

Why would you be stupid enough to do something not efficient like this ?


If there is really a reason to have 2 functions, then call the 2 fonctions from the ham forward callback :

PHP Code:
public plugin_init()
{
    
RegisterHam(Ham_Killed"player""C_HAm_Kill_Post"1);
}

public 
C_HAm_Kill_Post(victimkillershoudgib)
{
    
C_HAm_Kill_Post_1victimkillershoudgib );
    
C_HAm_Kill_Post_2victimkillershoudgib );
}

C_HAm_Kill_Post_1(victimkillershoudgib)
{
    
// code 1 here
}

C_HAm_Kill_Post_2(victimkillershoudgib)
{
    
// code 2 here


But you shouldn't have to do that, and you should do something like that :
PHP Code:
public plugin_init()
{
    
RegisterHam(Ham_Killed"player""C_HAm_Kill_Post"1);
}

public 
C_HAm_Kill_Post(victimkillershoudgib)
{
    
// code 1 here

    // code 2 here


edit : Hello fysiks
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 11-03-2013 at 02:50.
ConnorMcLeod is offline
LordOfNothing
BANNED
Join Date: Jul 2013
Old 11-03-2013 , 03:05   Re: Ham_Killed
Reply With Quote #4

Lets start saying what i wanna do :


so In first Ham_killed - i wanna respawn a player if his boolean is TRUE
In the second Ham_Killed i wanna give XP a player when kill victim ?
should use all in only once ham_killed ?

PS : Sorry my bad english

Thanks , LordOfNothing

Last edited by LordOfNothing; 11-03-2013 at 03:06.
LordOfNothing is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 11-03-2013 , 03:14   Re: Ham_Killed
Reply With Quote #5

YES.

PHP Code:
new bool:g_bShouldRespawn[33];

new 
g_iMaxPlayers;
#define IsPlayer(%0)    ( 1 <= (%0) <= g_iMaxPlayers )

public plugin_init()
{
    
RegisterHam(Ham_Killed"player""C_HAm_Kill_Post"1);

    
g_iMaxPlayers get_players();
}

public 
C_HAm_Kill_Post(victimkillershoudgib)
{
    
// XP Code here :
    
if( IsPlayer(killer) && killer != victim && cs_get_user_team(victim) != cs_get_user_team(killer) )
    {
        
// raise killer XP
    
}

    
// Respawn code here :
    
if( g_bShouldRespawn[victim] )
    {
        
g_bShouldRespawn[victim] = false;
        
ExecuteHam(Ham_CS_RoundRespawnvictim);
    }

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
LordOfNothing
BANNED
Join Date: Jul 2013
Old 11-03-2013 , 10:13   Re: Ham_Killed
Reply With Quote #6

thanks connor is working
LordOfNothing 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 00:58.


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