Raised This Month: $ Target: $400
 0% 

[CS] Chat commands with argument? *SOLVED*


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
MrOpposite
Junior Member
Join Date: Jul 2009
Location: Sverige FTW
Old 07-27-2009 , 06:09   [CS] Chat commands with argument? *SOLVED*
Reply With Quote #1

Hello, I was trying to create a betting script. I figured it was a good place to start. I'm not completely new into coding, I've done some c++ before.

The plugin is for Counter-Strike

Okay, now to the problem. I was thinking that the player would say "/bet <TEAM> <AMOUNT>" (Yes, this is a replica of something I've seen in the past).

This is my current code:
PHP Code:
#include <amxmodx>
#include <fun>
#include <cstrike
#include <fakemeta>

new bool:hasbet[32]; // Inits the bool:array hasbet.

public plugin_init() //Init plugin...
{
    
register_plugin("Betmod","0.1","MrOpposite"//I created this :P
    //-----------------------------------------
    //CVARS
    //-----------------------------------------
    
register_cvar("sv_bet","1"); //Is betting enabled?
    //-----------------------------------------
    //CLIENT COMMANDS
    //-----------------------------------------
    
register_clcmd("say /bet * *","bet"); //Trying to trigger the function bet when a message begins with /bet
    //-----------------------------------------
    //EVENTS
    //-----------------------------------------
    
register_event("ResetHUD","roundchange","b"); // Found this, will use it later when I get further in development.
    //-----------------------------------------
}

public 
client_connect(id)
{
    
hasbet[id] = false//Reset the hasbet for the connecting player.
}
public 
client_disconnect(id)
{
    
hasbet[id] = false//Reset the hasbet for the disconnecting player.
}

public 
bet(id//When a player bets...
{
    
console_print(id"betted");

Now how can I get whenever a message begins with "/bet" and get what the player wrote after that?

Final note:
This is my first post, feel free to ask for more info and such. (I cant figure out more to say)

Last edited by MrOpposite; 07-27-2009 at 18:23. Reason: Added *solved* tag
MrOpposite is offline
 



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 18:18.


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