Raised This Month: $51 Target: $400
 12% 

Help/guidance on scripting and server commands


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Goldie
New Member
Join Date: Dec 2017
Old 12-16-2017 , 11:37   Help/guidance on scripting and server commands
Reply With Quote #1

Hi,

I just set up a private CSGO server for me and couple of my friends and I would like to know how to set up some specific chat commands for it. For example, I'd like the server to run multiple different modes, so I'd like players to be able to easily vote/change the mode as they desire (!duelmode for 1v1 aim duel maps, !comp for competitive, !arms for armsrace etc, etc.) I've managed to put some kinds of cfg commands for admins, but the problem is I'd like regular users to be able to change the mode without giving them the admin privileges.

But so far with my googling abilities I've not gotten too far. For example I found a forum thread where user wanted a !warmupend command to end warmup and he was presented with this code:
Code:
#include <sourcemod>
#include <cstrike>

public OnPluginStart()
{
	RegAdminCmd("sm_warmupend", Command_WarmupEnd, ADMFLAG_KICK, "stop the warmup");
	RegAdminCmd("sm_warmupstart", Command_WarmupStart, ADMFLAG_KICK, "start the warmup");
}

public Action:Command_WarmupEnd(client, args)
{
	PrintToChatAll("[SM] \x04Warmup ended");
	ServerCommand("mp_warmup_end");
	
	return Plugin_Handled;
}

public Action:Command_WarmupStart(client, args)
{
	PrintToChatAll("[SM] \x04Warmup started");
	ServerCommand("mp_warmup_start");
	
	return Plugin_Handled;
}
But I don't understand where it is specified that this happens when someone types !warmup. What if I wanted to the same thing happening when I type !oogliyboogily. Since I can't see where inside the code the trigger is specified, it must be specified somewhere else in Sourcemod configs?

Anyway, my request is, that if you guys know some easy-to-follow tutorial (specifically for csgo) somewhere in the internet, that teaches how to set up custom plugins for servers, could you direct me in that general direction? :)

Thanks!
Goldie is offline
Goldie
New Member
Join Date: Dec 2017
Old 12-16-2017 , 12:52   Re: Help/guidance on scripting and server commands
Reply With Quote #3

Quote:
Originally Posted by asherkin View Post
Ah, so it just creates the actual trigger on the fly? Interesting. Thanks, this should get me started! Although it says "..administrators will be able to type..", but I guess there is a workaround to get the commands working for everyone?
Goldie is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 12-16-2017 , 14:01   Re: Help/guidance on scripting and server commands
Reply With Quote #4

You can just use RegConsoleCmd instead of RegAdminCmd for a command that doesn't have any admin flag requirements.
__________________
asherkin is offline
Goldie
New Member
Join Date: Dec 2017
Old 12-16-2017 , 16:40   Re: Help/guidance on scripting and server commands
Reply With Quote #5

Quote:
Originally Posted by asherkin View Post
You can just use RegConsoleCmd instead of RegAdminCmd for a command that doesn't have any admin flag requirements.
Ah, awesome, thanks a bunch!
Goldie is offline
Reply



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 16:04.


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