 |
|
SourceMod Moderator
|

12-03-2016
, 14:24
Re: [SNIPPET] Maplist Generator
|
#3
|
Quote:
Originally Posted by Grey83
maybe better do it like this?
PHP Code:
// if (!StrEqual(buffer,"",false) && !StrEqual(buffer,".",false) && !StrEqual(buffer,"..",false)) if (strlen(buffer) > 4) // if length of contents of the buffer is equal or less than 4 characters, then contents wrong { strcopy(tmp_path,255,path); StrCat(tmp_path,255, "/"); StrCat(tmp_path,255, buffer); if(type == FileType_File) { // if (StrContains(tmp_path, ".bsp") != -1) if (StrEqual(tmp_path[strlen(tmp_path)-4], ".bsp", false)) // just compare the last 4 characters with the correct extension // or use: if (StrContains(tmp_path, ".bsp") == strlen(tmp_path)-4) { ReplaceString(tmp_path, 255, ".bsp", ""); ReplaceString(tmp_path, 255, "maps/", ""); files.PushString(tmp_path); } } }
|
I jist threw it together from my log cleaner plugin. While i didnt read your edit (at work), there are plenty of better ways to do this and Im sure yours is better than what I posted
I didnt bother to spend time on it  The best solution is to not use sourcemod at all
Last edited by headline; 12-03-2016 at 14:25.
|
|
|
|