Raised This Month: $32 Target: $400
 8% 

Solved contain not working


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 01-23-2018 , 03:53   contain not working
Reply With Quote #1

hello, I would like to ask why contain doesn`t work. When I print values to the chat. It seems fine. but doesn't pass contain/i() stage, I mean 3 is not printed
PHP Code:
#include <amxmodx>
#include <amxmisc>

#define LEVEL ADMIN_CVAR

new g_SvPassword

public plugin_init() {

    
register_plugin("AMX Password""0.2""SmileY")

    
register_clcmd("say""_SayHandle")

    
g_SvPassword get_cvar_pointer("sv_password")
}

public 
_SayHandle(id) {
        
client_print(idprint_chat"0")
    new 
Args[192];
    
read_args(Argscharsmax(Args))
    
remove_quotes(Args);
    if(!(
get_user_flags(id) & LEVEL)) {
        
client_print(idprint_chat"1")
        return
    }
        
client_print(idprint_chat"2")
        
client_print(idprint_chatArgs)
    if(
containi(Args"/password")) {
            
client_print(idprint_chat"3")
            new 
Pdata[2][32]
        
            
parse(ArgsPdata[0], charsmax(Pdata[]), Pdata[1], charsmax(Pdata[]))

        if(
equal(Pdata[0],"/password")) {
            
client_print(idprint_chat"4")
            
set_pcvar_string(g_SvPasswordPdata[1])
            
client_print(idprint_chat"Server Password has beenchanged.")
            return
        }
    }
    else if(
equal(Args"/passoff")) {
        
client_print(idprint_chat"5")
        
set_pcvar_string(g_SvPassword"")
        
client_print(idprint_chat"Server Password has been removed")
        return
    }

    return

__________________
retired chump

Last edited by DjSoftero; 01-23-2018 at 05:18.
DjSoftero is offline
Clauu
Senior Member
Join Date: Feb 2008
Location: RO
Old 01-23-2018 , 04:41   Re: contain not working
Reply With Quote #2

Because contain(i) return index of first matched segment, and -1 for no match.
Clauu is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 01-23-2018 , 05:16   Re: contain not working
Reply With Quote #3

So it means it returns 0 as it starts there? gotcha
__________________
retired chump
DjSoftero is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 01-23-2018 , 05:39   Re: contain not working
Reply With Quote #4

PHP Code:
if( contain[i]( Text1Text2 ) != -
__________________
edon1337 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:31.


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