AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugin/Gameplay Ideas and Requests (https://forums.alliedmods.net/forumdisplay.php?f=60)
-   -   [REQ CSGO] Give bot weapons (https://forums.alliedmods.net/showthread.php?t=321650)

Ejziponken 02-21-2020 12:01

[REQ CSGO] Give bot weapons
 
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!

LuqS 02-21-2020 14:15

Re: [REQ CSGO] Give bot weapons
 
2 Attachment(s)
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!

Ejziponken 02-21-2020 16:50

Re: [REQ CSGO] Give bot weapons
 
Quote:

Originally Posted by LuqS (Post 2684633)
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

LuqS 02-22-2020 04:02

Re: [REQ CSGO] Give bot weapons
 
Quote:

Originally Posted by Ejziponken (Post 2684653)
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..

Ejziponken 02-22-2020 07:42

Re: [REQ CSGO] Give bot weapons
 
Quote:

Originally Posted by LuqS (Post 2684695)
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. :)

LuqS 02-24-2020 15:25

Re: [REQ CSGO] Give bot weapons
 
1 Attachment(s)
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".

Ejziponken 02-25-2020 04:11

Re: [REQ CSGO] Give bot weapons
 
Quote:

Originally Posted by LuqS (Post 2684919)
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.

Cruze 02-25-2020 04:26

Re: [REQ CSGO] Give bot weapons
 
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

LuqS 02-25-2020 06:04

Re: [REQ CSGO] Give bot weapons
 
Quote:

Originally Posted by Ejziponken (Post 2684963)
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

Ejziponken 02-25-2020 06:38

Re: [REQ CSGO] Give bot weapons
 
Quote:

Originally Posted by Cruze (Post 2684964)
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.


All times are GMT -4. The time now is 10:22.

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