Jump to content

How I can use player fuctions on onClientGUIClick?


CTCCoco

Recommended Posts

Posted
for example:
yourbutton=guiCreateButton(0,0,20,20,false)
 
function processclick(button,state)
if button=="left" and state=="up" then
--do what you want
end
end
addEventHandler("onClientGUIClick",yourbutton,processclick)

watch https://wiki.multitheftauto.com/wiki/Cat ... _Tutorials ,

and try find it in wiki before asking in forums to help

You say that I don't use the Wiki? Then why I know that this event exist? magic? because I use the LUA editor.

I don't see how to use the players fuctions on the wiki pages on this fuction.

Posted

all clicks is clientside, so u dont need get player from it, and by triggering server events u can use variable "client" what is clients root elemnt that triggered the event.

Posted
for example:
yourbutton=guiCreateButton(0,0,20,20,false)
 
function processclick(button,state)
if button=="left" and state=="up" then
--do what you want
end
end
addEventHandler("onClientGUIClick",yourbutton,processclick)

watch https://wiki.multitheftauto.com/wiki/Cat ... _Tutorials ,

and try find it in wiki before asking in forums to help

You say that I don't use the Wiki? Then why I know that this event exist? magic? because I use the LUA editor.

I don't see how to use the players fuctions on the wiki pages on this fuction.

That's because you don't look for them.

https://wiki.multitheftauto.com/wiki/Int ... _the_click

Posted
for example:
yourbutton=guiCreateButton(0,0,20,20,false)
 
function processclick(button,state)
if button=="left" and state=="up" then
--do what you want
end
end
addEventHandler("onClientGUIClick",yourbutton,processclick)

watch https://wiki.multitheftauto.com/wiki/Cat ... _Tutorials ,

and try find it in wiki before asking in forums to help

You say that I don't use the Wiki? Then why I know that this event exist? magic? because I use the LUA editor.

I don't see how to use the players fuctions on the wiki pages on this fuction.

That's because you don't look for them.

https://wiki.multitheftauto.com/wiki/Int ... _the_click

you can't use player fuctions ... you must tigger an server-side event... and YES I SEE THIS https://wiki.multitheftauto.com/wiki/Int ... _the_click a lot of times.

Well thanks for all.

Posted

CTCCOco, for instance myself, I have no idea what this topic is about. Saying:

How I can use player fuctions on onClientGUIClick?

Thanks.

doesn't make sense to me. onClientGUIClick is an event which can call your functions. In your function you can call other functions, eg. player function. I don't know if this helps but if it doesn't then please explain a little more.

Posted
CTCCOco, for instance myself, I have no idea what this topic is about. Saying:
How I can use player fuctions on onClientGUIClick?

Thanks.

doesn't make sense to me. onClientGUIClick is an event which can call your functions. In your function you can call other functions, eg. player function. I don't know if this helps but if it doesn't then please explain a little more.

Thanks for reply.

I want do this in onClientGUIClick :

local casasxml = xmlLoadFile("casas.xml")
local hEntrancex = xmlNodeGetAttribute ( casasxml, "hEntradax." .. clickhouses )
local hEntrancey = xmlNodeGetAttribute ( casasxml, "hEntraday." .. clickhouses )
local hEntrancez = xmlNodeGetAttribute ( casasxml, "hEntradaz." .. clickhouses )
local hValue = xmlNodeGetAttribute ( casasxml, "hValue." .. clickhouses )
local hOwner = xmlNodeGetAttribute ( casasxml, "hOwner." .. clickhouses )
local hValue = tonumber ( hValue )
local dinero = getPlayerMoney (idontkown)
if(hOwner == "Estado") then
if(dinero >= hValue) then
setPlayerMoney ( idontknow, dinero - hValue)
outputChatBox("Enhorabuena. Has comprado esta casa por " .. hValue .. "$.")
local nombre = getPlayerName (getLocalPlayer())
xmlNodeSetAttribute ( casasxml, "hOwner." .. clickhouses, nombre)
xmlSaveFile(casasxml)
guiSetVisible(windowTituloCasa, false)
showCursor(false)
else
outputChatBox("No tienes sucifiente dinero encima para comprar esta casa.")
guiSetVisible(windowTituloCasa, false)
showCursor(false)
end
else
outputChatBox("Esta casa ya tiene un propietario.")
guiSetVisible(windowTituloCasa, false)
showCursor(false)
end

I can't use the player fuctions like GetPlayerMoney :( What I can do?

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