Jump to content

How can i do this?


mcer

Recommended Posts

When someone changes his weapon, I want to start a function, and that over a period of time this function have to finish.

I tried with this "onClientPlayerWeaponSwitch" but when I tried to use it, the function only has ended in a period of less than 1 second.

Can anyone help me?.

Link to comment

I guess that's the only function you can use, you can also try to trigger an event when the weapon switch event is triggered, like:

function WeaponSwitch() 
     triggerEvent("Weapon.WepFunction", source) 
end 
addEventHandler("onClientPlayerWeaponSwitch", root, WeaponSwitch) 
  
function WepFunction() 
     outputChatBox("Weapon Switched") 
end 
addEvent("Weapon.WepFunction", true) 
addEventHandler("Weapon.WepFunction", root, WepFunction) 

Edited by Guest
Link to comment
Then you have to make a timer, set its interval to your choice of time and make it run once. If the timer is already pending then cancel the function. Otherwise pass the function to client-side and trigger some renderer to draw DirectX.

Can you make an example?.

I used "setTimer" before making this post. :roll:

Link to comment

What I would like to make is something like when you change the radio station.

A text appears for a few seconds.

But, what would appear in this case would be a set of DXimages and DXText for (example);

5 seconds and after that it disappears.

Link to comment
Well what if you use a timer and set the execution time to the number you want to execute it and create an other timer whick kills the first timer?
setTimer 
killTimer 

When i use the setTimer, It only appear when you scroll the mouse and disappear in less than a second.

Link to comment
Well what if you use a timer and set the execution time to the number you want to execute it and create an other timer whick kills the first timer?
setTimer 
killTimer 

When i use the setTimer, It only appear when you scroll the mouse and disappear in less than a second.

Did you trigger the event? Or just set a timer on the

'onClientPlayerWeaponSwitch' 

Link to comment
Well what if you use a timer and set the execution time to the number you want to execute it and create an other timer whick kills the first timer?
setTimer 
killTimer 

When i use the setTimer, It only appear when you scroll the mouse and disappear in less than a second.

Did you trigger the event? Or just set a timer on the

'onClientPlayerWeaponSwitch' 

Yes, I did.

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...