The online racing simulator
I cannot read the IP address
Hello. I'm working on a blacklist. I cannot ban the player in the txt file. I tried two codes but it didn't work.



This is my own code.
CatchEvent OnConnect( $userName )
$IPAddress = GetCurrentPlayerVar( "IPAdress" );
UserGroupFromFile( "IPAddress", "./Blacklist.txt" );

IF ( UserInGroup( "IPAdress",$IPAddress ) )
THEN
cmdLFS("/kick " . GetCurrentPlayerVar("userName") );
ENDIF
EndCatchEvent

This code belongs to Yisc[NL]. But this doesn't work either. Where is my mistake?
Event OnNewPlayerJoin( $userName )
$IPAddress = GetCurrentPlayerVar( "IPAdress" );
UserGroupFromFile( "IPAddress", "./Blacklist.txt" );

IF ( UserInGroup( "IPAdress",$IPAddress ) == 1 )
THEN
cmdLFS("/kick " . GetCurrentPlayerVar("userName") );
ENDIF
EndEvent

You didn't provide the definition of functions UserGroupFromFile() and UserInGroup(), which may be quite complex. They are the core of what you're trying to do here. Without seeing how those functions work, it's impossible to check validity of the rest of your code. Also, you have to provide a structure that you have in the Blacklist.txt, this is also very important and it will dictate how these other 2 functions have to work. What about the location of this txt file? Will "./Blacklist.txt" know where to look for it correctly? To me it seems that it has to be olaced in the same folder where you have the lapper executable.

Small suggestion, I would make IF statements like this for better readability:
IF (condition) THEN
#some code
ELSE
#some other code
ENDIF
Actually I found a way. But I'm working on another issue. When I finish, I will explain the solution here.
Can you share your another way? Might be also helpful for someone else.
This thread is closed

FGED GREDG RDFGDR GSFDG