|
Senior Member
|

05-21-2016
, 09:38
Re: [HELP] Storing Console Cmds in Variable
|
#8
|
I uh, I know may sound stupid but I can't get it to work. Here's what I have:
PHP Code:
#include <amxmodx> #include <amxmisc>
#define PLUGIN "RePurchase" #define VERSION "1.0" #define AUTHOR "Hell"
new Pri_Wpn[33], Sec_Wpn[33], g_HE[33], g_Smoke[33], g_Def[33], g_NVGS[33], g_Molotov, g_Vest, g_VestHelm new string[33][32];
new Primary[33][] = { "m3", "xm1014", "mp5", "tmp", "p90", "mac10", "ump45", "ak47", "galil", "famas", "sg552", "m4a1", "aug", "scout", "awp", "g3sg1", "sg550", "m249", "shield", "12gauge", "autoshotgun", "smg", "mp", "c90", "cv47", "defender", "clarion", "krieg552", "bullpup", "magnum", "d3au1", "krieg550", "sawedoff", "supershorty", "usas12" , "skorpion", "mp7", "bizon", "vector", "uzi", "tavor", "scarl", "g36", "groza", "xm8", "snake", "m60", "vulcan", "sl8", "wa2000", "bow" }
new Secondary[33][] = { "usp", "glock", "deagle", "p228", "elites", "fn57", "km45", "9x19mm", "nighthawk", "228compact", "fiveseven", "m1911a1", "makarov", "vp70", "ragingbull", "m29" }
public plugin_init() { register_plugin(PLUGIN, VERSION, AUTHOR) // register_event("HLTV", "Event_New_Round", "a", "1=0", "2=0") for (new i; i < sizeof Primary; i++) register_clcmd(Primary[i], "ClientCommandBuyPrimary") // for (new i; i < sizeof Secondary; i++) // register_clcmd(Secondary[i], "BlockBuyCommands") register_concmd("repurchase", "ClientCommandRepurchase") }
public ClientCommandBuyPrimary(id) { copy( string[id], charsmax(string[]), Primary ) client_print(id, print_chat, "Command: %s", string[id]); Pri_Wpn[id][?] = string[id][10]; } public ClientCommandRepurchase(id) { client_cmd(id, Pri_Wpn[id]) }
I know, it's still pretty much a mess but let try to explain the idea of it. Primary[] and Secondary[] holds all of the console commands for buying weapons, including my custom ones. I figured registering all Primaries in one public then when someone buys a rifle that matches one of the commands stores it in 'string' so I can use it. The retrieving a and storing part is what I'm having problems.
Sorry, I'm really trying not to turn this into a spoon-feeding session but I find I work best thru examples and so far I can't find a code where this is done...
Last edited by hellmonja; 05-21-2016 at 09:41.
|
|