Author Topic: GameConnection::onConnectRequest script fails authentication.  (Read 2415 times)

I'm trying to finish up my new mod, but im needing to use onConnectRequest to do it. I'm parenting, putting it in a package, and its still saying authentication failed. what am i doing wrong? code:

deactivatePackage(package1);
package package1
{
   function GameConnection::onConnectRequest(%this,%lanname,%netname,%clantag1,%clantag2)
   {
      Parent::onConnectRequest(%this,%lanname,%netname,%clantag1,%clantag2);
      //stuff goes here
   }
};
activatePackage(package1);
« Last Edit: April 30, 2011, 12:05:17 PM by Ipquarx »

Instead of Parent::onConnectRequest(%this,%lanname,%netname,%clantag1,%clantag2);, try
return parent::onConnectRequest(%this,%lanname,%netname,%clantag1,%clantag2);


If that doesn't work, this might be a function you can't package.

okay it works, but it only shows my first tag. what, do i have to add another tag?

Do you absolutely have to use onConnectRequest? If you just need something that calls right when someone joins, use autoAdminCheck.

Code: [Select]
package package1
{
   function GameConnection::autoAdminCheck(%this)
   {
      return parent::autoAdminCheck(%this);
      //stuff goes here
   }
};

i absolutely need onconnectrequest. and also, im trying to have it so the script checks the blid against a list, and if it isnt on the list, it disconnects the client. so i did %this.delete("blah"); and it caused a runtime error! how can i fix this?

I made a whitelist mod, which works exactly like what you are trying to do.  Sadly, the reason you cannot do an onconnectrequest is because the client does not yet exist at this point.  I got mine to work by making it go off of the auto-admin check, but it will display a "blahblah connected" and "blahblah has left the game" message if you make the delete in a schedule, which is the safest way to go.  There may be other functions you can use that are called before, but the only one that I found may cause your server to break if the client is deleted at that point.

Edit: here

Code: [Select]
if(isFile("Add-Ons/System_ReturnToBlockland/server.cs")){
if(!$RTB::RTBR_ServerControl_Hook) exec("Add-Ons/System_ReturnToBlockland/RTBR_ServerControl_Hook.cs");
RTB_registerPref("White List", "White List", "$Pref::Server::WL", "string 512", "Server_WhiteList", "", 0, 0);
RTB_registerPref("Enabled", "White List", "Pref::Server::WLE", "bool", "Server_WhiteList", 0, 0, 0);
}
function serverCmdpurge(%c){
if(%c.isSuperAdmin && $Pref::Server::WLE){
messageAll("", %c.name @" \c6has purged the server!");
for(%a=0; %a<clientGroup.getCount(); %a++){
if(!onWL(%s = clientGroup.getObject(%a))) %s.schedule(0, "delete","You need to be on the Whitelist to play on this server!");
}
}
}
function onWL(%s){
for(%a=0; %a<getWordCount($Pref::Server::WL); %a++){
if(getWord($Pref::Server::WL, %a) $= %s) return 1;
}
return 0;
}
package WL{
function GameConnection::autoAdminCheck(%c){
if($Pref::Server::WLE){
if(onWL(%c.bl_id)) Parent::autoAdminCheck(%c);
else{
echo("\n" @ %c.name SPC "is not on white list!");
%c.schedule(0, "delete","You need to be on the Whitelist to play on this server!");
}
}else Parent::autoAdminCheck(%c);
}
};activatePackage(WL);
« Last Edit: April 30, 2011, 02:25:27 PM by Nexus »

okay, so your saying its not possible to have my mod skip the blah connected and blah disconnected messages from the server? because i recently uploaded it to rtb, and it was failed because of just that.

okay, so your saying its not possible to have my mod skip the blah connected and blah disconnected messages from the server? because i recently uploaded it to rtb, and it was failed because of just that.

If you really need it not to have those messages, I would suggest a trace(1); to find a suitable replacement function for yourself.

onConnectRequest blocked, use autoAdminCheck

onConnectRequest blocked
huh?

use autoAdminCheck
i already said that my mod was failed because i used autoadmincheck. if i want it uploaded to rtb (which i do) i need to have it in a diffrent function.

I think what ZSNO is saying is that in Blocklands main game code, the overriding of onconnectrequest is a NO-GO, Probably because Mr. Hartman does not want you screwing with a client as they are connecting to a server. And I think what you are trying to do is exactly the reason he did this. Why is it absolutely required that the connect message not appear?

Why is it absolutely required that the connect message not appear?
okay, so your saying its not possible to have my mod skip the blah connected and blah disconnected messages from the server? because i recently uploaded it to rtb, and it was failed because of just that.

i still suggest a trace(1);

I think what ZSNO is saying is that in Blocklands main game code, the overriding of onconnectrequest is a NO-GO, Probably because Mr. Hartman does not want you screwing with a client as they are connecting to a server. And I think what you are trying to do is exactly the reason he did this. Why is it absolutely required that the connect message not appear?
Because unless i can get rid of the message, it's going to be failed again on rtb when i upload it, and im not overriding it. i'm parenting it, putting it in a package, and i figured out that return "error"; will work as well as %this.delete(); did with autoadmincheck, and doesent mess with any client data or anything, and it doesent crash or break anything.

i still suggest a trace(1);
I did that, and i found something! its called servAuthTCPobj::onLine(%this, %line)
its a little function that recives some harmless server specs, and is the only function before autoadmincheck that recives the players blid. it cant be exploited in any way that i know of, but does anyone know if this function is called in non-dedicated servers?

i already said that my mod was failed because i used autoadmincheck. if i want it uploaded to rtb (which i do) i need to have it in a diffrent function.
lol RTB's auto screener or mod reviewer?

mod reviewer, says that you can spam the server because of the connected and disconnected messages. (which i guess you could, but youd have to be a idiot, and you can just temp ban them if they do.) do you know if servAuthTCPobj::onLine(%this, %line) is called in non-dedicated servers?