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)