Hi,
ive a simple Problem on my first!! plugin....
The Goal is to get a plugin that gets the sv_tags cvar and compare it to a given Server config cvar-tag; for example: "sm_tct_0" = "hallo" and loads the specifig config for that sm_tct_0 cvar f. e. ServerConfig0.cfg.
here is my first Version(you can ignore the new strings on start, theyre for later using)
The first versin of the Plugin will be built up to 20 configs which you can load 20 configs @ 20 tags u give.
sry for my english im german and not proud for my school grades in english.
Code:
/*
* Server Tags
* Written by dany666 ([email protected])
*
* Licensed under the GPL version 2 or above
*/
#pragma semicolon 1
#include <sourcemod>
#define PLUGIN_VERSION "0.1"
// CVars
new Handle:g_cvarConf = INVALID_HANDLE;
new Handle:g_cvarTag0 = INVALID_HANDLE;
new Handle:g_cvarTag0f = INVALID_HANDLE;
new Handle:g_cvarTag0T = INVALID_HANDLE;
new String:Tag0[128];
new String:Tag1[128];
new String:Tag2[128];
new String:Tag3[128];
new String:Tag4[128];
new String:Tag5[128];
new String:Tag6[128];
new String:Tag7[128];
new String:Tag8[128];
new String:Tag9[128];
new String:Tag10[128];
new String:Tag11[128];
new String:Tag12[128];
new String:Tag13[128];
new String:Tag14[128];
new String:Tag15[128];
new String:Tag16[128];
new String:Tag17[128];
new String:Tag18[128];
new String:Tag19[128];
public Plugin:myinfo =
{
name = "TagConfig",
author = "Dany666",
description = "Tags TEST",
version = PLUGIN_VERSION,
}
public OnPluginStart() {
g_cvarConf = CreateConVar("sm_tc_on", "1", "Enables TagConfig Plugin."); /* Activate the Plugin */
g_cvarTag0 = CreateConVar("sm_tct_0", "hallo", "get Alias for: Tag0Alias"); /*get the cvar for sm_tct_0 config" */
g_cvarTag0T = CreateConVar("sm_tct_0T", "test", "Tag0test");
/*-------------------------------------Configs--------------------------------------------------*/
g_cvarTag0f = CreateConVar("sm_tcf_h", "ServerConfig0.cfg", "exec the config:Tag0 Config"); /* exec ServerConfig0.cfg if "sm_tct_0" = "hallo" */
AutoExecConfig(true, "plugin.TagConfig");
PrintToServer("halloa1");
if (GetConVarBool(g_cvarConf))
{
PrintToServer("halloa2");
/*--------------------------------------Get Tags------------------------------------------------*/
new Handle:cvTag = FindConVar("sv_tags"); //sv_tags -> cvTag
new String:sTag[255];
new String:sTag2[255];
GetConVarString(cvTag, sTag[255], 255);
GetConVarString(g_cvarTag0, sTag2[255], 255);
PrintToServer(sTag);
PrintToServer(sTag2);
if (StrContains(sTag, sTag2, true))
{
PrintToServer("halloa3");
new String:sGeht[255];
sGeht = "geht";
SetConVarString(g_cvarTag0T, sGeht);
ServerCommand("exec halo.cfg");
}
}
}
its allready a test and im new in programming so dont judge me now
for Tests ive the "PrintToServer("halloa1");", "PrintToServer("halloa2");" and "PrintToServer("halloa3");"
The first Problem is that the plugin is not working....^^
The second is thats the
"PrintToServer(sTag);"
"PrintToServer(sTag2);"
are not working.
but what im allready not get is how; if i make
Code:
g_cvarTag0 = CreateConVar("sm_tct_0", "hallo", "get Alias for: Tag0Alias");
and
Code:
new String:sTag2[255];
and
Code:
GetConVarString(g_cvarTag0, sTag2[255], 255);
and
Code:
PrintToServer(sTag2);
it prints "allo"
and
Code:
PrintToServer(sTag);
prints nothing....
soooo, why it prints allo and not hallo?
Thats my first Problem.
pls help me to learn Pawn
![Very Happy](images/smilies/biggrin.gif)
maybe i can help someone else if he has Problems...
my test Server is running Contagion with sourcemod.
Greetings,
Dany666
__________________