AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Buy Menu (https://forums.alliedmods.net/showthread.php?t=53619)

varsponic 04-07-2007 17:27

Buy Menu
 
How would you go about making a plugin or clcmd that would make a menu that had the options make the person "say" something to just clump the other plugin buy commands together so the end result would be like:

1. FrostNade600$ - pressing it makes them say /fn not in console
2. Molotov - say molotov
3. Jetpack - says /buyjetpack
4. BuyThat - says whatever the plugin configured the object to be bought with

instead of having to know the individual commands to buy things so it wouldnt be as cluttered.
could i just copy his and replace one set of options with names and the other with the "say /fn" cmnds?
http://forums.alliedmods.net/showthr...highlight=menu

varsponic 04-07-2007 20:03

Re: Buy Menu
 
I got the menu part to work but could someone tell me how or if its possible to make the person using the menu SAY in regular chat, something as a result of his option? Do need to predefine something or just put the command in..


Code:


/* AMX Mod script.
*
* (c) 2007, bigdickboy
* This file is provided as is (no warranties).
*
*  Generated by AMX MenuMaker v1.5 (http://sniperbeamer.amxmod.info)
*/
#include <amxmod>
#include <amxmisc>
new bool:cstrik_running
public plugin_init()
{
 register_plugin("Menu","1.0","bigdickboy")
 register_menucmd(register_menuid("Shop"),1023,"actionMenu")
 register_clcmd("shop","showMenu",0)
 new modName[32]
 get_modname(modName,31)
 cstrik_running = equal(modName,"cstrike") ? true : false
}
public actionMenu(id,key)
{
 switch(key){
 case 0:{
"say /frostnade"
 }
 case 1:{
"say molotov"
 }
 }
 return PLUGIN_HANDLED
}
public showMenu(id,level,cid)
{
 if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
 new menuBody[512]
 new len = format(menuBody,511,cstrik_running ? "\yShop\R^n^n\w" : "Shop^n^n")
 len += format(menuBody[len],511-len,"1. Frost Grenade 600$^n2. Molotov Cocktail 400$^n^n0. Exit")
 show_menu(id,((1<<0)|(1<<1)|(1<<9)),menuBody)
 return PLUGIN_HANDLED
}


Drak 04-07-2007 22:52

Re: Buy Menu
 
I think you might wanna read up, and view a few more plugins.
You're switch statement is no were near correct.

varsponic 04-07-2007 23:09

Re: Buy Menu
 
yehh i dont know, the menu worked in game..
"generated by AMX MenuMaker v1.5"

i get that im going to have to use
engclient_cmd ( index,const command[],arg1[]= )
so i almost have it.. but could someone give me an example of how to fill out the second part? like when should i record the player index

varsponic 04-08-2007 14:39

Re: Buy Menu
 
Ive been trying to read other scripts and such to make sense of it, but when i compile it it says lines 30-31 and 33-34 the expressions have no affect. The menu opens and you can click the options but it doesnt work, how do i code these 2 commands correctly?


Code:

/* AMX Mod script.
*
* (c) 2007, bigdickboy
* This file is provided as is (no warranties).
*
*  Generated by AMX MenuMaker v1.5 (http://sniperbeamer.amxmod.info)
*/
#include <amxmod>
#include <amxmisc>
new bool:cstrik_running
public plugin_init()
{
register_plugin("Menu","1.0","bigdickboy")
register_menucmd(register_menuid("Shop"),1023,"actionMenu")
register_clcmd("shop","showMenu",0)
new modName[32]
get_modname(modName,31)
cstrik_running = equal(modName,"cstrike") ? true : false
}
public actionMenu(id,key)
{
switch(key){
case 0:{
engclient_cmd ( id,say,/frostnade)
}
case 1:{
engclient_cmd ( id,say,molotov )
}
}
return PLUGIN_HANDLED
}
public showMenu(id,level,cid)
{
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
new menuBody[512]
new len = format(menuBody,511,cstrik_running ? "\yShop\R^n^n\w" : "Shop^n^n")
len += format(menuBody[len],511-len,"1. Frost Grenade 600$^n2. Molotov Cocktail 400$^n^n0. Exit")
show_menu(id,((1<<0)|(1<<1)|(1<<9)),menuBody)
return PLUGIN_HANDLED
}


Wilson [29th ID] 04-08-2007 18:56

Re: Buy Menu
 
Actually, you're making it more complicated than it is. Use:

engclient_cmd( id, "say /frostnade" );

The key part being the quotes.

Also, as a tip, I would reccomend defining your strings as global constants, for optimization purposes. Your plugin will still work without doing this, but if you read This Article you will see what I mean about that.

d0ck 05-19-2007 23:18

Re: Buy Menu
 
i hate to revive a dead topic like this but i dont suppose you got this working ever did you?


All times are GMT -4. The time now is 06:42.

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