Jump to content

ALGUIEN ME DICE COMO PASAR ESTO A BINKEY?


Citrus

Recommended Posts

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

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 by TRtam
Link to comment
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 by Citrus
Link to comment
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
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
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
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

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

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

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