HELP ME

Bowl of Water

Meditating
=(eGO)=
Joined
Apr 12, 2019
Messages
357
it isnt pushing them enough

CSS:
function Push() {
    local playerperson = getplayerbyplayer(activator)

    local power = playerperson.push

    local playert = activator.entindex()

    local guy = ToExtendedPlayer( VS.GetPlayerByIndex(playert) );

    local forwardVector = guy.EyeForward()

    local scope = caller.GetScriptScope()
    local front = activator.EyePosition() + (Vector(guy.EyeForward().x, guy.EyeForward().y, 0) * 64) //supposed to be a vector 64 units in front of the player
    local frontb = activator.EyePosition() + (Vector(guy.EyeForward().x, guy.EyeForward().y, 0) * 32) //supposed to be a vector 64 units in front of the player

    local closestplayer = null;
    if (playerperson.push == false) {
        local allplayers = VS.GetAllPlayers()
        foreach (index, player in allplayers) {
            if (player == activator) {
                continue;
            }
            local curPlayerdist = (player.GetOrigin() - frontb).Length2D()
            if (curPlayerdist < 20) {
                if (!closestplayer) {
                    closestplayer = player
                }
                if ((closestplayer.GetOrigin() - frontb).Length2D() > curPlayerdist) {
                    closestplayer = player
                }
            }
        }
    }

    if (playerperson.push == false){
        if (closestplayer) {
            playerperson.push = true;
            local pushhard = (Vector(guy.EyeForward().x, guy.EyeForward().y, 0) * 1000)
            pushhard.z = 128;
            //printl(pushhard)
            closestplayer.SetVelocity(pushhard)

            PlaySound(activator.GetOrigin(), "physics/body/body_impact_self_06.wav", "2000");

        }
    }
    else if (playerperson.push == true){
        local script = Entities.FindByName(null, "script_chair")
        if (script) {
            if (playerperson.spam == false) {
            EntFireByHandle(script, "RunScriptCode", "ResetPush()", 6, activator, null)
            }
            playerperson.spam = true;
        }
    }
}
 
local pushhard = (Vector(guy.EyeForward().x, guy.EyeForward().y, 0) * 1000) pushhard.z = 128; //printl(pushhard) closestplayer.SetVelocity(pushhard)
im guessing here is where you set the push force, maybe attempt to multiply by a bigger number or directly in axis X and Y like Vector(guy.EyeForward().x*1000,guy.EyeForward().y*1000,0).

maybe too there is a limit of the amount of pixels a player can move in x an y axis in a frame, i think the slap command may have a multiplier and you can test with that amount and upping it.

Again i may be wrong as i am using logic and don't know hammer.
 
Back
Top