Raised This Month: $ Target: $400
 0% 

Solved Storing Console Cmds in Variable


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
hellmonja
Senior Member
Join Date: Oct 2015
Old 05-21-2016 , 09:38   Re: [HELP] Storing Console Cmds in Variable
Reply With Quote #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_Molotovg_Vestg_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(PLUGINVERSIONAUTHOR)
    
//    register_event("HLTV", "Event_New_Round", "a", "1=0", "2=0")
    
    
for (new isizeof Primaryi++)
        
register_clcmd(Primary[i], "ClientCommandBuyPrimary")
    
//    for (new i; i < sizeof Secondary; i++)
//        register_clcmd(Secondary[i], "BlockBuyCommands")
    
    
register_concmd("repurchase""ClientCommandRepurchase")
    
}

public 
ClientCommandBuyPrimary(id)
{
    
copystring[id], charsmax(string[]), Primary 
    
client_print(idprint_chat"Command: %s"string[id]);
    
Pri_Wpn[id][?] = string[id][10];
    
}
public 
ClientCommandRepurchase(id)
{
    
client_cmd(idPri_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.
hellmonja 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:34.


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