Jump to content

Recommended Posts

-- #Client-side 
addEventHandler("onClientGUIClick",resourceRoot,function () 
if (source == Button_Name) then 
triggerServerEvent ( "onPlayerClick",localPlayer) 
end 
end) 
-- #Server-Side 
addEvent( "onPlayerClick", true ) 
addEventHandler( "onPlayerClick",resourceRoot,function () 
if (getPlayerMoney(source) > 100) then 
setPedArmor(source,50) 
takePlayerMoney(source,100) 
else 
outputChatBox ("you poor",source,150,0,0) 
end 
end) 
Link to comment
-- #Client-side 
addEventHandler("onClientGUIClick",resourceRoot,function () 
if (source == Button_Name) then 
triggerServerEvent ( "onPlayerClick",localPlayer) 
end 
end) 
-- #Server-Side 
addEvent( "onPlayerClick", true ) 
addEventHandler( "onPlayerClick",resourceRoot,function () 
if (getPlayerMoney(source) > 100) then 
setPedArmor(source,50) 
takePlayerMoney(source,100) 
else 
outputChatBox ("you poor",source,150,0,0) 
end 
end) 

well, not working...

Link to comment
--Client-side 
 Button1 = guiCreateButton( 0.7, 0.3, 0.2, 0.1, "Outp11ut!", true )     
function wuy() 
  showCursor(true) 
end 
addCommandHandler("y",wuy) 
addEventHandler("onClientGUIClick",resourceRoot,function () 
if (source == Button1) then 
triggerServerEvent ( "onPlayerClick",localPlayer) 
end 
end) 

Server-Side

addEvent( "onPlayerClick", true ) 
addEventHandler( "onPlayerClick",resourceRoot,function () 
if (getPlayerMoney(source) > 100) then 
setPedArmor(source,50) 
takePlayerMoney(source,100) 
else 
outputChatBox ("you poor",source,150,0,0) 
end 
end) 
 triggerClientEvent ( "onClientGUIClick", root) 
  

Link to comment
  
addEvent( "onPlayerClick", true ) 
addEventHandler( "onPlayerClick",root,function () 
if (getPlayerMoney(source) > 100) then 
setPedArmor(source,50) 
takePlayerMoney(source,100) 
else 
outputChatBox ("you poor",source,150,0,0) 
end 
end) 
  
  

Link to comment

I don't know what you exactly want but i made this..

server-side:

  
function getArmor () 
    local armor = getPlayerArmor(source) 
    local money = getPlayerMoney(source) 
    if money >= 100 and armor < 100 then 
       setPedArmor(source,armor+50) 
       takePlayerMoney(source, 100) 
    elseif money >= 100 and armor >= 100 then 
       outputChatBox("Already full armor", source, 255, 0, 0) 
    elseif money < 100 then 
       outputChatBox("Not enough money", source, 255, 0, 0) 
    end 
end 
addEvent("onarmorb", true) 
addEventHandler("onarmorb", root, getArmor) 
  

client-side:

  
  
  
mywindow = guiCreateWindow(564, 440, 169, 111, "", false) 
guiWindowSetSizable(mywindow, false) 
  
armorB = guiCreateButton(19, 26, 130, 42, "Armor", false, mywindow) 
closeB = guiCreateButton(42, 74, 86, 27, "Close", false, mywindow) 
guiSetVisible(mywindow, false) 
  
addCommandHandler("y", 
function ()  
if guiGetVisible(mywindow) == false then 
guiSetVisible(mywindow, true) 
showCursor(true)      
end    
end 
)    
  
addEventHandler("onClientGUIClick", closeB, 
function() 
guiSetVisible(mywindow,false) 
showCursor(false) 
end,false)     
        
addEventHandler("onClientGUIClick", armorB, 
function() 
triggerServerEvent("onarmorb", getLocalPlayer()) 
end,false)            
  

Use command /y

Edited by Guest
Link to comment
I don't know what you exactly want but i made this..

server-side:

  
function getArmor () 
    local armor = getPlayerArmor(source) 
    local money = getPlayerMoney(source) 
    if money >= 100 and armor < 100 then 
       setPedArmor(source,armor+50) 
       takePlayerMoney(source, 100) 
    elseif money >= 100 and armor >= 100 then 
       outputChatBox("Already full armor", thePlayer, 255, 0, 0) 
    elseif money < 100 then 
       outputChatBox("Not enough money", thePlayer, 255, 0, 0) 
    end 
end 
addEvent("onarmorb", true) 
addEventHandler("onarmorb", root, getArmor) 
  

client-side:

  
  
  
mywindow = guiCreateWindow(564, 440, 169, 111, "", false) 
guiWindowSetSizable(mywindow, false) 
  
armorB = guiCreateButton(19, 26, 130, 42, "Armor", false, mywindow) 
closeB = guiCreateButton(42, 74, 86, 27, "Close", false, mywindow) 
guiSetVisible(mywindow, false) 
  
addCommandHandler("y", 
function ()  
if guiGetVisible(mywindow) == false then 
guiSetVisible(mywindow, true) 
showCursor(true)      
end    
end 
)    
  
addEventHandler("onClientGUIClick", closeB, 
function() 
guiSetVisible(mywindow,false) 
showCursor(false) 
end)     
        
addEventHandler("onClientGUIClick", armorB, 
function() 
triggerServerEvent("onarmorb", getLocalPlayer()) 
end)            
  

Use command /y

finally, thnx

Link to comment

use this

addEventHandler("onClientGUIClick", closeB, 
function() 
guiSetVisible(mywindow,false) 
showCursor(false) 
end,false) 
---- 
addEventHandler("onClientGUIClick", armorB, 
function() 
triggerServerEvent("onarmorb", getLocalPlayer()) 
end,false) 

or

addEventHandler("onClientGUIClick",root,function () 
if (source == armorB) then 
triggerServerEvent("onarmorb", getLocalPlayer()) 
elseif (source == closeB) then 
guiSetVisible(mywindow,false) 
showCursor(false) 
end 
end) 
Link to comment

Hey,

"onPlayerClick" is an existing Server-sided event, you have to find own event names for your events.

--Client-side 
 Button1 = guiCreateButton( 0.7, 0.3, 0.2, 0.1, "Outp11ut!", true )     
function wuy() 
  showCursor(true) 
end 
addCommandHandler("y",wuy) 
addEventHandler("onClientGUIClick",root,function () 
if (source == Button1) then 
triggerServerEvent ( "onPlayerClicko",localPlayer) 
end 
end) 

-- Server-side  
addEvent( "onPlayerClicko", true ) 
addEventHandler( "onPlayerClicko",root,function () 
if (getPlayerMoney(source) > 100) then 
setPedArmor(source,50) 
takePlayerMoney(source,100) 
else 
outputChatBox ("you poor",source,150,0,0) 
end 
end) 

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