Jump to content

Wrong bindkey


//_Dragon

Recommended Posts

I want add bindkey F4 in this panel , when i press F4 it's opened when i press F4 again it's closed

The problem is when i press F4 again can't close

addEventHandler("onResourceStart",resourceRoot, 
function(resource) 
local players = getElementsByType("player") 
for i,player in ipairs(players) do 
bindKey(player,"F4","down",showGui) 
end 
end) 
  
addEventHandler("onPlayerJoin",root, 
function() 
bindKey(source,"F4","down",showGui) 
end) 

Link to comment

+ i have bug too about outputchatbox to player is in outputChatBox ("• Please use freeroam panel to buy items", source, 255, 0, 0, true)

When player press F4 he get this mesg but sometimes with out opening Panel i see this message spamm in chatbox :3 i want make it only for who press F4

addEvent ("viewGUI", true) 
function showGui (hitPlayer, matchingDimension) 
    triggerClientEvent ("viewGUI", hitPlayer) 
outputChatBox ("• Please use freeroam panel to buy items", source, 255, 0, 0, true) 
end 
addCommandHandler("shop",showGui) 
  
addEvent ("weapBuy", true) 
addEventHandler ("weapBuy", getRootElement(),  
function(id, cost, name, ammo) 
  if (getPlayerMoney (source) >= tonumber(cost)) then 
    outputChatBox ("#006400You Bought A : #FFFFFF" .. name, source, 255, 255, 255, true) 
    outputChatBox ("#006400ID: #FFFFFF" .. id, source, 255, 255, 255, true) 
    outputChatBox ("#006400Costs #FFFFFF" .. cost, source, 255, 255, 255, true) 
    takePlayerMoney (source, tonumber (cost)) 
    giveWeapon(source, tonumber(id),1000) 
  else 
    outputChatBox ("#FF0000• You dont have enought money", source, 255, 255, 255, true) 
  end 
end) 
  
addEvent ("carBuy", true) 
addEventHandler ("carBuy", getRootElement(),  
function(id2, cost2, name2,x, y, z, sRz) 
  if (getPlayerMoney (source) >= tonumber(cost2)) then 
    outputChatBox ("#006400You Bought A : #FFFFFF" .. name2, source, 255, 255, 255, true) 
    outputChatBox ("#006400ID: #FFFFFF" .. id2, source, 255, 255, 255, true) 
    outputChatBox ("#006400Costs: #FFFFFF" .. cost2, source, 255, 0, 0, true) 
    takePlayerMoney (source, tonumber (cost2)) 
    local x,y,z = getElementPosition (source) 
    local vehicle = createVehicle (id2, x, y, z, 0, 0, sRz ) 
    warpPedIntoVehicle(source, vehicle) 
  else 
    outputChatBox ("#FF0000• You dont have enought money", source, 255, 255, 255, true) 
  end 
end) 
function vExplode () 
        toggleVehicleRespawn ( source, false ) 
        setTimer(destroyElement, 5000, 1, source) 
end 
addEventHandler ( "onVehicleExplode", getResourceRootElement(getThisResource()), vExplode ) 
function skillButton (id, cost) 
  if (id == "0") then 
    skillBuyPlayer (250,source,69) 
    elseif (id == "1") then 
    skillBuyPlayer (50000,source,70) 
    elseif (id == "2") then 
    skillBuyPlayer (50000,source,71) 
    elseif (id == "3") then 
    skillBuyPlayer (50000,source,72) 
    elseif (id == "4") then 
    skillBuyPlayer (50000,source,73) 
    elseif (id == "5") then 
    skillBuyPlayer (50000,source,74) 
    elseif (id == "6") then 
    skillBuyPlayer (50000,source,75) 
    elseif (id == "7") then 
    skillBuyPlayer (50000,source,76) 
    elseif (id == "8") then 
    skillBuyPlayer (50000,source,77)     
    elseif (id == "9") then 
    skillBuyPlayer (50000,source,78) 
    elseif (id == "10") then 
    skillBuyPlayer (50000,source,79) 
elseif (id == "11") then 
    skillBuyPlayer (50000,source,24) 
    elseif (id == "12") then 
    skillBuyPlayer (50000,source,23) 
    elseif (id == "13") then 
    skillBuyPlayer (50000,source,21) 
  end 
end 
addEvent ("skillBuy", true) 
addEventHandler ("skillBuy", getRootElement(),skillButton) 
  
function skillBuyPlayer (cash,player,id) 
    if (getPlayerMoney (player) >= cash) then 
      takePlayerMoney (player,cash) 
      setPedStat(player, id, 1000) 
     else 
    outputChatBox ("#FF0000• You dont have enought money", source, 255, 255, 255, true) 
  end 
end 
addEventHandler("onResourceStart",resourceRoot, 
function(resource) 
local players = getElementsByType("player") 
for i,player in ipairs(players) do 
bindKey(player,"F4","down",showGui) 
end 
end) 
  
addEventHandler("onPlayerJoin",root, 
function() 
bindKey(source,"F4","down",showGui) 
end) 

Link to comment

Oh, please stop. This its not your script. You cant make a simple bind. You kids will never learn. And in your shet-roam nothing made by you. Only forum helps and getting resources for giving admin. I can prove it. Btw stop sending people in my server to advertise. Remember i have logs. 'Everybody come to shet-roam, oussez said who will advertise on blueroam will be vip'

Link to comment

Dont help this guy in stolen scripts... Oh, please stop. This its not your script. You cant make a simple bind. You kids will never learn. And in your shet-roam nothing made by you. Only forum helps and getting resources for giving admin. I can prove it. Btw stop sending people in my server to advertise. Remember i have logs. 'Everybody come to shet-roam, oussez said who will advertise on blueroam will be vip'

Link to comment

So you're trying to imply that you're not using resources uploaded to the community, Blue? If that is the case, you're being quite the hypocrite. He's using the forum because we're here to help, if you don't like that other people receive help, don't linger around here then. We choose whom to help - not you.

Oussez, I would recommend you bind the key client-side instead of server-side. Simply use the event onClientResourceStart and it will bind the key once the resource has finished downloading. Seeing as how you're not using any ACL permission checks, I see absolutely no reason to have the key bound via the server and also output the message via the server when you could simply do it client-side.

Link to comment
I'm saying this because he stoles my resources and ideas and editing them to look like he made them. Thats what i mean.

Why you're liar ? hein ? tell me what i steal from ? tell me ?

U clone Server groam |& iwant make my server better like any anyone

Why you can't leave me alone ? did i do like that when u need help ? go & check ur forum it's full fixing a stolen mods from groam

Link to comment
So you're trying to imply that you're not using resources uploaded to the community, Blue? If that is the case, you're being quite the hypocrite. He's using the forum because we're here to help, if you don't like that other people receive help, don't linger around here then. We choose whom to help - not you.

Oussez, I would recommend you bind the key client-side instead of server-side. Simply use the event onClientResourceStart and it will bind the key once the resource has finished downloading. Seeing as how you're not using any ACL permission checks, I see absolutely no reason to have the key bound via the server and also output the message via the server when you could simply do it client-side.

u mean poste the code in client-side :/ ?

Link to comment

You have all of this;

addEventHandler("onResourceStart",resourceRoot, 
function(resource) 
local players = getElementsByType("player") 
for i,player in ipairs(players) do 
bindKey(player,"F4","down",showGui) 
end 
end) 
  
addEventHandler("onPlayerJoin",root, 
function() 
bindKey(source,"F4","down",showGui) 
end) 
  
addEvent ("viewGUI", true) 
function showGui (hitPlayer, matchingDimension) 
    triggerClientEvent ("viewGUI", hitPlayer) 
outputChatBox ("• Please use freeroam panel to buy items", source, 255, 0, 0, true) 
end 
addCommandHandler("shop",showGui) 

Which is absolutely unnecessary. Instead, you can simply do this on the client;

function ShowGUI() 
    -- Make GUI visible here 
    outputChatBox ("• Please use freeroam panel to buy items", 255, 0, 0, true) 
end 
bindKey("F4", "down", ShowGUI) 
addCommandHandler("shop", ShowGUI) 

Ofc. Help panel for example? Why it has romanian? Ha? Cuz i made it im from romania.

You're the only one in the entire world that's from Romania? So everything in Romanian is clearly stolen from you...? If you think he's stolen resources from you, I suggest you read this thread.

If you want to throw words at eachother, do it via PM instead of on here please :roll:

Link to comment

Wont work :/

i remove codes from server-side

& i put what u tell me in client-side

But when i open panel doesnt work

function ShowGUI() 
    outputChatBox ("• Please use freeroam panel to buy items", 255, 0, 0, true) 
end 
bindKey("F4", "down", ShowGUI) 
addCommandHandler("shop", ShowGUI) 

Link to comment

it's close & open at same time when i press bindkey

function ShowGUI() 
    local state = ( not guiGetVisible ( shopWindow ) ) 
        guiSetVisible ( shopWindow, state ) 
        showCursor ( state ) 
    outputChatBox ("• Please use freeroam panel to buy items", 255, 0, 0, true) 
end 
bindKey("F4", "down", ShowGUI) 
addCommandHandler("shop", ShowGUI) 

Link to comment
it's close & open at same time when i press bindkey
function ShowGUI() 
    local state = ( not guiGetVisible ( shopWindow ) ) 
        guiSetVisible ( shopWindow, state ) 
        showCursor ( state ) 
    outputChatBox ("• Please use freeroam panel to buy items", 255, 0, 0, true) 
end 
bindKey("F4", "down", ShowGUI) 
addCommandHandler("shop", ShowGUI) 

Your code seems correct, therefore it shouldn't change visibility twice per button press. Maybe you had accidentally bound it twice, or used "both" instead of "down"?

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