Raised This Month: $12 Target: $400
 3% 

[REQ CSGO] Give bot weapons


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ejziponken
AlliedModders Donor
Join Date: Apr 2008
Old 02-21-2020 , 12:01   [REQ CSGO] Give bot weapons
Reply With Quote #1

Im looking for a plugin that will give bots a specific weapon (AK for example) but not real players. Its for Deathmatch so there are no buyzones.

Any help would be appreciated!
Ejziponken is offline
LuqS
AlliedModders Donor
Join Date: Jun 2019
Location: Israel
Old 02-21-2020 , 14:15   Re: [REQ CSGO] Give bot weapons
Reply With Quote #2

Hey Ejziponken!

I assume you know how to work with natives!

Every time you call the native all bots (alive) will receive the specified weapon.
Here is what i made (Untested but should work fine):

Let me know if you need any more help!
Attached Files
File Type: sp Get Plugin or Get Source (BotWeaponSpawner.sp - 213 views - 1.0 KB)
File Type: inc BotWeaponSpawner.inc (571 Bytes, 107 views)

Last edited by LuqS; 02-21-2020 at 14:16.
LuqS is offline
Ejziponken
AlliedModders Donor
Join Date: Apr 2008
Old 02-21-2020 , 16:50   Re: [REQ CSGO] Give bot weapons
Reply With Quote #3

Quote:
Originally Posted by LuqS View Post
Hey Ejziponken!

I assume you know how to work with natives!

Every time you call the native all bots (alive) will receive the specified weapon.
Here is what i made (Untested but should work fine):

Let me know if you need any more help!
Actually I cant code at all lol xD
Ejziponken is offline
LuqS
AlliedModders Donor
Join Date: Jun 2019
Location: Israel
Old 02-22-2020 , 04:02   Re: [REQ CSGO] Give bot weapons
Reply With Quote #4

Quote:
Originally Posted by Ejziponken View Post
Actually I cant code at all lol xD
please send me exactly what you want the plugin to do(1) and i will try my best to help you out here

(1) Things like:
  • Give weapons every respawn.
  • What weapon to give when.
  • etc..
LuqS is offline
Ejziponken
AlliedModders Donor
Join Date: Apr 2008
Old 02-22-2020 , 07:42   Re: [REQ CSGO] Give bot weapons
Reply With Quote #5

Quote:
Originally Posted by LuqS View Post
please send me exactly what you want the plugin to do(1) and i will try my best to help you out here

(1) Things like:
  • Give weapons every respawn.
  • What weapon to give when.
  • etc..
Yea, since its deathmatch, it would have to be on every respawn.
AK would be fine.
Ejziponken is offline
LuqS
AlliedModders Donor
Join Date: Jun 2019
Location: Israel
Old 02-24-2020 , 15:25   Re: [REQ CSGO] Give bot weapons
Reply With Quote #6

Hey Ejziponken again!

Sorry for the late response

Here is what i made for you!

You can control the plugin with this ConVars:
• bws_enabled - 0 / 1 to enable / disable.
• bws_weapon - Control what weapon the bot gets!

see here the weapons you can give them.
Add only the string after "weapon_".
For example: To give ak-47, The code is "weapon_ak47" so you should only add "ak47".
Attached Files
File Type: sp Get Plugin or Get Source (BotWeaponSpawner.sp - 185 views - 1.2 KB)
LuqS is offline
Ejziponken
AlliedModders Donor
Join Date: Apr 2008
Old 02-25-2020 , 04:11   Re: [REQ CSGO] Give bot weapons
Reply With Quote #7

Quote:
Originally Posted by LuqS View Post
Hey Ejziponken again!

Sorry for the late response

Here is what i made for you!

You can control the plugin with this ConVars:
• bws_enabled - 0 / 1 to enable / disable.
• bws_weapon - Control what weapon the bot gets!

see here the weapons you can give them.
Add only the string after "weapon_".
For example: To give ak-47, The code is "weapon_ak47" so you should only add "ak47".
Hey! Does not seem to be working, bots running with knifes.
Dont see any errors and plugin is loaded.
Ejziponken is offline
Cruze
Veteran Member
Join Date: May 2017
Old 02-25-2020 , 04:26   Re: [REQ CSGO] Give bot weapons
Reply With Quote #8

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>

#pragma newdecls required
#pragma semicolon 1

ConVar g_cvEnabled;
ConVar g_cvWeapon;

char WeaponsList[][] = //From advadmin
{
    
"c4""knife""knifegg""taser""healthshot"//misc
    
"decoy""flashbang""hegrenade""molotov""incgrenade""smokegrenade""tagrenade"//grenades
    
"usp_silencer""glock""tec9""p250""hkp2000""cz75a""deagle""revolver""fiveseven""elite"//pistoles
    
"nova""xm1014""sawedoff""mag7""m249""negev"//heavy
    
"mp9""mp7""ump45""p90""bizon""mac10""mp5sd"//smgs
    
"ak47""aug""famas""sg556""galilar""m4a1""m4a1_silencer"//rifles
    
"awp""ssg08""scar20""g3sg1" //snipers
};

public 
Plugin myinfo 
{
    
name "Bot Weapon spawner",
    
author "LuqS",
    
description "Gives a specific item to all bots",
    
version "1.1",
    
url ""
};

public 
void OnPluginStart()
{
    
// Not gonna waste time :D //
    
if(GetEngineVersion() != Engine_CSGO
        
SetFailState("This plugin is for CSGO only.");
        
    
g_cvEnabled CreateConVar("bws_enabled""1""Whether the 'Bot Weapon Spawner' Plugin is enabled");
    
g_cvWeapon CreateConVar("bws_weapon""ak47""Weapon to give");
    
    
HookEvent("player_spawn"Event_PlayerSpawn);
}

public 
void Event_PlayerSpawn(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid"));
    if(
g_cvEnabled.BoolValue && IsFakeClient(client) && IsPlayerAlive(client))
    {
        
char weapon[32];
        
g_cvWeapon.GetString(weaponsizeof(weapon));
        
Format(weaponsizeof(weapon), "weapon_%s"weapon);
        
        if(!
GivePlayerWeapon(clientweapon))
            
PrintToServer("Failed to give %N weapon - %s"clientweapon);
    }
}
int GivePlayerWeapon(int clientchar[] weapon)
{
        for(
int i 0sizeof(WeaponsList[]); i++)
        {
                 if(
StrEqual(weapon[7], WeaponList[i], false))
                 {
                         
GivePlayerItem(clientweapon);
                         return 
1;
                 }
        }
        return -
1;

Try this
__________________
Taking paid private requests! Contact me

Last edited by Cruze; 02-25-2020 at 09:26. Reason: Correction ._.
Cruze is offline
LuqS
AlliedModders Donor
Join Date: Jun 2019
Location: Israel
Old 02-25-2020 , 06:04   Re: [REQ CSGO] Give bot weapons
Reply With Quote #9

Quote:
Originally Posted by Ejziponken View Post
Hey! Does not seem to be working, bots running with knifes.
Dont see any errors and plugin is loaded.
I don't see any problems with this on my server

Contact me so we could figure out what is the problem
Steam | Discord: LuqS#6505
LuqS is offline
Ejziponken
AlliedModders Donor
Join Date: Apr 2008
Old 02-25-2020 , 06:38   Re: [REQ CSGO] Give bot weapons
Reply With Quote #10

Quote:
Originally Posted by Cruze View Post
PHP Code:
#include <sourcemod>
#include <sdktools>
#include <cstrike>

#pragma newdecls required
#pragma semicolon 1

ConVar g_cvEnabled;
ConVar g_cvWeapon;

char WeaponsList[][] = //From advadmin
{
    
"c4""knife""knifegg""taser""healthshot"//misc
    
"decoy""flashbang""hegrenade""molotov""incgrenade""smokegrenade""tagrenade"//grenades
    
"usp_silencer""glock""tec9""p250""hkp2000""cz75a""deagle""revolver""fiveseven""elite"//pistoles
    
"nova""xm1014""sawedoff""mag7""m249""negev"//heavy
    
"mp9""mp7""ump45""p90""bizon""mac10""mp5sd"//smgs
    
"ak47""aug""famas""sg556""galilar""m4a1""m4a1_silencer"//rifles
    
"awp""ssg08""scar20""g3sg1" //snipers
};

public 
Plugin myinfo 
{
    
name "Bot Weapon spawner",
    
author "LuqS",
    
description "Gives a specific item to all bots",
    
version "1.1",
    
url ""
};

public 
void OnPluginStart()
{
    
// Not gonna waste time :D //
    
if(GetEngineVersion() != Engine_CSGO
        
SetFailState("This plugin is for CSGO only.");
        
    
g_cvEnabled CreateConVar("bws_enabled""1""Whether the 'Bot Weapon Spawner' Plugin is enabled");
    
g_cvWeapon CreateConVar("bws_weapon""ak47""Weapon to give");
    
    
HookEvent("player_spawn"Event_PlayerSpawn);
}

public 
void Event_PlayerSpawn(Event event, const char[] namebool dontBroadcast)
{
    
int client GetClientOfUserId(event.GetInt("userid"));
    if(
g_cvEnabled.BoolValue && IsFakeClient(client) && IsPlayerAlive(client))
    {
        
char weapon[32];
        
g_cvWeapon.GetString(weaponsizeof(weapon));
        
Format(weaponsizeof(weapon), "weapon_%s"weapon);
        
        if(!
GivePlayerWeapon(clientweapon))
            
PrintToServer("Failed to give %N weapon - %s"clientweapon);
    }
}
int GivePlayerWeapon(int clientchar[] weapon)
{
        for(
int i 0sizeof(WeaponList); i++)
        {
                 if(
StrEqual(weapon[7], WeaponList[i], false))
                 {
                         
GivePlayerItem(clientweapon);
                         return 
1;
                 }
        }
        return -
1;

Try this

Code:
include/menus.inc(372) : warning 219: local variable "i" shadows a variable at a preceding level
plugin.sp(58) : warning 219: local variable "i" shadows a variable at a preceding level
plugin.sp(58) : error 072: "sizeof" operator is invalid on "function" symbols
plugin.sp(60) : error 017: undefined symbol "WeaponList"
plugin.sp(60) : warning 215: expression has no effect
plugin.sp(60) : error 001: expected token: ";", but found "]"
plugin.sp(60) : error 029: invalid expression, assumed zero
plugin.sp(60) : fatal error 190: too many error messages on one line

Compilation aborted.
5 Errors.
Also seems like the DM plugin is actually stripping the weapon from the bots for some reason.

Last edited by Ejziponken; 02-25-2020 at 07:49.
Ejziponken 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 11:37.


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