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

Cs:Go Server change map with chat input


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mantateller
New Member
Join Date: Aug 2017
Old 08-23-2017 , 05:40   Cs:Go Server change map with chat input
Reply With Quote #1

Hello, I just started to make my own cs:go server. I'm able to execute commands via chat, if i type: !sm_test_command

public void OnPluginStart() { RegServerCmd("test_command", Command_Test); }

public Action Command_Test(int args) { return Plugin_Handled; } That works.

Now I want to change the map, if i type !changemap <map>. My question is, how can i get the string which contains "<map>"? So that i can write it in the code like: ServerCommand("changelevel "+map);

Edit: Now i have this:
Quote:
if (args < 1) { ReplyToCommand(client, "[SM] Usage: sm_setnextmap <map>"); return Plugin_Handled; }

char map[PLATFORM_MAX_PATH];
char displayName[PLATFORM_MAX_PATH]
GetCmdArg(1, map, sizeof(map));

ReplyToCommand(client, map); //the output for map is right, like de_dust
if (FindMap(map, displayName, sizeof(displayName)) == FindMap_NotFound)
{
ReplyToCommand(client, "[SM] %t", "Map was not found", map);
return Plugin_Handled;
}

GetMapDisplayName(displayName, displayName, sizeof(displayName));
ReplyToCommand(client,"changelevel %d", map); //here is the outpu for map a number like 15678685 or sth and for displayname its the same

ServerCommand("changelevel %d", map);
ShowActivity(client, "%t", "Changed Next Map", displayName);
LogAction(client, -1, "\"%L\" changed nextmap to \"%s\"", client, map);

SetNextMap(map); //That doesnt do anything i guess

return Plugin_Handled;
but it doesn't work, does somebody see the error? the value of "map" is right but it doesnt change the map

I think i just need the map name now and not the number, so sth has to be wrong with: ServerCommand("changelevel %d", map);
because ReplyToCommand(client, map); this mapvalue is right.

Last edited by mantateller; 08-23-2017 at 05:57.
mantateller is offline
8guawong
AlliedModders Donor
Join Date: Dec 2013
Location: BlackMarke7
Old 08-23-2017 , 06:31   Re: Cs:Go Server change map with chat input
Reply With Quote #2

!map <map name> is already built into sm...
8guawong is offline
mantateller
New Member
Join Date: Aug 2017
Old 08-23-2017 , 06:37   Re: Cs:Go Server change map with chat input
Reply With Quote #3

Quote:
Originally Posted by 8guawong View Post
!map <map name> is already built into sm...
So is there nothing to change? Can i just start my server and type: !map de_dust?
mantateller is offline
ambn
Veteran Member
Join Date: Feb 2015
Location: Fun servers
Old 08-23-2017 , 08:42   Re: Cs:Go Server change map with chat input
Reply With Quote #4

Quote:
Originally Posted by mantateller View Post
So is there nothing to change? Can i just start my server and type: !map de_dust?
Yes.
__________________
ambn is offline
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 08-23-2017 , 19:34   Re: Cs:Go Server change map with chat input
Reply With Quote #5

https://wiki.alliedmods.net/Admin_commands_(sourcemod)
__________________
Neuro Toxin 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 14:16.


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