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 f = fopen(path,"r")
new szLine[128]
while(!feof(f))
{
fgets(f,szLine,charsmax(szLine))
if(contain(szLine,"PAROLA:") >-1 )
{
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.