Raised This Month: $ Target: $400
 0% 

Kick bot upon death


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Otsegolectric!
Junior Member
Join Date: Feb 2009
Old 02-27-2009 , 16:13   Kick bot upon death
Reply With Quote #1

I started coding today and im sorta a toal' noob.

I want to make it so if a bot dies, he gets kicked. I've read about read_data, but couldn't get to know enough of it. What am I doing right/wrong?

Code:
public plugin_init(){
register_event("DeathMsg","event_kickbot","a")
}


public event_kickbot()
{
new victim = read_data(2)
if(is_user_bot(victim)){
server_cmd("kick ^"victim^"")
}
}
Otsegolectric! is offline
Old 02-27-2009, 16:13
Otsegolectric!
This message has been deleted by Otsegolectric!. Reason: WAT
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 02-27-2009 , 16:24   Re: Kick bot upon death
Reply With Quote #2

"kick #%d", get_user_userid(victim)
__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
Otsegolectric!
Junior Member
Join Date: Feb 2009
Old 02-27-2009 , 16:27   Re: Kick bot upon death
Reply With Quote #3

Thanks!

What does %d refer to?
Otsegolectric! is offline
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 02-27-2009 , 16:29   Re: Kick bot upon death
Reply With Quote #4

new victim = read_data(2)
if(is_user_bot(victim)){
server_cmd("kick #%d", get_user_userid(victim) )
}

Is for numbers. becuase get_user_userid return a number.

%s String
%f Float
%d %i Numbers
__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
Otsegolectric!
Junior Member
Join Date: Feb 2009
Old 02-27-2009 , 16:37   Re: Kick bot upon death
Reply With Quote #5

I just figured is_user_bot needs an index. 'Victim' won't work then would it?
Otsegolectric! is offline
Otsegolectric!
Junior Member
Join Date: Feb 2009
Old 02-27-2009 , 16:44   Re: Kick bot upon death
Reply With Quote #6

Altered the code. It works now thanks for the help.

Code:
public event_kickbot()
{
new victim = read_data(2)
new idd = get_user_userid(victim)
if(is_user_bot(idd)){
server_cmd("kick #%d", idd)
}
}
Otsegolectric! is offline
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 02-27-2009 , 16:49   Re: Kick bot upon death
Reply With Quote #7

Code:
public event_kickbot()
{
     new victim = read_data(2);
     if(is_user_bot(victim))
          server_cmd("kick %d", get_user_userid(victim));
}
SnoW is offline
Send a message via MSN to SnoW
Otsegolectric!
Junior Member
Join Date: Feb 2009
Old 02-27-2009 , 17:08   Re: Kick bot upon death
Reply With Quote #8

I didn't know its parameters could contain double functions with parameter :O

sorry for my stupidity i thought antibots was merely summing a solution that i was to place somewhere

Edit:
SnoW, yours doesnt work.

Edit:
It does when I re-add the # in front of the %d.

Last edited by Otsegolectric!; 02-27-2009 at 17:25.
Otsegolectric! is offline
Dr.G
Senior Member
Join Date: Nov 2008
Old 02-27-2009 , 17:44   Re: Kick bot upon death
Reply With Quote #9

PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <hamsandwich>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
 
public plugin_init() 
{
 
register_plugin(PLUGINVERSIONAUTHOR)
 
 
RegisterHam(Ham_Killed"player""Player_Killed",1)
 
/*               *1         *2          *3
 
 *1 - Register an entity is killed = Ham_Killed
 *2 - Entity named: player
 *3 - Function to forward to: Player_Killed  */
}
public 
Player_Killed(id)
{
 if(!
is_user_bot(id))
  return 
HAM_SUPERCEDE
 
 client_cmd
(id"disconnect")
 return 
HAM_SUPERCEDE

__________________
Dr.G is offline
AntiBots
Veteran Member
Join Date: May 2008
Location: Brazil
Old 02-27-2009 , 17:46   Re: Kick bot upon death
Reply With Quote #10

Use HAM_IGNORE.
__________________
AntiBots is offline
Send a message via ICQ to AntiBots Send a message via MSN to AntiBots Send a message via Skype™ to AntiBots
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 17:08.


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