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

[CSS] Need some help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Marcus_Brown001
AlliedModders Donor
Join Date: Nov 2012
Location: Illinois, United States
Old 11-27-2012 , 20:01   [CSS] Need some help
Reply With Quote #1

I am trying to make it automatically give a bot a preset weapon ( weapon_m4a1 ). This is what I have so far:

Code:
public OnPluginStart()
{
    if (IsFakeClient(i))
    {
        Client_GiveWeaponAndAmmo(i, weapon_m4a1, true, 1000);
    }
}
I have cstrike included at the top along with smlib. When I try to compile my script with this in it I get the error: <104> : error 017: undefined symbol "weapon_m4a1"

I have tried a few things to try to fix it, but in the end nothing worked. If someone can tell me or show me how that would be great! Also, if someone knows an easier or better way to give bots weapons automatically that would work also!

Thanks
Marcus_Brown001 is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 11-27-2012 , 20:11   Re: [CSS] Need some help
Reply With Quote #2

Second parameter for Client_GiveWeaponAndAmmo requires a string. You should also define what i is.
__________________
11530 is offline
Marcus_Brown001
AlliedModders Donor
Join Date: Nov 2012
Location: Illinois, United States
Old 11-27-2012 , 20:31   Re: [CSS] Need some help
Reply With Quote #3

Scratch what I originally said. Instead of making it always checking for bots I decided to make it into a command; however, I still get the same error when I try to give the bot the weapon.
Code:
public Action:Command_BWeapons(client, args)
{
    for(new i=1;i<=MAXPLAYERS;i++)
    {
        if (IsFakeClient(i))
        {
            GivePlayerItem(i, weapon_m4a1, 0);
        }
    }
    return Plugin_Handled;
}
That is the code I made ( I have a command made up in on plugin start ). When I try to compile with this I get the error: undefined symbol weapon_m4a1 . If anyone knows how to fix this please and thanks!

Last edited by Marcus_Brown001; 11-27-2012 at 20:40.
Marcus_Brown001 is offline
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 11-27-2012 , 21:11   Re: [CSS] Need some help
Reply With Quote #4

Strings need to be encased within quotation marks mate. "weapon_m4a1". Also use MaxClients instead of MAXPLAYERS .
__________________

Last edited by thetwistedpanda; 11-27-2012 at 21:11.
thetwistedpanda is offline
Marcus_Brown001
AlliedModders Donor
Join Date: Nov 2012
Location: Illinois, United States
Old 11-27-2012 , 21:23   Re: [CSS] Need some help
Reply With Quote #5

Thank you, Panda! It works xD I can't believe I got screwed by quotes .... Thanks again man.
Marcus_Brown001 is offline
Reply



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 12:06.


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