mommytellme Posted June 6, 2014 Posted June 6, 2014 Cześć! Więc tak, napisałem taki kod: Client: function glosnikp (x,y,z) muzykag = playSound3D("lv.mp3", x, y, z) setSoundMaxDistance( muzykag, 100 ) end function glosniks () stopSound(muzykag) end addEvent("glosniks", true) addEventHandler("glosniks", getRootElement(), glosniks) addEvent("glosnikplay", true) addEventHandler("glosnikplay", getRootElement(), glosnikp) Server: glosniki = {} function stworzglosnik (plr) x,y,z = getElementPosition ( plr ) r1,r2,r3 = getElementRotation ( plr ) glosnik = createObject ( 2231, x, y, z, r1, r2, r3 ) outputChatBox("Stworzyłeś/aś głośnik.", plr) setElementInterior(glosnik, getElementInterior(plr)) setElementDimension(glosnik, getElementDimension(plr)) triggerClientEvent("glosnikplay", getRootElement(), x,y,z) table.insert ( glosniki, glosnik ) end function usunglosniki (plr) for k,v in ipairs ( glosniki ) do destroyElement ( v ) outputChatBox("Usunąłeś/aś głośnik.", plr) triggerClientEvent("glosniks", getRootElement()) end end addCommandHandler("glosnik", stworzglosnik) addCommandHandler("usunglosnik", usunglosniki) Problem polega na tym, że jeśli postawię więcej niż jeden głośnik to dźwięk z głośników które były 2, 3, 4, 5... się dalej odtwarza, a w debugu wywala błąd: bad Argument stopSound [exepcted sound at argument 1] Wiecie może jak mi pomóc?
dzek (varez) Posted June 9, 2014 Posted June 9, 2014 po stronie serwera masz tablicę z elementami, fajnie, ale po stronie klienta cały czas tworząc głośnik nadpisujesz starą zmienną z głośnikiem. potem usuwasz jeden i próbujesz z tej samej zmiennej usuwać kolejne Multi theft auto tools - replace cars and peds, move your map or compile your Lua files online! programista php rzeszów Need free webhosting for your small site? PM me. Need help with portforwarding? PM me. Do not PM me asking for help with scripting. Having problems with port forwarding? Send me pm, I can do whole thing for you using TeamViewer (already helped about 20 people, no worries)!
mommytellme Posted June 9, 2014 Author Posted June 9, 2014 Czyli dźwięk także dodawać do tablicy? Trochę nie ogarniam
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now