Raised This Month: $32 Target: $400
 8% 

[cs:go] menu pop-up on roundstart and chat cmd.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
AleCz14
Member
Join Date: Jan 2012
Old 02-26-2015 , 16:17   [cs:go] menu pop-up on roundstart and chat cmd.
Reply With Quote #1

I started working on a Menu using a menu generator, i dont know how to make the Menu to auto show-up on round_start and on chatcmd "!shop", maybe u can help me.

Spoiler
AleCz14 is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-26-2015 , 16:24   Re: [cs:go] menu pop-up on roundstart and chat cmd.
Reply With Quote #2

Hooking chat commands like this:
Code:
public OnClientSayCommand_Post(client, const String:command[], const String:sArgs[]) {     if (StrEqual(sArgs, "!shop")) {         // Show menu to client     } }

And you can hook events as seen here:
https://wiki.alliedmods.net/Events_(...Mod_Scripting)

You might want to hook player spawn to show it whenever they spawn.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 02-26-2015 , 17:24   Re: [cs:go] menu pop-up on roundstart and chat cmd.
Reply With Quote #3

Quote:
Originally Posted by AleCz14 View Post
I started working on a Menu using a menu generator, i dont know how to make the Menu to auto show-up on round_start and on chatcmd "!shop", maybe u can help me.
If the menu is always the same, you may want to move the Menu variable to a global variable and just display the menu in your function.

I really should add an option for that to the menu generator at some point.

As for displaying the menu on Round Start and Player Spawn, event hooks for those aren't difficult to do.

Having said that, lets make those changes

Spoiler


Note that I made a few other adjustments... notably, I changed the menu type as I've heard Valve menus don't work in CS:GO (it's missing the UI for it).

Quote:
Originally Posted by Exolent[jNr] View Post
Hooking chat commands like this:
Code:
public OnClientSayCommand_Post(client, const String:command[], const String:sArgs[]) {     if (StrEqual(sArgs, "!shop")) {         // Show menu to client     } }

And you can hook events as seen here:
https://wiki.alliedmods.net/Events_(...Mod_Scripting)

You might want to hook player spawn to show it whenever they spawn.
If you're registering commands starting with / or !, you really should use RegConsoleCmd.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 02-26-2015 , 18:00   Re: [cs:go] menu pop-up on roundstart and chat cmd.
Reply With Quote #4

Quote:
Originally Posted by Powerlord View Post
If you're registering commands starting with / or !, you really should use RegConsoleCmd.
I wasn't aware SourceMod automatically created chat aliases for registered commands. I'm used to AMXX and still learning SourceMod's nuances. Thanks!
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 02-26-2015 , 19:08   Re: [cs:go] menu pop-up on roundstart and chat cmd.
Reply With Quote #5

Quote:
Originally Posted by Exolent[jNr] View Post
I wasn't aware SourceMod automatically created chat aliases for registered commands. I'm used to AMXX and still learning SourceMod's nuances. Thanks!
It does. If your command is named sm_ something, it will also create chat aliases without the sm_ part.
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 02-26-2015 at 19:08. Reason: without, not with
Powerlord is offline
AleCz14
Member
Join Date: Jan 2012
Old 02-27-2015 , 07:18   Re: [cs:go] menu pop-up on roundstart and chat cmd.
Reply With Quote #6

Firstly i wanna thank u both for answering, its not something usual on alliedmods this days..

There is a problem, actualy there are two. The Menu is displayed only when spawn first time on server (so on warmup), the second problem is that the "!shop" command is missing from the code. Thank u in advance!
AleCz14 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 02-27-2015 , 11:39   Re: [cs:go] menu pop-up on roundstart and chat cmd.
Reply With Quote #7

Code:
RegConsoleCmd("shop", Cmd_Shop, "Shop command");
is in the code I gave you. It registers both /shop and !shop

(It also registers the server console and client console shop commands, but those probably aren't going to be used.)

As for the spawn thing... weird, there's no special code in there to only show the first time a player is spawned.

I did notice that CS:GO has both "player_spawn" and "player_spawned"... I wonder if that matters.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Brrdy
Senior Member
Join Date: Feb 2015
Old 02-27-2015 , 14:55   Re: [cs:go] menu pop-up on roundstart and chat cmd.
Reply With Quote #8

Don't quote me if I'm wrong but I think this is correct

Spoiler


Note: if this doesn't work switch the top where it says
Code:
	RegConsoleCmd("say !shop", MyFunction);
	RegConsoleCmd("say /shop", MyFunction);
	RegConsoleCmd("sm_fmubuymenu", MyFunction);
to
Code:
RegConsoleCmd("say !shop", abcde);
	RegConsoleCmd("say /shop", abcde);
	RegConsoleCmd("sm_fmubuymenu", abcde);
And I think that should work
Obviously change where it says "say /shop" and "say !shop" if you want to change the IG cmds and "sm_fmubuymenu" is the console cmd

Last edited by Brrdy; 02-27-2015 at 14:55.
Brrdy is offline
AleCz14
Member
Join Date: Jan 2012
Old 02-28-2015 , 08:13   Re: [cs:go] menu pop-up on roundstart and chat cmd.
Reply With Quote #9

@Powerlord i saw it is wrote in the code, but simply when u type !shop in chat, nothing happens.

@Brrdy none of your codes works.
AleCz14 is offline
AleCz14
Member
Join Date: Jan 2012
Old 03-04-2015 , 12:12   Re: [cs:go] menu pop-up on roundstart and chat cmd.
Reply With Quote #10

Bump
AleCz14 is offline
Reply


Thread Tools
Display Modes

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 09:59.


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