Blockland Forums > Modification Help

GameConnection::OnConnectRequest(); help.

Pages: (1/2) > >>

Jasa1:

So I have this code

--- Code: --- 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.");
}
}
}


--- End code ---
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.

Kalphiter:

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

Jasa1:


--- Quote from: Kalphiter on November 10, 2011, 06:18:25 PM ---How the hell do you expect to run code after a return?

--- End quote ---
Sir, I do believe you make sense. Locking.

Jasa1:

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

Swollow:


--- Quote from: Jasa1 on November 10, 2011, 07:05:58 PM ---Actually, apparently moving "return Parent::onConnectRequest(%client,%lanname,%netname,%clanpre,%clansuf);" causes it to crash the server whenever somebody connects.

--- End quote ---
try just using

--- Code: ---Parent::onConnectRequest(%client,%lanname,%netname,%clanpre,%clansuf);
--- End code ---
instead of it with return in front of it

Pages: (1/2) > >>

Go to full version