Author Topic: Errors causing delay of autoAdminCheck [FIXED]  (Read 1716 times)

I was trying to make a script so if you are not an admin while the package was enabled you would be removed from the server upon connect. For some reason when I typed it up I have no syntax errors but it kicks all players before the server can even check if you are an admin.

Source Code

Code: [Select]
package AdminOnly
{
   function GameConnection::autoAdminCheck(%client)
   {
      if(%client.isSuperAdmin)
      {
         return "";
      }
      else
      {
         messageAll(%client.name @ " has been blocked from the server.");
         %client.delete("Admin Only is blocking you from joining this server.");
         echo("A player has been blocked from joining the server.");
      }
   }
};
activatePackage(AdminOnly);

Console Log

Code: [Select]
Got connect request from IPX:00000000:000000000000:0
  net name = Matthew Padilla
Connection established
Connected successfully, killing other pending connections
AUTHCHECK: Matthew Padilla = LAN client -> internet server, auth with server ip
246 add-ons found.
Auth Init Successfull: Matthew Padilla
CADD: 14284 local
 +- bl_id = 42931
 +- no auto admin
*** Sending mission load to client:
Posting to master server
Posting to rtb server
*** New Mission
*** Phase 1: Download Datablocks & Targets
Received manifest and requested 646 blobs. (255 duplicates removed)
Got non-CURLE_OK result on a request, result was 3 'URL using bad/illegal format or missing URL'
 - Request was for ''
Got non-CURLE_OK result on a request, result was 3 'URL using bad/illegal format or missing URL'
 - Request was for ''
Got non-CURLE_OK result on a request, result was 3 'URL using bad/illegal format or missing URL'
 - Request was for ''
Got non-CURLE_OK result on a request, result was 3 'URL using bad/illegal format or missing URL'
 - Request was for ''
Got non-CURLE_OK result on a request, result was 3 'URL using bad/illegal format or missing URL'
 - Request was for ''
Got non-CURLE_OK result on a request, result was 3 'URL using bad/illegal format or missing URL'
 - Request was for ''
Got non-CURLE_OK result on a request, result was 3 'URL using bad/illegal format or missing URL'
 - Request was for ''
Got non-CURLE_OK result on a request, result was 3 'URL using bad/illegal format or missing URL'
 - Request was for ''
CDN Download finished
Could not locate texture: base/data/shapes/player/Add-Ons/Face_Jirue/KleinerSmiley (download failed, using default texture)
  +- using blank texture
Could not locate texture: base/data/shapes/player/Add-Ons/Decal_Default/Space-Old (download failed, using default texture)
  +- using blank texture
*** Phase 2: Download Ghost Objects
*** Phase 3: Mission Lighting
Mission lighting done
Executing config/client/Favorites.cs.
Matthew Padilla spawned.
Got Connect challenge Request from 76.250.77.218:33635
Got connect request from 76.250.77.218:33635
  net name = Matthew Padilla
AUTHCHECK: Matthew Padilla = internet client -> internet server, regular auth
Auth Init Successfull: Matthew Padilla
CADD: 15504 76.250.77.218:33635
 +- bl_id = 42931
A player has been blocked from joining the server.
 +- no auto admin
*** Sending mission load to client:
Posting to master server
Posting to rtb server
Issuing Disconnect packet.
CDROP: 15504 76.250.77.218:33635

base/server/mainServer.cs (671): Unable to find object: '' attempting to call function 'killDupes'
BackTrace: ->servAuthTCPobj::onLine


base/server/mainServer.cs (674): Unable to find object: '' attempting to call function 'schedule'
BackTrace: ->servAuthTCPobj::onLine

This was testing while on my own server, joining on multiple clients.
« Last Edit: May 23, 2013, 04:30:41 PM by Matthew Padilla »

Code: [Select]
package AdminOnly
{
   function GameConnection::autoAdminCheck(%client)
   {
      %admin = parent::autoAdminCheck(%client);
      if(%admin < 1)
      {
         messageAll(%client.name @ " has been blocked from the server.");
         echo("A player has been blocked from joining the server.");
         %client.schedule(10,delete,"Admin Only is blocking you from joining this server.");
      }
      return %admin;
   }
};
activatePackage(AdminOnly);

Code: [Select]
package AdminOnly
{
   function GameConnection::autoAdminCheck(%client)
   {
      %admin = parent::autoAdminCheck(%client);
      if(%admin < 1)
      {
         messageAll(%client.name @ " has been blocked from the server.");
         echo("A player has been blocked from joining the server.");
         %client.schedule(10,delete,"Admin Only is blocking you from joining this server.");
      }
      return %admin;
   }
};
activatePackage(AdminOnly);

Why 10? It's clamped up to 16 anyway. Just use 0, to run it in the next frame.

Why 10? It's clamped up to 16 anyway. Just use 0, to run it in the next frame.
I dunno I always use 10

Thanks Zeblote, it worked.
« Last Edit: May 22, 2013, 06:59:08 PM by Matthew Padilla »

Why 10? It's clamped up to 16 anyway. Just use 0, to run it in the next frame.
The actual number you're referring to is 32ms, which is not necessarily the case. I actually have no idea what schedule times between 0 and 31ms do. 0 doesn't push it to the next frame/tick, it actually does one of three things:
1) Execute the schedule once all the current threads in the tick have completed
2) Execute the schedule right after the current thread is finished (IE a thread initiated by the engine such as a TCP data receiving or a player connect event), depending on the FIFO list of ready-to-run scheduled events
3) If it's already time for the next tick (definition of high CPU usage), execute all threads in the next tick and then go to step 1

That's a rough description of the process as I'm not actually sure how it works. Pretty interesting topic.
« Last Edit: May 27, 2013, 06:15:01 PM by Kalphiter² »

The actual number you're referring to is 32ms, which is not necessarily the case. I actually have no idea what schedule times between 0 and 31ms do.

Where do you get that from?

0: no delay, runs the next time schedules are processed
1: delay of 16 ms ("rounded to" next time schedules are processed)
2: delay of 16 ms ("rounded to" next time schedules are processed)
...
15: delay of 16 ms ("rounded to" next time schedules are processed)
16: delay of 16 ms ("rounded to" next time schedules are processed)
17: delay of 17 ms ("rounded to" next time schedules are processed)
18: delay of 18 ms ("rounded to" next time schedules are processed)
...
20: delay of 20 ms ("rounded to" next time schedules are processed)
...

0 doesn't push it to the next frame/tick, it actually does one of three things:
1) Execute the schedule once all the current threads in the tick have completed
2) Execute the schedule right after the current thread is finished (IE a thread initiated by the engine such as a TCP data receiving or a player connect event), depending on the FIFO list of ready-to-run scheduled events
3) If it's already time for the next tick (definition of high CPU usage), execute all threads in the next tick and then go to step 1

That's a rough description of the process as I'm not actually sure how it works. Pretty interesting topic.

It still has the effect of executing it in the next "frame" (after any current blocking logic) in the eyes of the TorqueScript interpreter.