Jump to content

addcommandhandler[darkdragon look inside:P


kevin11

Recommended Posts

Posted (edited)

idk what to tell :S i dont know what function to use can anyone send me wiki page or tell me what function

function onSoundEvent ( )()
local sound = playSound("music.mp3",false) 
end
 
addCommandHandler("startc", onSoundEvent)

Edited by Guest
Posted

is this a client side file? did you add the file in the meta.xml?

by the way you broke your script even further

function onSoundEvent ()
local sound = playSound("music.mp3",false) 
end
 
addCommandHandler("startc", onSoundEvent)

Posted
is this a client side file? did you add the file in the meta.xml?

yes its client

<meta>
<info type="script" version="1.0.0" />
<script src="music.lua" type="client"/>
<file src="music.mp3" />
meta>

Posted

remember what i told you about debugging? try this

function onSoundEvent ()
outputDebugString("command used")
local sound = playSound("music.mp3",false)
outputDebugString(tostring(sound))
end
 
addCommandHandler("startc", onSoundEvent)

Posted
dark u still onine?? my guests cant hear to music :roll: maybe a bug inside script

It's only heard by player who typed in the command. They can hear it when they type that command.

Posted
dark u still onine?? my guests cant hear to music :roll: maybe a bug inside script

It's only heard by player who typed in the command. They can hear it when they type that command.

is it possible to that if i type it everyone hears it? :roll:

Posted

Yes. But frankly, you're too clueless about even basic syntax - you should read some more about Lua before you try anything.

Once you've gotten the basic Lua down, you can accomplish this by creating a client-side event and triggering it for everybody when the command is entered.

Posted

Yes.

You need to triggerServerEvent which will then triggerClientEvent to everyone.

Posted
Yes. But frankly, you're too clueless about even basic syntax - you should read some more about Lua before you try anything.

Once you've gotten the basic Lua down, you can accomplish this by creating a client-side event and triggering it for everybody when the command is entered.

this is client side... u mean trigger server side?

i am learning scripting a little more everyday (very little) but i cant do this because i thought it would play for everyone

can someone post solution? or how to make one?

Posted
Yes.

You need to triggerServerEvent which will then triggerClientEvent to everyone.

in this case adding the command handler server side would probably be the more efficient way

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...