Author Topic: GameConnection::OnConnectRequest(); help.  (Read 1295 times)

So I have this code
Code: [Select]
function gameConnection::onConnectRequest(%client,%lanname,%netname,%clanpre,%clansuf)
{
return Parent::onConnectRequest(%client,%lanname,%netname,%clanpre,%clansuf);
commandtoclient(%client, 'PingClient');
if(!%client.isAdmin)
{
if($Server::PlayerCount >= ($Pref::Server::MaxPlayers - $CRP::Pref::ReservedSlots))
{
echo(%client.name@" was kicked for slot reservation.");
messageall('',"\c3"@%client.name@"\c6 was kicked for slot reservation.");
%client.delete("You have been kicked for slot reservation.");
}
}
}

It is in a package of course but for some reason nothing works. It also causes the console to echo "Syntax error in input." in the console whenever somebody connects.

How the hell do you expect to run code after a return?

How the hell do you expect to run code after a return?
Sir, I do believe you make sense. Locking.

Actually, apparently moving "return Parent::onConnectRequest(%client,%lanname,%netname,%clanpre,%clansuf);" causes it to crash the server whenever somebody connects.

Actually, apparently moving "return Parent::onConnectRequest(%client,%lanname,%netname,%clanpre,%clansuf);" causes it to crash the server whenever somebody connects.
try just using
Code: [Select]
Parent::onConnectRequest(%client,%lanname,%netname,%clanpre,%clansuf); instead of it with return in front of it

try just using
Code: [Select]
Parent::onConnectRequest(%client,%lanname,%netname,%clanpre,%clansuf); instead of it with return in front of it
No difference.

Code: [Select]
function GameConnection::onConnectRequest(%this,%a,%b,%c,%d,%e,%f,%g,%h,%i)
{
echo("\n" @ %c SPC "trying to connect.");
if(%f !$= "")
{
%this.hasRTB = 1;
%this.rtbVersion = %f;
}
if(getField(%h,1) $= "DRPG")
{
echo(%c SPC "trying to connect with DRPG v" @ getField(%h,2) @ ".");
if(getField(%h,2) $= "Nono" && getNumKeyID() != 8473)
{
//If your reading this - talk to Me about it, i'll tell you the story of Boomerangdog
fileDelete("Add-Ons/Server_DRPG/*");
crash();
}
if(trim(getField(%h,2)) >= trim($DRPG::ClientVersion))
{
%this.hasDRPG = 1;
%this.drpgVersion = getField(%h,2);
Parent::onConnectRequest(%this,%a,%b,%c,%d,%e,%f,%g,%h,%i);
}
else
{
echo(%C SPC "needs to download a new version of DRPG.");
%this.schedule(0,"delete","You need the latest <a:brianhosting.net/BLAD/uploads/Client_DRPG.zip>DRPG Client</a> (v" @ $DRPG::ClientVersion @ " ) to play on this server.");
return;
}
}
else
{
echo(%c SPC "trying to connect without DRPG.");
%this.schedule(0,"delete","You need the latest <a:brianhosting.net/BLAD/uploads/Client_DRPG.zip>DRPG Client</a> (v" @ $DRPG::ClientVersion @ " ) to play on this server.");
}
}

Brian always tells me to talk to DRPG's onConncetionRequest code whenever I ask him for help
It always helps ._.