Raised This Month: $ Target: $400
 0% 

Solved Help compare two strings


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
TudorLaLeagane
Junior Member
Join Date: Mar 2018
Old 01-28-2019 , 09:19   Help compare two strings
Reply With Quote #1

Hi! I would like to compare two strings. Here is my code:

PHP Code:
stock LogInUser(id,givenpass[65])
{
    if(
gLoggedin[id] == 0){
        new 
userid get_user_userid(id)  
        
log_amx("%s - gpass || %s - user pass",givenpass,gPassword[id])
        if(
strcmp(gPassword[id],givenpass) == 0)
        {
            
chat_color(id,"!y[!gDR!y]!g Te-ai logat cu succes!")
            
gLoggedin[id] = 1
        
}
        else{
            
server_cmd("kick #%d parola incorecta!",userid)
        }
    }
    else{
        
chat_color(id,"!y[!gDR!y]!g Esti deja logat!")
        return 
PLUGIN_CONTINUE
    
}
    return 
PLUGIN_CONTINUE

In real life, givenpass = 1234
gPassword[id] = 1234
It takes the password from a file, here is the code for that:
PHP Code:
public LoadData(id){
    if(
is_user_bot(id))
    {
        return 
PLUGIN_HANDLED
    
}
    new 
Name[33]
    
get_user_name(id,Name,charsmax(Name))
    new 
path[128]
    
format(path,127,"%s%s.txt",gPathMaster,Name)
    if(!
file_exists(path))
    {
      
write_file(path,"PAROLA:",4)
    }
    new 
fopen(path,"r")
    new 
szLine[128]
    while(!
feof(f))
    {
        
fgets(f,szLine,charsmax(szLine))
        if(
contain(szLine,"PAROLA:") >-)
        {
            
replace_all(szLine,127,"PAROLA:","")
            
format(gPassword[id],64,"%s",szLine)
            
CheckPassword(id)
        }
    }
    if(
Credite[id] == 0)
    {
        
Credite[id] = 500000
    
}
    
fclose(f)
    return 
PLUGIN_HANDLED

Even tho the strings are completly the same, it still says that they are different.

Last edited by TudorLaLeagane; 01-28-2019 at 11:16.
TudorLaLeagane is offline
 



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 07:31.


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