STRCMP help
#5

Quote:
Originally Posted by AndySedeyn
Посмотреть сообщение
The variable 'location' is not declared as an array and thus can't store strings or be used in strcmp.
So it has to be an array? I thought it was just two strings, fixed the issue when I turned it into an array!

Quote:
Originally Posted by AndySedeyn
Посмотреть сообщение
Depends. '123gym' and 'ezoigjegym' will both return an index when strfinding for 'gym'. If you have multiple gym locations, then it will return the code under the first if-statement that the check is first used:
PHP код:
if(strfind(params"gym") != -1) {
    
//code
}
else if(
strfind(location"gym2") != -1) {
    
// code

If you now type in the command "gym2" or "gym3", it will always execute the code under the first if statement. If you were to change the else-if statement to an if statement, then it will always execute the last if statement that it is checked against
Probably don't wanna go down that road then. Just turned my location variable to an array, works perfectly fine so thanks for that!
Reply


Messages In This Thread
STRCMP help - by BR3TT - 26.03.2017, 03:51
Re: STRCMP help - by AndySedeyn - 26.03.2017, 04:09
Re: STRCMP help - by ISmokezU - 26.03.2017, 04:19
Re: STRCMP help - by AndySedeyn - 26.03.2017, 04:25
Re: STRCMP help - by BR3TT - 26.03.2017, 04:39

Forum Jump:


Users browsing this thread: 4 Guest(s)