I tried to include custom melee (e.g. pickaxe in "Fall in Death") from custom maps automatically like this:
Code:
...
char str[300];
strcpy (str, result->GetString("meleeweapons"));
strcat (str, ";");
strcat (str, g_MeleeList.GetString());
Game_KeyValues__SetString(result, "meleeweapons", str);
...
So the idea is to use the melee list from the map and add the list from the "l4d_melee_weapons" cvar.
Sure some melee names would be double in the whole string, but I think that would not matter much (maybe higher probability when directors selects melee?).
And with that approach I would have e.g. the pickaxe from "fall in death" campaign in the list.
I tried with map config plugin to add the pickaxe to the l4d_melee_weapons cvar list.
It works but only for the second map and in the next map after the last "fall in death" map the extension still would use the pickaxe.
Setting the old cvar l4d_melee_weapons (without pickaxe) in server.cfg is too late, because the extension is reading the l4d_melee_weapons cvar very early, before the server.cfg is read.
My implementation idea from above does not work and srcds is crashing shortly after startup.
It seems that result->GetString does not work.
Maybe something with heap memory like written in an earlier post.
But I thought reading should work (or not?)
Or how to get the signature for this GetString method then?
Should the maps melee list be available here with GetString or am I wrong?
Well I have installed all this sdks today for the first time (sourcemod sdk, metamod sdk, hl2sdk for l4d2).
I had visual studio express 2010 already and I'm able to compile the original zip contents from the first post here and get a working dll.
Actually I would need it for linux but I tried with windows first.
Hope to get it compiling for linux too when my code works for windows.
So does anybody have an idea how to implement that for windows and linux?
Update:
Found the problem.
With my code above the list got longer and longer because the method is called very often and it appended the g_MeleeList at each call.
When the list reached some length, it crashed.
__________________