Raised This Month: $ Target: $400
 0% 

How to?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 05-07-2012 , 20:06   How to?
Reply With Quote #1

How to give CS Bots an item? like grenade, flashbang, etc..
Randomize is offline
Liverwiz
Veteran Member
Join Date: Feb 2010
Location: Maryland
Old 05-07-2012 , 21:38   Re: How to?
Reply With Quote #2

using amx_super:
amx_giveweapon bot hegrenade

or are you trying to write a mod for this? quite the vague question.
Liverwiz is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 05-08-2012 , 01:45   Re: How to?
Reply With Quote #3

You do it just like you do it for everyone else.
__________________
fysiks is offline
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 05-08-2012 , 05:55   Re: How to?
Reply With Quote #4

Quote:
Originally Posted by Liverwiz View Post
using amx_super:
amx_giveweapon bot hegrenade

or are you trying to write a mod for this? quite the vague question.
No I just wanted to give bots helmet model
Randomize is offline
Randomize
BANNED
Join Date: May 2012
Location: in your heart
Old 05-08-2012 , 06:34   Re: How to?
Reply With Quote #5

I got this code

Quote:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"


public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_cvar("sv_sayweapon", "0", FCVAR_SERVER)
register_clcmd("give_weapon","give_weapon",AC CESS_WEAPON)
register_clcmd("give_say","enabled_say",ACCES S_WEAPON)
register_clcmd("say","say_weapon")
return PLUGIN_CONTINUE
}
public give_weapon(id,level,cid) {
if (!cmd_access(id,level,cid,2)) {
return PLUGIN_HANDLED
}
if (read_argc() != 3) {
client_print(id,print_console,"[free give weapon]: %s",TxtUsage[language])
return PLUGIN_HANDLED
}
new arg[32]
read_argv(1,arg,31)
new arg2[32]
read_argv(2,arg2,31)
strtolower(arg2)
amx_weapon(id,arg,arg2)
return PLUGIN_HANDLED
}
public say_weapon(id) {
new Speech[192]
read_args(Speech,192)
remove_quotes(Speech)
if (containi(Speech, "giveme")!=-1) {
if (get_cvar_num("sv_sayweapon")==0) {
client_print(id,print_chat,"[free give weapon]: %s",TxtError[language])
return PLUGIN_HANDLED
}
strtolower(Speech[10])
new nom[32]
get_user_name(id,nom,32)
amx_weapon(id,nom,Speech[7])
}
return PLUGIN_CONTINUE
}
public enabled_say(id,level,cid) {
if (!cmd_access(id,level,cid,2)) {
return PLUGIN_HANDLED
}
new argstr[12]
read_argv(1,argstr,12)
new arg = str_to_num(argstr)
if ((arg != 1) && (arg != 0)) {
client_print(id,print_console,"[free give weapon]: give_say <1 | 0>")
return PLUGIN_HANDLED
}
if (arg == 1) {
client_print(0,print_chat,"[free give weapon]: %s",TxtSay[language])
}
set_cvar_string("sv_sayweapon",argstr)
return PLUGIN_HANDLED
}


public amx_weapon(id,victim[],weapon_give[]){
new index_weapon = 0
index_weapon = find_weapon(weapon_give)
if (index_weapon<0) {
client_print(id,print_console,"[free give weapon]: %s",TxtWeaponerror[language])
return PLUGIN_CONTINUE
}
if (equal(victim,"@",1)) {
new players[32], inum
new team[32]
new collect[32]
collect="ae"
if (equal(victim,"@CT")) {
team = "CT"
}
else {
if (equal(victim,"@ALL")) {
team = ""
collect= "a"
}
else{
team = "TERRORIST"
}
}
get_players(players,inum,collect,team)
for(new i = 0 ;i < inum ;++i) {
free_weapon(players[i],index_weapon)
}
if (inum) {
set_hudmessage(255,100,0, 0.05,0.65, 0, 6.0, 6.0, 0.5, 0.15, 4)
show_hudmessage(0,"[free give weapon] %s %s", TxtWeapon[language],victim)
return PLUGIN_CONTINUE
}
else {
client_print(id,print_console,"[free give weapon] %s",TxtWeaponplayer[language])
return PLUGIN_CONTINUE
}
}
else
{
new player = find_player("lb",victim)
if (player) {
free_weapon(player,index_weapon)
set_hudmessage(255,100,0, 0.05,0.65, 0, 6.0, 6.0, 0.5, 0.15, 4)
show_hudmessage(0,"[free give weapon] %s %s", TxtWeapon[language],victim)
return PLUGIN_CONTINUE
}
else {
client_print(id,print_console,"[free give weapon] %s",TxtWeaponplayer[language])
return PLUGIN_CONTINUE
}
}

return PLUGIN_CONTINUE
}

public find_weapon(txtweapon[]) {
new weapon_index
weapon_index = -1
for(new i = 0 ;i < NbWeapon ;++i) {
if (containi(TabWeapon[i],txtweapon)>-1) {
weapon_index = i
i = NbWeapon
}
}
return weapon_index
}
Error when compiled

Last edited by Randomize; 05-08-2012 at 06:34.
Randomize is offline
Reply


Thread Tools
Display Modes

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:26.


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