Raised This Month: $ Target: $400
 0% 

Solved [H3LP] Check portion of mapname


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DarthMan
Veteran Member
Join Date: Aug 2011
Old 04-15-2017 , 15:19   [H3LP] Check portion of mapname
Reply With Quote #1

Hello. I know that I can use if(contain(szMap, szCurMap)) , but how can I check exactly for example if I have a map ab1_1_1 and ab2_2_1 the stuff will be executed on both maps, and I only want it to be executed on the map specified in the ini file. If I have specified ab2_2 as the map in the ini file, it should execute on all maps containing only ab2_2 and not also ab2_1. Thanks !

Last edited by DarthMan; 04-16-2017 at 08:14. Reason: Solved
DarthMan is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 04-15-2017 , 18:42   Re: [H3LP] Check portion of mapname
Reply With Quote #2

Any ideas? I hope that someone will come with a good solution. Basically szMap has a smaller name than szCurMap
DarthMan is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 04-15-2017 , 20:07   Re: [H3LP] Check portion of mapname
Reply With Quote #3

PHP Code:
if(equal(szCurMapszMapstrlen(szMap))) 
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
LegacyCode
Member
Join Date: Apr 2017
Old 04-16-2017 , 01:26   Re: [H3LP] Check portion of mapname
Reply With Quote #4

Quote:
Originally Posted by OciXCrom View Post
PHP Code:
if(equal(szCurMapszMapstrlen(szMap))) 
He said szMap (from the .ini file) is smaller than szCurMap, e.g. only a portion or "prefix" of the maps he wants to target.

This code checks if szCurMap contains szMap at position 0, so the beginning of szCurMap (contain & containi both return the position of where the string was found in the source string):

PHP Code:
if ( containszCurMapszMap ) == 
If szCurMap is ab2_2_1 and szMap is ab2_2, it should return 0 and therefore work as expected.

I hope I understood your problem, if not feel free to share more detailed info.

- LegacyCode

Last edited by LegacyCode; 04-16-2017 at 01:27.
LegacyCode is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 04-16-2017 , 05:46   Re: [H3LP] Check portion of mapname
Reply With Quote #5

Quote:
Originally Posted by LegacyCode View Post
He said szMap (from the .ini file) is smaller than szCurMap, e.g. only a portion or "prefix" of the maps he wants to target.

This code checks if szCurMap contains szMap at position 0, so the beginning of szCurMap (contain & containi both return the position of where the string was found in the source string):

PHP Code:
if ( containszCurMapszMap ) == 
If szCurMap is ab2_2_1 and szMap is ab2_2, it should return 0 and therefore work as expected.

I hope I understood your problem, if not feel free to share more detailed info.

- LegacyCode
Actually OciXCrom's code does the same thing. Take a look at what the third param does and what he passed as an argument to it.
klippy is offline
DarthMan
Veteran Member
Join Date: Aug 2011
Old 04-16-2017 , 07:31   Re: [H3LP] Check portion of mapname
Reply With Quote #6

Quote:
Originally Posted by OciXCrom View Post
PHP Code:
if(equal(szCurMapszMapstrlen(szMap))) 
Thanks !
DarthMan 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 17:53.


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