Raised This Month: $ Target: $400
 0% 

command value not working


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kramesa
Veteran Member
Join Date: Feb 2011
Location: Brazil
Old 12-06-2011 , 10:41   Re: command value not working
Reply With Quote #1

Try

PHP Code:
public plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_concmd("amx_bot_max""BotCon")
}

public 
BotCon(id)
{
    new 
maxbots[35]
    
read_args(maxbotscharsmax(maxbots))
    
remove_quotes(maxbots)
    
    
server_cmd("bot ^"max_bots %d^""maxbots)

__________________
kramesa is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 12-06-2011 , 21:40   Re: command value not working
Reply With Quote #2

You need to start looking at existing plugins and see how things are done. The funcwiki is great but it probably confused you on read_argv() because the "id" shown there is not the "id" of a player at all. It is the index of the argument that you want to retrieve.

PHP Code:
#include <amxmodx>

public plugin_init()
{
    
register_plugin("Plugin""0.1""Author")
    
register_concmd("amx_bot_max""BotCon")
}
public 
BotCon(id)
{
    new 
szMaxbots[3]
    
read_argv(1szMaxbotscharsmax(szMaxbots))
    new 
iMaxbots str_to_num(szMaxbots)
    
server_cmd("bot ^"max_bots %d^""iMaxbots)

@Kramesa: You were functionally close but but I would rather use read_argv() for clarity. To fix your code you would need to change the %d to %s (I think).
__________________

Last edited by fysiks; 12-06-2011 at 21:42.
fysiks 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:11.


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