AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Kick bot upon death (https://forums.alliedmods.net/showthread.php?t=86577)

Otsegolectric! 02-27-2009 16:13

Kick bot upon death
 
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^"")
}
}


AntiBots 02-27-2009 16:24

Re: Kick bot upon death
 
"kick #%d", get_user_userid(victim)

Otsegolectric! 02-27-2009 16:27

Re: Kick bot upon death
 
Thanks!

What does %d refer to?

AntiBots 02-27-2009 16:29

Re: Kick bot upon death
 
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

Otsegolectric! 02-27-2009 16:37

Re: Kick bot upon death
 
I just figured is_user_bot needs an index. 'Victim' won't work then would it?

Otsegolectric! 02-27-2009 16:44

Re: Kick bot upon death
 
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)
}
}


SnoW 02-27-2009 16:49

Re: Kick bot upon death
 
Code:

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


Otsegolectric! 02-27-2009 17:08

Re: Kick bot upon death
 
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.

Dr.G 02-27-2009 17:44

Re: Kick bot upon death
 
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



AntiBots 02-27-2009 17:46

Re: Kick bot upon death
 
Use HAM_IGNORE.


All times are GMT -4. The time now is 17:08.

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