AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to? (https://forums.alliedmods.net/showthread.php?t=184693)

Randomize 05-07-2012 20:06

How to?
 
How to give CS Bots an item? like grenade, flashbang, etc..

Liverwiz 05-07-2012 21:38

Re: How to?
 
using amx_super:
amx_giveweapon bot hegrenade

or are you trying to write a mod for this? quite the vague question.

fysiks 05-08-2012 01:45

Re: How to?
 
You do it just like you do it for everyone else.

Randomize 05-08-2012 05:55

Re: How to?
 
Quote:

Originally Posted by Liverwiz (Post 1704589)
using amx_super:
amx_giveweapon bot hegrenade

or are you trying to write a mod for this? quite the vague question.

No :D I just wanted to give bots helmet model :D

Randomize 05-08-2012 06:34

Re: How to?
 
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


All times are GMT -4. The time now is 00:26.

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