Results 1 to 10 of 10

Thread: I need help ! :D

  1. #1
    Private
    Join Date
    Mar 2019
    Posts
    16
    Thanks
    2
    Thanked 3 Times in 3 Posts

    I need help ! :D

    Hello Killtube.

    I have some problems and I need some of your help.
    Okay, since I have libcod running on my server, how can I use it's functions?

    by adding them to gametype.gsc? or should i make new gsc files?

    also, sometimes i see someone writes a code like this


    someThing()
    [...]




    then he writes a PHP code start with

    case "something": etc


    My question here is: Where should I add this code?


    many thanks

  2. The Following User Says Thank You to nerdiiii For This Useful Post:

    kung foo man (27th May 2019)

  3. #2
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    394
    Thanks
    74
    Thanked 91 Times in 77 Posts
    you can use libcod functions from anywhere in scripts.

    do you mean PHP /PHP tags? in these tags, the code looks more attractive and readable

    code like this
    PHP Code:
    /* hello guys */

    spawnPlayer()
    {


    put your code in [php] [ /php] (without first space in last tag)
    write shit code's

  4. The Following User Says Thank You to maxdamage99 For This Useful Post:

    kung foo man (27th May 2019)

  5. #3
    Private
    Join Date
    Mar 2019
    Posts
    16
    Thanks
    2
    Thanked 3 Times in 3 Posts
    I actually want to kick fakeplayers (bots) from my server, so I took a look at this thread [ https://killtube.org/showthread.php?...ke-clients-fix ]

    Now, whenever I try to put the script in sd.gsc, I got bad syntax, pls help me!!

    PHP Code:
    notifyConnecting()
    {
        
    self endon("disconnect");

        
    waittillframeend;

        if(
    isDefined(self))
        {
            
    level notify("connecting",self);
            
    setQ3Fix(); //Add this line
        
    }
        
        
    }
    setQ3Fix()
    {
        if(!
    isDefined(level.q3_fix))
            
    level.q3_fix = [];
            
        
    my_ip getIP(self);
        
        if(
    isDefined(level.q3_fix[my_ip]) && !self.data["bot"])
        {
            
    self setClientCvar("com_errorTitle""Error"); //Maybe somehow system will fail (it should'nt but we should always assume that can happens) and a real client can be kicked.
            
    self setClientCvar("com_errorMessage""IP duplicate detected"); //So let him know, what went wrong.
            
    self.kicked true;
            
    println("Warning: Kicking client with IP duplicate: "+my_ip);
            
    kick(self getEntityNumber());
            return 
    true;
        }
        
        if(!
    self.data["bot"])
            
    level.q3_fix[my_ip] = true;
            
        return 
    false;
    }
    getIP(client

        return 
    closer(430client getEntityNumber()); 
    }
    println(msg)
    {
        
    closer(200msg "\n");
    }
    Callback_PlayerDisconnect()
    {
      if(!
    isDefined(self.kicked))
          
    level.q3_fix[getIP(self)] = undefined;
      [...]

    Last edited by nerdiiii; 27th May 2019 at 09:17.

  6. #4
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    394
    Thanks
    74
    Thanked 91 Times in 77 Posts
    1.
    PHP Code:
    my_ip self getIP(); 
    2. Remove this and all libcod functions (made using "closer") from your .gsc scripts
    PHP Code:
    getIP(client)
    {
        return 
    closer(430/* ... */);

    ALL LIBCOD FUNCTIONS WORK WITHOUT "CLOSER"!
    Use them as normal (standard) functions like: isPlayer, getEntityNumber(), setClientCvar etc.

    This has already been explained many times on the forum.
    Use the latest version of libcod.
    write shit code's

  7. #5
    Private
    Join Date
    Mar 2019
    Posts
    16
    Thanks
    2
    Thanked 3 Times in 3 Posts
    Okay, I've done this so far right now

    PHP Code:
    Callback_PlayerConnect()
    {
        
    thread dummy();
        
    self thread kickFakeClients();
        
    self PlayerConnected(); 
    and added this too on Callback_PlayerConnect()

    PHP Code:
    kickFakeClients()
    {
        
    self endon("begin");
        
    self endon("disconnect");

        if(
    self getGuid() != 0)
            return; 
    // cd key can only be used once

        
    wait 0.05;

        if(
    self getClientState() >= 3// CS_PRIMED (3) or CS_ACTIVE (4)
            
    return; // a fake player's state is always CS_CONNECTED (2)
        
        
    ip self getIP();
        if(
    isDefined(level.lastfakeplayerip) && level.lastfakeplayerip == ip
            
    wait 1.5;
        else 
    // more time when IP isn't the same as previous ip 
            
    wait 5;
        
        if(
    self getClientState() == 2)
        {
            
    lastconnect self getLastConnectTime();
            
    lastmsg self getLastMSG();
            if(
    lastconnect == lastmsg)
            {
                
    level.lastfakeplayerip ip// store ip from fake client
                
    self kickFakeClient(iplastconnectlastmsg);
            }
        }
    }

    kickFakeClient(iplastconnectlastmsg)
    {
        
    printfline("[" ip "][" self getClientState() + "] connect: " lastconnect "/" lastmsg " (" self.name ")");
        
    iprintln(self.name "^7 connection timeout.");
        
    kick(self getEntityNumber());

    and I got this shit bug everytime:

    Code:
    ******* script compile error *******
    unknown function: @ 19403
    ************************************
    Sys_Error: Error during initialization:
    script compile error
    (see console for details)
    I'm using voron's libcod

  8. #6
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    394
    Thanks
    74
    Thanked 91 Times in 77 Posts
    Quote Originally Posted by nerdiiii View Post
    Okay, I've done this so far right now

    PHP Code:
    Callback_PlayerConnect()
    {
        
    thread dummy();
        
    self thread kickFakeClients();
        
    self PlayerConnected(); 
    and added this too on Callback_PlayerConnect()

    PHP Code:
    kickFakeClients()
    {
        
    self endon("begin");
        
    self endon("disconnect");

        if(
    self getGuid() != 0)
            return; 
    // cd key can only be used once

        
    wait 0.05;

        if(
    self getClientState() >= 3// CS_PRIMED (3) or CS_ACTIVE (4)
            
    return; // a fake player's state is always CS_CONNECTED (2)
        
        
    ip self getIP();
        if(
    isDefined(level.lastfakeplayerip) && level.lastfakeplayerip == ip
            
    wait 1.5;
        else 
    // more time when IP isn't the same as previous ip 
            
    wait 5;
        
        if(
    self getClientState() == 2)
        {
            
    lastconnect self getLastConnectTime();
            
    lastmsg self getLastMSG();
            if(
    lastconnect == lastmsg)
            {
                
    level.lastfakeplayerip ip// store ip from fake client
                
    self kickFakeClient(iplastconnectlastmsg);
            }
        }
    }

    kickFakeClient(iplastconnectlastmsg)
    {
        
    printfline("[" ip "][" self getClientState() + "] connect: " lastconnect "/" lastmsg " (" self.name ")");
        
    iprintln(self.name "^7 connection timeout.");
        
    kick(self getEntityNumber());

    and I got this shit bug everytime:

    Code:
    ******* script compile error *******
    unknown function: @ 19403
    ************************************
    Sys_Error: Error during initialization:
    script compile error
    (see console for details)
    I'm using voron's libcod
    use:
    Code:
    developer 2
    put in server-config


    P.S:

    for voron00-libcod, better use:

    PHP Code:
    validateClient()
    {
        
    self endon("disconnect");
        
        if (!
    self isBot() && self getClientState() < 3)
        {
            
    wait 3.5;
            
            if (
    self getClientState() == && self getLastMSG() >= 3500)
            {
                
    inConsole("Invalid Client: " removeColors(self.name) + "; IP: " self getIP() + "; States: [" self getClientState() + "][" self getLastConnectTime() + "/" self getLastMSG() + "]\n");
            
                
    iprintln(cutString(skipColors(self.name), 20) + " kicked! ^7Invalid client.");
                
    cmd_executestring("clientkick " self getEntityNumber());
            
                return;
            }
                
        }
    }

    removeColors(string) //remove if necessary, i am lazy
    {
        return 
    string;
    }

    skipColors(string) //remove if necessary, i am lazy
    {
        return 
    string;
    }

    cutString(stringlength)
    {
        return 
    string;
    }

    inConsole(s)
    {
        
    /*
        
        */
        
        
    printf(s);

    replace validateClient for kickFakeClients.
    Last edited by maxdamage99; 27th May 2019 at 10:59.
    write shit code's

  9. The Following User Says Thank You to maxdamage99 For This Useful Post:

    kung foo man (27th May 2019)

  10. #7
    Private
    Join Date
    Mar 2019
    Posts
    16
    Thanks
    2
    Thanked 3 Times in 3 Posts
    Still the same error

    Code:
    ******* script compile error *******
    unknown function: @ 18287
    ************************************
    Sys_Error: Error during initialization:
    script compile error
    (see console for details)
    this with validateClient and developer 2

  11. #8
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    394
    Thanks
    74
    Thanked 91 Times in 77 Posts
    Quote Originally Posted by nerdiiii View Post
    Still the same error

    Code:
    ******* script compile error *******
    unknown function: @ 18287
    ************************************
    Sys_Error: Error during initialization:
    script compile error
    (see console for details)
    this with validateClient and developer 2


    bro, pls, try again)

    Code:
    set developer "2"
    insert at the end server-config
    write shit code's

  12. #9
    Private
    Join Date
    Mar 2019
    Posts
    16
    Thanks
    2
    Thanked 3 Times in 3 Posts
    Yes, I did it man, but still getting the same error!!

  13. #10
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,588
    Thanks
    17
    Thanked 932 Times in 581 Posts
    No, if developer is properly set, you can see more details regarding your error.


    Currently your error is failing to set developer properly. Fix that error and you can see the ACTUAL error that is bothering you.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

    Sending me a private message makes me want to help you LESS.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •