sourcepawn set cvar

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <sourcemod>
#include <sdktools>
public Plugin:myinfo =
{
name = "setcvar",
author = "abc",
description = "none",
version = "",
url = ""
};
public OnPluginStart()
{
RegConsoleCmd("sm_setcv", SetCvar);
}
public Action:SetCvar(client, args)
{
new String:arg1[32], String:g_cmdString[32], String:g_cmdStringMsg[32];
GetCmdArg(1, arg1, sizeof(arg1));
new Handle:Kv = CreateKeyValues("data");
KvSetString(Kv, "title", "Info");
KvSetString(Kv, "type", "0");
Format(g_cmdString, sizeof(g_cmdString), "kv_bstr %s", arg1);
Format(g_cmdStringMsg, sizeof(g_cmdStringMsg), "hello guys!");
PrintToChat(client, "g_cmdString = %s", g_cmdString);
KvSetString(Kv, "msg", g_cmdStringMsg);
KvSetString(Kv, "cmd", g_cmdString);
ShowVGUIPanel(client, "info", Kv);
CloseHandle(Kv);
QueryClientConVar(client, "kv_bstr", ConVarQueryFinished:ClientConVar, client);
}
public ClientConVar(QueryCookie:cookie, client, ConVarQueryResult:result, const String:cvarName[], const String:cvarValue[])
{
new String:name[64];
GetClientName(client, name, 64)
PrintToChat(client, "%s CVar %s = %s", name, cvarName, cvarValue);
}