why "unpacking" doesnt work

  • CaveJohnson wrote:

    idk one idea I had was if we ignored a call to sm_vmenuselect if that player had used the command within the last 0.1 seconds or something.

    I've got another menu idea that I'm gonna play around with as I develop the next-gen rp plugin.
    I don't think you can ignore the call since no matter what you return within a command listener that's hooked to vmenuselect the command will always go through, however it is possible to trigger a warning to admins or log the event etc. which is what I'm trying to do right now, every time a menu select is less than 0.1 seconds before the last one it'll trigger a warning to admins and log it in a db to be used somewhere else.
  • The Doggy wrote:

    CaveJohnson wrote:

    idk one idea I had was if we ignored a call to sm_vmenuselect if that player had used the command within the last 0.1 seconds or something.

    I've got another menu idea that I'm gonna play around with as I develop the next-gen rp plugin.
    I don't think you can ignore the call since no matter what you return within a command listener that's hooked to vmenuselect the command will always go through, however it is possible to trigger a warning to admins or log the event etc. which is what I'm trying to do right now, every time a menu select is less than 0.1 seconds before the last one it'll trigger a warning to admins and log it in a db to be used somewhere else.

    Have an array of booleans, one boolean for each player basically.
    If g_bBindFlags[client] == true then return Plugin_Handled and don't do anything else.
    On sm_vmenuselect set g_bBindFlags[client] = true then create a 0.2 seconds timer that fires to set that flag back to false in 0.2 seconds.

    This way any sm_vmenuselect commands caught before that timer triggers itself in 0.2 seconds will be ignored. Super ez.
    Only create the timer if g_bBindFlags[client] is false. Don't do anything at all if it's true. Literally:

    if(g_bBindFlags[client]) {
    return Plugin_Handled;
    }

    g_bBindFlags[client] = true;
    CreateTimer(0.2, SetBindFlagsFalse, client); //I'm a bit rusty but I think these are the params for CreateTimer
    //everything else in the method happens here


    And then your timer code:
    SetBindFlagsFalse(Handle timer, int client) {
    g_bBindFlags[client] = false;
    }

    My SM is a tad rusty so I might not have perfect code examples, but that is the gist of it.
  • Users Online 1

    1 Guest