Raised This Month: $ Target: $400
 0% 

First Kill


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Trickzz
Member
Join Date: Jun 2011
Old 06-15-2011 , 14:49   Re: First Kill
Reply With Quote #1

Tell at least some principle of use, I'm not so smart in this case
Trickzz is offline
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 06-15-2011 , 17:40   Re: First Kill
Reply With Quote #2

in plugin_init() add this:
Code:
register_event("HLTV", "event_new_round", "a", "1=0", "2=0")
then add a new public function namned "event_new_round" or whatever you like to change it to in the init.
Now in that fuction set the bool true again:
Code:
public event_new_round() {     if(!FirstKill)     {         FirstKill = true;     } }
Erox902 is offline
Trickzz
Member
Join Date: Jun 2011
Old 06-16-2011 , 04:42   Re: First Kill
Reply With Quote #3

Ok, I did the following code, there were some issues
How to make whatever took place check whether the player is alive or not when he makes the first kill, and what function can be used in future work with killer / killed? thanks

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

#define PLUGIN "First Kill"
#define VERSION "1.0"
#define AUTHOR "AUTHOR"

new bool:FirstKill true;  

public 
plugin_init() 
{
         
register_plugin(PLUGINVERSIONAUTHOR)
         
RegisterHam(Ham_Killed"player""fw_PlayerKilled");      
         
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1);
         
register_event("HLTV""event_new_round""a""1=0""2=0");
}

public 
fw_PlayerKilled(victimattackershouldgib)  
{
         if(
FirstKill) { FirstKill false; }
}

public 
fwHamPlayerSpawnPost(iPlayer)
{
        if (
is_user_alive(iPlayer)) 
        {
             
// player spawned
        
}
}

public 
event_new_round()
{
    if(!
FirstKill)
    {
        
FirstKill true;
    }

Trickzz is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 06-16-2011 , 06:59   Re: First Kill
Reply With Quote #4

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

#define PLUGIN "First Kill"
#define VERSION "1.0"
#define AUTHOR "AUTHOR"

new bool:FirstKill true;  

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_Killed"player""fw_PlayerKilled");      
    
// RegisterHam(Ham_Spawn, "player", "fwHamPlayerSpawnPost", 1);
    
    
register_event("HLTV""event_new_round""a""1=0""2=0");
}

public 
fw_PlayerKilled(victimattackershouldgib)  
{
    if(
FirstKill
    {     
        
// First kill happened.
        
FirstKill false
    }
}

/* you don't need this to detect the first kill
public fwHamPlayerSpawnPost(iPlayer)
{
    if (is_user_alive(iPlayer)) 
    {
         // player spawned
    }
}
*/

public event_new_round()
{
    if(!
FirstKill)
    {
        
FirstKill true;
    }

__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Trickzz
Member
Join Date: Jun 2011
Old 06-16-2011 , 09:31   Re: First Kill
Reply With Quote #5

Ok, thanks for the correction
But as I start working with the murderer andkilled? (In the sense of something to take something to give, etc.)
Trickzz is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 06-16-2011 , 10:44   Re: First Kill
Reply With Quote #6

PHP Code:
// Some player got killed
public fw_PlayerKilled(victimattackershouldgib)  
{
    
// He is the first one killed this round
    
if(FirstKill
    {     
        
// victim = Killed person
        // attacker = Killer
        
        
FirstKill false
    }

__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Trickzz
Member
Join Date: Jun 2011
Old 06-16-2011 , 13:03   Re: First Kill
Reply With Quote #7

Sorry for my urgency but show an example the following:
that would give the killer (cs_set_user_money)
and the slain man had written to the chat print_chat(you die)
Verby big thanks in advance
Trickzz is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 06-16-2011 , 15:18   Re: First Kill
Reply With Quote #8

Just tell exactly what you want or search about how to do it when you want to learn it.


PHP Code:
cs_set_user_money(victim);

client_print(attackerprint_chat"(You die)"); 
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Trickzz
Member
Join Date: Jun 2011
Old 06-16-2011 , 15:28   Re: First Kill
Reply With Quote #9

I know the function (you can look at it), I need help in their location in the code
Trickzz is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 06-16-2011 , 16:42   Re: First Kill
Reply With Quote #10

PHP Code:
public FwdPlayerKilledPost(victimattacker)
{
    if(
FirstKill)
    {
        
cs_set_user_money(attackercs_get_user_money(victim) + 100);
        
client_print(victimprint_chat"(You die)");
    }

__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
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 23:33.


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