View Full Version : OnClientAuthenticate
Smoria
09-09-2012, 10:18 AM
Why name and pwd in OnClientAuthenticate always return different values with the same client name?
How can i work with these variables?
NeoPhoenix
09-09-2012, 12:05 PM
this may help you
https://www.vaultmp.com/showwiki.php?title=OnClientAuthenticate
Smoria
09-09-2012, 12:08 PM
I've read all Wiki pages before post this. It doesn't help.
NeoPhoenix
09-09-2012, 12:08 PM
so what is your problem? "name" is the clients name and "pwd" the password
Smoria
09-09-2012, 12:12 PM
I understand what is NAME and PWD means. Read my first message again and, please, try to think before answer.
NeoPhoenix
09-09-2012, 01:26 PM
first of all parameters cant return values, can they? second, name{} is always the clientname, pwd{} always the used password - i tested it, works. third "How can i work with these variables?" what do you want to achieve?
Smoria
09-09-2012, 01:41 PM
I want to compare pwd to String variable
in c++
NeoPhoenix
09-09-2012, 02:02 PM
public OnClientAuthenticate(const name {}, const pwd {})
{
if(strcmp(pwd,"text") != 0) return false;//Deny connection
return true;
}
works fine for me
Smoria
09-09-2012, 02:15 PM
It didn't work in c++ :(
NeoPhoenix
09-09-2012, 03:13 PM
State VAULTSCRIPT OnClientAuthenticate(String name, String pwd) noexcept
{
if(pwd.compare("text") != 0) return False;
return True;
}
Smoria
09-09-2012, 03:43 PM
String maybe need to be cRawString because function not called
NeoPhoenix
09-09-2012, 04:29 PM
no i took the default vaultmp c++ script
foxtacles
09-09-2012, 04:47 PM
The above signature is outdated. Try the following:
// note cRawString instead of String
State VAULTSCRIPT OnClientAuthenticate(cRawString name, cRawString pwd) noexcept
{
if(String(pwd).compare("text") != 0) return False;
return True;
}
foxtacles
09-09-2012, 05:00 PM
OK, I can confirm there is a bug in the C++ version of OnClientAuthenticate. I fixed it, will be included in the update the next days.
Smoria
09-09-2012, 05:05 PM
Okay, thanks
Powered by vBulletin® Version 4.2.1 Copyright © 2023 vBulletin Solutions, Inc. All rights reserved.