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

Solved GetCmdArg problem with SteamID format (:)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Fastmancz
Senior Member
Join Date: Jul 2013
Location: Czech Republic
Old 05-14-2018 , 10:53   GetCmdArg problem with SteamID format (:)
Reply With Quote #1

Hello,

I have a problem with getting a SteamID from GetCmdArg. For example, I enter to the server console: sm_cmd STEAM_1:0:00000 6 and I get output Steamid: STEAM_1 | Days: :

PHP Code:
#include <sourcemod>

public OnPluginStart() 
{
    
RegAdminCmd("sm_cmd"cmdADMFLAG_ROOT);
}

public 
Action cmd(clientargs)
{
    if(!
GetClientOfUserId(client)) //Command only for console
    
{
        
char cmd_steamid[128];
        
GetCmdArg(1cmd_steamidsizeof(cmd_steamid));

        
char cmd_days[128];
        
GetCmdArg(2cmd_dayssizeof(cmd_days));

        
PrintToServer("Steamid: %s | Days: %s"cmd_steamidcmd_days);
    }

I don't know what's wrong. Thanks for help.
__________________


Main owner of the CMGPORTAL.CZ.
---------------------------------------
My plugins:
[CS:GO] Panorama - Timeleft
[CS:GO] JailBreak - Be quiet, please!

Last edited by Fastmancz; 05-14-2018 at 11:44.
Fastmancz is offline
Fyren
FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren FyrenFyrenFyrenFyrenFyren
Join Date: Feb 2106
Old 05-14-2018 , 11:25   Re: GetCmdArg problem with SteamID format (:)
Reply With Quote #2

This is how the server provides the command arguments to SM, unfortunately. As the user, you can put quotes around things with colons (as in do sm_cmd "STEAM_1:0:00000" 6). If you want to alter the code instead, you will have to break it on spaces yourself.

Also, use RegServerCmd if you want it only available on the server console.
Fyren is offline
Fastmancz
Senior Member
Join Date: Jul 2013
Location: Czech Republic
Old 05-14-2018 , 11:44   Re: GetCmdArg problem with SteamID format (:)
Reply With Quote #3

How simple, thanks!

Quote:
As the user, you can put quotes around things with colons (as in do sm_cmd "STEAM_1:0:00000" 6).
__________________


Main owner of the CMGPORTAL.CZ.
---------------------------------------
My plugins:
[CS:GO] Panorama - Timeleft
[CS:GO] JailBreak - Be quiet, please!
Fastmancz 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 02:12.


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