PDA

View Full Version : Map prefix detector


rodrigo286
02-17-2012, 18:08
Hello need to detect the prefix maps and execute commands.

Example when a map cs_ basically call a function like:

PrintToChatAll ("\ x03 [\ x04CSS \ x03] \ x01 map detector test", id);

I tried many ways, but still can not detect the prefix from him but the name.

Thanks.

Impact123
02-17-2012, 18:28
Take a look at one of the MapConfig-Plugins (http://www.sourcemod.net/plugins.php?cat=0&mod=-1&title=map+config&author=&description=&search=1).

Yours sincerely
Impact

McFlurry
02-17-2012, 18:36
stock GetMapNamePrefix(const String:map[], String:dest[], maxlength)
{
decl String:splits[1][5];
ExplodeString(map, "_", splits, sizeof(splits), sizeof(splits[]));
Format(dest, maxlength, splits[0]);
}
Example input:
"cs_italy"
output:
"cs"