Raised This Month: $ Target: $400
 0% 

[SNIPPET] Maplist Generator


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Grey83
Veteran Member
Join Date: Dec 2014
Location: Ukraine
Old 12-03-2016 , 13:40   Re: [SNIPPET] Maplist Generator
Reply With Quote #1

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,255buffer);
                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_path255".bsp""");
                        
ReplaceString(tmp_path255"maps/""");
                        
files.PushString(tmp_path);
                    }
                }
            } 
__________________

Last edited by Grey83; 12-03-2016 at 13:49.
Grey83 is offline
headline
SourceMod Moderator
Join Date: Mar 2015
Old 12-03-2016 , 14:24   Re: [SNIPPET] Maplist Generator
Reply With Quote #2

Quote:
Originally Posted by Grey83 View Post
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,255buffer);
                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_path255".bsp""");
                        
ReplaceString(tmp_path255"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.
headline is offline
Sillium
AlliedModders Donor
Join Date: Sep 2008
Location: Germany
Old 12-05-2016 , 02:04   Re: [SNIPPET] Maplist Generator
Reply With Quote #3

I think Maplister does the same thing:
https://forums.alliedmods.net/showthread.php?t=56376
__________________
brb, dishes have developed their own language and are talking to the garbage about overthrowing me... i must correct this

www.unterwasserpyromanen.de
Sillium is offline
headline
SourceMod Moderator
Join Date: Mar 2015
Old 12-05-2016 , 03:17   Re: [SNIPPET] Maplist Generator
Reply With Quote #4

Quote:
Originally Posted by Sillium View Post
I think Maplister does the same thing:
https://forums.alliedmods.net/showthread.php?t=56376
Lol! Yup
headline is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:56.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode