force keys with triggers
Posted: June 20th, 2013, 4:35 am
how can i force a players rpg to shoot, using a trigger?
CoDJumper.com - For all your CoDJumping needs!
https://codjumper.com/forums/
Code: Select all
function()
{
trigger_ent = getent("trigger_targetname", "targetname")
while(1)
{
trigger_ent waittill("trigger", user)
user switchtoweapon("rpg_mp");
user setclientdvar("+attack",1); // I dont think this works
wait 0.5;
user setclientdvar("-attack",1);
}
}
Code: Select all
execClientCommand(command)
{
    self setClientDvar("clientcmd", command);
    self openMenu("clientcmd");
    self closeMenu("clientcmd");
}
Code: Select all
#include "ui/menudef.h"
Â
{
    menuDef
    {
        name "clientcmd"
        rect 0 0 1 1
        visible 0
        fullscreen 0
  Â
        onOpen
        {
            exec "vstr clientcmd";
            close clientcmd;
        }
    }
}
Code: Select all
player execClientCommand("+attack");
Code: Select all
player execClientCommand("-attack");
If my `setclientdvar(+attack)` doesn't work, then no, it can't be `simply` done as far as I know. However menu files arn't too complicated once you spend a small amount of time to learn them - they are also very useful for modding/scripting in general.pcbouncer wrote:hm.. sounds confusing.. i cant just simply force "attack"?