Comparing strings
Dunno if this goes here.
Let's say... steamid1 = 0:0:28033812 steamid2 = 0:0:28033 if(containi(steamid1, steamid2[i]) != -1) { blah } When this happens 0:0:28033812 is also affected since it has 0:0:28033 inside of it. What would be the best solution for this? Should I be even using containi? |
Re: Comparing strings
equal()
|
Re: Comparing strings
But using equal() would only allow that specific SteamID.
I was wondering if you can have 0:0:28033XX SteamID's be allowed and if it goes out of that range then they won't be affected. This way all the cafe terminals will have an admin account and if someone out there connects then they won't get admin. |
Re: Comparing strings
Try with str_to_num starting after the last colon.
Then check if that number is within your desired numbers. Ex. Code:
new string[] = "steam:2300" //just a random id |
Re: Comparing strings
Hey Emp, would that include 0:0:?
All it says is str_to_num - Returns a string converted to a number When you do... new num = str_to_num( string[10] ) Does that mean it'll count to 10 and strip the rest? Like for STEAM:0:0:1234567890 it'll strip STEAM:0:0: and then 1234567890 will be in num? |
Re: Comparing strings
If you are using steamids as the string (STEAM_0:0:XXXX)
Then the last colon is the 10th character, so you would do Code:
str_to_num( string_name[10] ) |
Re: Comparing strings
What if I have STEAM_0:0:123 and STEAM_0:0:234 and my own SteamID which is STEAM_0:0:28033.
Like. Code:
str_to_num only strips the front one? What if I want to strip the back one too or simply the ones at the back like steam_0:0:1231131? |
Re: Comparing strings
You'll have to separate it into two ranges or something.
Code:
if within first range |
Re: Comparing strings
Damn, all that just to get admin and ban someone...screw these people they should just call the manager. Haha, thanks though! At least I could do it for my ID.
|
| All times are GMT -4. The time now is 01:38. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.