Citrus Posted September 24, 2018 Share Posted September 24, 2018 Tengo esto en comando pero quisiera pasarlo a binkey, alguien me da una manito?. function openVIPpanel(thePlayer) account = getPlayerAccount(thePlayer) if isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("VIP")) then triggerClientEvent (thePlayer, "openVIPWindow", thePlayer) else outputChatBox("¡No eres usuario V.I.P!.",thePlayer,255,0,0) end end addCommandHandler ( "vip", openVIPpanel) --bindKey("F6","up",openVIPpanel) -- intente reemplazar addCommandHandler por esta linea pero me tira error, asi que no tengo mas ideas :C Esta función esta en server.lua Link to comment
TRtam Posted September 24, 2018 Share Posted September 24, 2018 (edited) This is not the section to post your scripting questions, next time post it in https://forum.multitheftauto.com/forum/167-scripting/ About your code, this should work: function openVIPpanel(thePlayer) account = getPlayerAccount(thePlayer) if isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("VIP")) then triggerClientEvent (thePlayer, "openVIPWindow", thePlayer) else outputChatBox("¡No eres usuario V.I.P!.",thePlayer,255,0,0) end end function resourceStart ( ) for k, v in pairs ( getElementsByType ( "player" ) ) do bindKey ( v, "F6", "down", openVIPpanel ); end end addEventHandler ( "onResourceStart", resourceRoot, resourceStart ) function playerJoin ( ) bindKey ( source, "F6", "down", openVIPpanel ); end addEventHandler ( "onPlayerJoin", root, playerJoin ) Edited September 24, 2018 by TRtam Link to comment
Citrus Posted September 24, 2018 Author Share Posted September 24, 2018 (edited) 38 minutes ago, TRtam said: This is not the section to post your scripting questions, next time post it in https://forum.multitheftauto.com/forum/167-scripting/ About your code, this should work: function openVIPpanel(thePlayer) account = getPlayerAccount(thePlayer) if isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("VIP")) then triggerClientEvent (thePlayer, "openVIPWindow", thePlayer) else outputChatBox("¡No eres usuario V.I.P!.",thePlayer,255,0,0) end end function resourceStart ( ) for k, v in pairs ( getElementsByType ( "player" ) ) do bindKey ( v, "F6", "down", openVIPpanel ); end end addEventHandler ( "onResourceStart", resourceRoot, resourceStart ) function playerJoin ( ) bindKey ( source, "F6", "down", openVIPpanel ); end addEventHandler ( "onPlayerJoin", root, playerJoin ) OH NICE!!!!!!!!!!!!!!!!!!!!!!!!!!! Edited September 24, 2018 by Citrus Link to comment
Citrus Posted September 24, 2018 Author Share Posted September 24, 2018 to sound a sound should I add this? function openVIPpanel(thePlayer) account = getPlayerAccount(thePlayer) if isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("VIP")) then triggerClientEvent (thePlayer, "openVIPWindow", thePlayer) else outputChatBox("¡No eres usuario V.I.P!.",thePlayer,255,0,0) local denegar = playSound("denegar.mp3") -- HERE? setSoundVolume(denegar, 0.3) -- HERE? end end function resourceStart ( ) for k, v in pairs ( getElementsByType ( "player" ) ) do bindKey ( v, "F6", "down", openVIPpanel ); end end addEventHandler ( "onResourceStart", resourceRoot, resourceStart ) function playerJoin ( ) bindKey ( source, "F6", "down", openVIPpanel ); end addEventHandler ( "onPlayerJoin", root, playerJoin ) Link to comment
Dimos7 Posted September 24, 2018 Share Posted September 24, 2018 No that is client side Link to comment
iMr.WiFi..! Posted September 25, 2018 Share Posted September 25, 2018 15 hours ago, Citrus said: to sound a sound should I add this? function openVIPpanel(thePlayer) account = getPlayerAccount(thePlayer) if isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("VIP")) then triggerClientEvent (thePlayer, "openVIPWindow", thePlayer) else outputChatBox("¡No eres usuario V.I.P!.",thePlayer,255,0,0) local denegar = playSound("denegar.mp3") -- HERE? setSoundVolume(denegar, 0.3) -- HERE? end end function resourceStart ( ) for k, v in pairs ( getElementsByType ( "player" ) ) do bindKey ( v, "F6", "down", openVIPpanel ); end end addEventHandler ( "onResourceStart", resourceRoot, resourceStart ) function playerJoin ( ) bindKey ( source, "F6", "down", openVIPpanel ); end addEventHandler ( "onPlayerJoin", root, playerJoin ) Delete lines 9, 10 and instead write a "triggerClientEvent" And make "addEvent" in client side and put the "playSound" in EventHandler. Link to comment
Citrus Posted September 26, 2018 Author Share Posted September 26, 2018 On 25/09/2018 at 08:23, iMr.WiFi..! said: Delete lines 9, 10 and instead write a "triggerClientEvent" And make "addEvent" in client side and put the "playSound" in EventHandler. This is the client.lua But the sound does not work --------------------------- function openVIPWindow() guiSetVisible(vipWind, not guiGetVisible(vipWind)) if not guiGetVisible(vipWind) then showCursor(false) local cerrar = playSound("sonidos/cerrar.mp3") setSoundVolume(cerrar, 0.3) else showCursor(true) local abrir = playSound("sonidos/abrir.mp3") setSoundVolume(abrir, 0.3) --------------------------- triggerEvent("displayClientInfo", openVIPWindow(), "thePlayer", openVIPWindow, "¡No eres usuario V.I.P!.", 0, 255, 0) playSound("sonidos/denegar.mp3") end end addEvent("openVIPWindow", true) addEventHandler("openVIPWindow", getRootElement(), openVIPWindow) Link to comment
TRtam Posted September 26, 2018 Share Posted September 26, 2018 Make sure that you added "sonidos/cerrar.mp3" and "sonidos/abrir.mp3" into meta.xml Link to comment
Citrus Posted September 26, 2018 Author Share Posted September 26, 2018 45 minutes ago, TRtam said: Make sure that you added "sonidos/cerrar.mp3" and "sonidos/abrir.mp3" into meta.xml triggerEvent("displayClientInfo", openVIPWindow(), "thePlayer", openVIPWindow, "¡No eres usuario V.I.P!.", 0, 255, 0) playSound("sonidos/denegar.mp3") It does not work when you're not VIP. Does not emit sound The others work well when opening and closing the vip panel emits a sound. Link to comment
TRtam Posted September 26, 2018 Share Posted September 26, 2018 Replace your old openVIPpanel function with this: function openVIPpanel(thePlayer) account = getPlayerAccount(thePlayer) if isObjectInACLGroup("user."..getAccountName(account), aclGetGroup("VIP")) then triggerClientEvent (thePlayer, "openVIPWindow", thePlayer) else outputChatBox("¡No eres usuario V.I.P!.",thePlayer,255,0,0) triggerClientEvent ( thePlayer, "denegarSound", root ) end end Put this somewhere in client-side: function denegarSound ( ) playSound ( "denegar.mp3" ); end addEvent ( "denegarSound", true ) addEventHandler ( "denegarSound", root, denegarSound ) Link to comment
Citrus Posted September 27, 2018 Author Share Posted September 27, 2018 Oh nice, thank you..... I have a problem that when I start the server and write debugscript 3 I get the following error: ERROR: Server triggered clientside event onPlayerDoneLogin , but event is not added clientside... It does not show me the error route, solution? Link to comment
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