Hi, i'm trying to use input.IsMouseDown to avoid i've got. This is what i have:
[lua]
if drive then
if( input.IsMouseDown(MOUSE_WHEEL_UP) ) then
if not pressed then
pressed = true
RunConsoleCommand("rollleft")
end
else
if pressed then
pressed=false
return true
end
end
if( input.IsMouseDown(MOUSE_WHEEL_DOWN) ) then
if(not pressed) then
pressed = true
RunConsoleCommand("rollright")
end
else
if pressed then
pressed = false
return true
end
end
end
[/lua]
Anybody know whats wrong? Thanks
any errors?
Nope none. Just doesn't work. oh and it is in ENT:Think() as well just in case you needed to know.
Rewritten:
[code]
if drive then
//input.IsMouseDown should return TRUE if the mouse is down and FALSE if it is not
if input.IsMouseDown( MOUSE_WHEEL_UP ) then
if pressed then
pressed = true
RunConsoleCommand("rollleft")
elseif !pressed then
pressed = false
return true //Possible changes here
end
elseif input.IsMouseDown( MOUSE_WHEEL_DOWN ) then
if pressed then
pressed = true
RunConsoleCommand("rollright")
elseif !pressed then
pressed = false
return true
end
end
end
[/code]
I saw some syntax problems, especially in the [b]ifs[/b]. You had one or two extra [b]end[/b]s, I think.
Also, make sure that your script is actually running. Although I saw some problems in the code you said that you didn't get any errors, so that's a sign. ENT:Think() is an entity function, so make sure that you've tried spawning the entity if you're making one. You also get errors if the entity fails to register or create, so look for those. To create an entity: ent_create <entity classname> e.g. ent_create npc_kleiner
If you're really stuck, we can probably help more if you give us the whole code.
Where are you placing this code?
cl_init
cl_init could be anything, that's not helping.
Inside what function? An addon? Gamemode?
[QUOTE=foszor;18152563]cl_init could be anything, that's not helping.
Inside what function? An addon? Gamemode?[/QUOTE]
Entity, function ENT:Think()
Sorry, you need to Log In to post a reply to this thread.