Jump to content

triggring..


Recommended Posts

Posted

hello i'm trying to trigger for server to client but it's give me errors

i made a gui button when i click it it must give me the money....

here is the code

client.lua

function pro2(thePlayer) 
if source == GUIEditor.button[2] then 
    triggerServerEvent ("onGreeting",thePlayer,setPlayerMoney(thePlayer, 5000000)) 
end 
end 
addEventHandler("onClientGUIClick", root, pro2) 

server.lua

function money( thePlayer ) 
if getElementData( thePlayer,"VIP") == true then 
setPlayerMoney(thePlayer, 5000000) 
end 
end 
addEvent( "onGreeting", true ) 
addEventHandler( "onGreeting", root, money ) 

2vjs7it.jpg
Posted
  
-- Client side 
function pro2() 
    if source == GUIEditor.button[2] then 
        triggerServerEvent ("onGreeting",localPlayer) 
    end 
end 
addEventHandler("onClientGUIClick", root, pro2) 
  
-- Server side 
function money( ) 
    if getElementData(source,"VIP") == true then 
        setPlayerMoney(source, 5000000) 
    end 
end 
addEvent( "onGreeting", true ) 
addEventHandler( "onGreeting", root, money ) 

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

Posted

Why don't you make it server side ?

setPlayerMoney is a shared function so can be used server and also client.

function pro2() 
if source == GUIEditor.button[2] then 
    setPlayerMoney(localPlayer, 5000000) 
end 
end 
addEventHandler("onClientGUIClick", root, pro2) 

And also are you sure you want to use setPlayerMoney not givePlayerMoney ?

Resources I made:

Do not PM me for help with leaked scripts! I WILL NOT HELP YOU!

 

Posted
Why don't you make it server side ?

setPlayerMoney is a shared function so can be used server and also client.

function pro2() 
if source == GUIEditor.button[2] then 
    setPlayerMoney(localPlayer, 5000000) 
end 
end 
addEventHandler("onClientGUIClick", root, pro2) 

And also are you sure you want to use setPlayerMoney not givePlayerMoney ?

i tried that but not working

any ways thanks and it's ok for setplayermoney :)

2vjs7it.jpg
Posted

That because the function don't require player element in client side, and anyway client side is not recommended.

CiTLh.png

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