Tete omar Posted May 21, 2012 Share Posted May 21, 2012 local Marker = createMarker ( 1007.4000244141, -2302.6999511719, 12.10000038147, "cylinder", 1.29999995, 255, 0, 0, 255 ) addEventHandler('onClientMarkerHit', Marker, function (hitPlayer) if (hitPlayer == localPlayer) then guiSetVisible(GUIEditor_Window[1], true) showCursor(true) end end) function CreateGUIWindow() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(502,268,480,290,"Buy Ticket",false) GUIEditor_Image[1] = guiCreateStaticImage(240,20,229,261,"images/space.png",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(9,251,91,30,"Buy Ticket",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(155,251,69,30,"Exit",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(15,20,219,221,"=====|MoonTrip|=====\nWelcome to the\" MoonTrip\", the moon trip is wonderful trip full of mystery stuff and nice gravitation,You'll find the absolute fun but try to find fun enough \nbecause time is only 10 minutes you will find above signs should find it in different areas, each one under 5k have a nice time\n====|Ticket|====\nMoon 50,000$=====|MoonTrip|====",false,GUIEditor_Window[1]) guiSetVisible(GUIEditor_Window[1], false) addEventHandler("onClientGUIClick", GUIEditor_Button[2], DestroyWindow, false) end addEventHandler("onClientResourceStart", getRootElement(), CreateGUIWindow) function DestroyWindow() destroyElement(GUIEditor_Window[1]) guiSetInputEnabled(false) showCursor(false) end function takePlayerMoney() takePlayerMoney (50000 ) end addEventHandler('onClientMarkerHit', Marker,) it's a full gamemode but can't set " takeplayerMoney ' up I mean when the player click on Buy Ticket then take 50k then destroy the window Link to comment
top sniper Posted May 21, 2012 Share Posted May 21, 2012 (edited) local Marker = createMarker ( 1007.4000244141, -2302.6999511719, 12.10000038147, "cylinder", 1.29999995, 255, 0, 0, 255 ) addEventHandler('onClientMarkerHit', Marker, function (hitPlayer) if (hitPlayer == localPlayer) then guiSetVisible(GUIEditor_Window[1], true) showCursor(true) end end) function CreateGUIWindow() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(502,268,480,290,"Buy Ticket",false) GUIEditor_Image[1] = guiCreateStaticImage(240,20,229,261,"images/space.png",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(9,251,91,30,"Buy Ticket",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(155,251,69,30,"Exit",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(15,20,219,221,"=====|MoonTrip|=====\nWelcome to the\" MoonTrip\", the moon trip is wonderful trip full of mystery stuff and nice gravitation,You'll find the absolute fun but try to find fun enough \nbecause time is only 10 minutes you will find above signs should find it in different areas, each one under 5k have a nice time\n====|Ticket|====\nMoon 50,000$=====|MoonTrip|====",false,GUIEditor_Window[1]) guiSetVisible(GUIEditor_Window[1], false) addEventHandler("onClientGUIClick", GUIEditor_Button[2], DestroyWindow, false) end addEventHandler("onClientResourceStart", getRootElement(), CreateGUIWindow) function DestroyWindow() destroyElement(GUIEditor_Window[1]) guiSetInputEnabled(false) showCursor(false) end function takePlayerMoney() takePlayerMoney (50000 ) end addEventHandler('onClientMarkerHit', Marker,) it's a full gamemode but can't set " takeplayerMoney ' up I mean when the player click on Buy Ticket then take 50k then destroy the window what about this ? addEventHandler('onClientMarkerHit', Marker,) Edited May 21, 2012 by Guest Link to comment
top sniper Posted May 21, 2012 Share Posted May 21, 2012 local Marker = createMarker ( 1007.4000244141, -2302.6999511719, 12.10000038147, "cylinder", 1.29999995, 255, 0, 0, 255 ) addEventHandler('onClientMarkerHit', Marker, function (hitPlayer) if (hitPlayer == localPlayer) then guiSetVisible(GUIEditor_Window[1], true) showCursor(true) end end) function CreateGUIWindow() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(502,268,480,290,"Buy Ticket",false) GUIEditor_Image[1] = guiCreateStaticImage(240,20,229,261,"images/space.png",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(9,251,91,30,"Buy Ticket",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(155,251,69,30,"Exit",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(15,20,219,221,"=====|MoonTrip|=====\nWelcome to the\" MoonTrip\", the moon trip is wonderful trip full of mystery stuff and nice gravitation,You'll find the absolute fun but try to find fun enough \nbecause time is only 10 minutes you will find above signs should find it in different areas, each one under 5k have a nice time\n====|Ticket|====\nMoon 50,000$=====|MoonTrip|====",false,GUIEditor_Window[1]) guiSetVisible(GUIEditor_Window[1], false) addEventHandler("onClientGUIClick", GUIEditor_Button[2], DestroyWindow, false) end addEventHandler("onClientResourceStart", getRootElement(), CreateGUIWindow) function DestroyWindow() destroyElement(GUIEditor_Window[1]) guiSetInputEnabled(false) showCursor(false) end function takePlayerMoney() takePlayerMoney (50000 ) end addEventHandler('onClientMarkerHit', Marker,) it's a full gamemode but can't set " takeplayerMoney ' up I mean when the player click on Buy Ticket then take 50k then destroy the window any way local Marker = createMarker ( 1007.4000244141, -2302.6999511719, 12.10000038147, "cylinder", 1.29999995, 255, 0, 0, 255 ) addEventHandler('onClientMarkerHit', Marker, function (hitPlayer) if (hitPlayer == localPlayer) then guiSetVisible(GUIEditor_Window[1], true) showCursor(true) end end) function CreateGUIWindow() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(502,268,480,290,"Buy Ticket",false) GUIEditor_Image[1] = guiCreateStaticImage(240,20,229,261,"images/space.png",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(9,251,91,30,"Buy Ticket",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(155,251,69,30,"Exit",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(15,20,219,221,"=====|MoonTrip|=====\nWelcome to the\" MoonTrip\", the moon trip is wonderful trip full of mystery stuff and nice gravitation,You'll find the absolute fun but try to find fun enough \nbecause time is only 10 minutes you will find above signs should find it in different areas, each one under 5k have a nice time\n====|Ticket|====\nMoon 50,000$=====|MoonTrip|====",false,GUIEditor_Window[1]) guiSetVisible(GUIEditor_Window[1], false) addEventHandler("onClientGUIClick", GUIEditor_Button[2], DestroyWindow, false) end addEventHandler("onClientResourceStart", getRootElement(), CreateGUIWindow) function DestroyWindow() destroyElement(GUIEditor_Window[1]) guiSetInputEnabled(false) showCursor(false) end function takePlayermoney() takePlayerMoney (50000) end addEventHandler("onClientGUIClick", GUIEditor_Button[1], takePlayermoney, true) Link to comment
Tete omar Posted May 21, 2012 Author Share Posted May 21, 2012 local Marker = createMarker ( 1007.4000244141, -2302.6999511719, 12.10000038147, "cylinder", 1.29999995, 255, 0, 0, 255 ) addEventHandler('onClientMarkerHit', Marker, function (hitPlayer) if (hitPlayer == localPlayer) then guiSetVisible(GUIEditor_Window[1], true) showCursor(true) end end) function CreateGUIWindow() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(502,268,480,290,"Buy Ticket",false) GUIEditor_Image[1] = guiCreateStaticImage(240,20,229,261,"images/space.png",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(9,251,91,30,"Buy Ticket",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(155,251,69,30,"Exit",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(15,20,219,221,"=====|MoonTrip|=====\nWelcome to the\" MoonTrip\", the moon trip is wonderful trip full of mystery stuff and nice gravitation,You'll find the absolute fun but try to find fun enough \nbecause time is only 10 minutes you will find above signs should find it in different areas, each one under 5k have a nice time\n====|Ticket|====\nMoon 50,000$=====|MoonTrip|====",false,GUIEditor_Window[1]) guiSetVisible(GUIEditor_Window[1], false) addEventHandler("onClientGUIClick", GUIEditor_Button[2], DestroyWindow, false) end addEventHandler("onClientResourceStart", getRootElement(), CreateGUIWindow) function DestroyWindow() destroyElement(GUIEditor_Window[1]) guiSetInputEnabled(false) showCursor(false) end function takePlayerMoney() takePlayerMoney (50000 ) end addEventHandler('onClientMarkerHit', Marker,) it's a full gamemode but can't set " takeplayerMoney ' up I mean when the player click on Buy Ticket then take 50k then destroy the window any way local Marker = createMarker ( 1007.4000244141, -2302.6999511719, 12.10000038147, "cylinder", 1.29999995, 255, 0, 0, 255 ) addEventHandler('onClientMarkerHit', Marker, function (hitPlayer) if (hitPlayer == localPlayer) then guiSetVisible(GUIEditor_Window[1], true) showCursor(true) end end) function CreateGUIWindow() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(502,268,480,290,"Buy Ticket",false) GUIEditor_Image[1] = guiCreateStaticImage(240,20,229,261,"images/space.png",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(9,251,91,30,"Buy Ticket",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(155,251,69,30,"Exit",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(15,20,219,221,"=====|MoonTrip|=====\nWelcome to the\" MoonTrip\", the moon trip is wonderful trip full of mystery stuff and nice gravitation,You'll find the absolute fun but try to find fun enough \nbecause time is only 10 minutes you will find above signs should find it in different areas, each one under 5k have a nice time\n====|Ticket|====\nMoon 50,000$=====|MoonTrip|====",false,GUIEditor_Window[1]) guiSetVisible(GUIEditor_Window[1], false) addEventHandler("onClientGUIClick", GUIEditor_Button[2], DestroyWindow, false) end addEventHandler("onClientResourceStart", getRootElement(), CreateGUIWindow) function DestroyWindow() destroyElement(GUIEditor_Window[1]) guiSetInputEnabled(false) showCursor(false) end function takePlayermoney() takePlayerMoney (50000) end addEventHandler("onClientGUIClick", GUIEditor_Button[1], takePlayermoney, true) I told you before in MSN it's a ( nil value ) GUIEditor_Button Link to comment
Tete omar Posted May 21, 2012 Author Share Posted May 21, 2012 local Marker = createMarker ( 1007.4000244141, -2302.6999511719, 12.10000038147, "cylinder", 1.29999995, 255, 0, 0, 255 ) addEventHandler('onClientMarkerHit', Marker, function (hitPlayer) if (hitPlayer == localPlayer) then guiSetVisible(GUIEditor_Window[1], true) showCursor(true) end end) function CreateGUIWindow() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(502,268,480,290,"Buy Ticket",false) GUIEditor_Image[1] = guiCreateStaticImage(240,20,229,261,"images/space.png",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(9,251,91,30,"Buy Ticket",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(155,251,69,30,"Exit",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(15,20,219,221,"=====|MoonTrip|=====\nWelcome to the\" MoonTrip\", the moon trip is wonderful trip full of mystery stuff and nice gravitation,You'll find the absolute fun but try to find fun enough \nbecause time is only 10 minutes you will find above signs should find it in different areas, each one under 5k have a nice time\n====|Ticket|====\nMoon 50,000$=====|MoonTrip|====",false,GUIEditor_Window[1]) guiSetVisible(GUIEditor_Window[1], false) addEventHandler("onClientGUIClick", GUIEditor_Button[2], DestroyWindow, false) end addEventHandler("onClientResourceStart", getRootElement(), CreateGUIWindow) function DestroyWindow() destroyElement(GUIEditor_Window[1]) guiSetInputEnabled(false) showCursor(false) end function takePlayerMoney() takePlayerMoney (50000 ) end addEventHandler('onClientMarkerHit', Marker,) it's a full gamemode but can't set " takeplayerMoney ' up I mean when the player click on Buy Ticket then take 50k then destroy the window what about this ? addEventHandler('onClientMarkerHit', Marker,) ANYWAY thanks i fixed it with my self no help needed Link to comment
Jaysds1 Posted May 21, 2012 Share Posted May 21, 2012 try this: local Marker = createMarker ( 1007.4000244141, -2302.6999511719, 12.10000038147, "cylinder", 1.29999995, 255, 0, 0, 255 ) addEventHandler('onClientMarkerHit', Marker,function(hitPlayer) if (hitPlayer == localPlayer) then guiSetVisible(GUIEditor_Window[1], true) showCursor(true) end end) function CreateGUIWindow() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(502,268,480,290,"Buy Ticket",false) GUIEditor_Image[1] = guiCreateStaticImage(240,20,229,261,"images/space.png",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(9,251,91,30,"Buy Ticket",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(155,251,69,30,"Exit",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(15,20,219,221,"=====|MoonTrip|=====\nWelcome to the\" MoonTrip\", the moon trip is wonderful trip full of mystery stuff and nice gravitation,You'll find the absolute fun but try to find fun enough \nbecause time is only 10 minutes you will find above signs should find it in different areas, each one under 5k have a nice time\n====|Ticket|====\nMoon 50,000$=====|MoonTrip|====",false,GUIEditor_Window[1]) guiSetVisible(GUIEditor_Window[1], false) addEventHandler("onClientGUIClick", GUIEditor_Button[2], DestroyWindow, false) end addEventHandler("onClientResourceStart", getRootElement(), CreateGUIWindow) function DestroyWindow() guiSetVisible(GUIEditor_Window[1],false) --set Window not visible, so if the player walks in to the marker again then they pay and the window comes back up guiSetInputEnabled(false) showCursor(false) end function take() --try not using the function as a function takePlayerMoney (50000) end addEventHandler('onClientMarkerHit', Marker,take) --forgot to add the function name Link to comment
Genius Posted May 21, 2012 Share Posted May 21, 2012 Try this: local Marker = createMarker ( 1007.4000244141, -2302.6999511719, 12.10000038147, "cylinder", 1.29999995, 255, 0, 0, 255 ) addEventHandler('onClientMarkerHit', Marker, function (hitPlayer) if (hitPlayer == localPlayer) then guiSetVisible(GUIEditor_Window[1], true) showCursor(true) end end) function CreateGUIWindow() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(502,268,480,290,"Buy Ticket",false) GUIEditor_Image[1] = guiCreateStaticImage(240,20,229,261,"images/space.png",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(9,251,91,30,"Buy Ticket",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(155,251,69,30,"Exit",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(15,20,219,221,"=====|MoonTrip|=====\nWelcome to the\" MoonTrip\", the moon trip is wonderful trip full of mystery stuff and nice gravitation,You'll find the absolute fun but try to find fun enough \nbecause time is only 10 minutes you will find above signs should find it in different areas, each one under 5k have a nice time\n====|Ticket|====\nMoon 50,000$=====|MoonTrip|====",false,GUIEditor_Window[1]) guiSetVisible(GUIEditor_Window[1], false) addEventHandler("onClientGUIClick", GUIEditor_Button[2], DestroyWindow, false) end addEventHandler("onClientResourceStart", getRootElement(), CreateGUIWindow) function DestroyWindow() destroyElement(GUIEditor_Window[1]) guiSetInputEnabled(false) showCursor(false) end function takeMoney() takePlayerMoney ( source, 50000 ) end addEventHandler('onClientMarkerHit', Marker, takeMoney) Link to comment
X-SHADOW Posted May 21, 2012 Share Posted May 21, 2012 Note: Using this function client side (not recommended) will not change a players money server side. Link to comment
Jaysds1 Posted May 21, 2012 Share Posted May 21, 2012 It worked for me yesterday, maybe it's fixed on MTA 1.4 Nightly Link to comment
iFoReX Posted May 21, 2012 Share Posted May 21, 2012 a TIP : use a triggerServerEvent or triggerClientEvent, beucase the takePlayerMoney work in server side, in client-side, when the player reconnect have the money Link to comment
X-SHADOW Posted May 21, 2012 Share Posted May 21, 2012 Client-Side local Marker = createMarker ( 1007.4000244141, -2302.6999511719, 12.10000038147, "cylinder", 1.29999995, 255, 0, 0, 255 ) addEventHandler('onClientMarkerHit', Marker,function(hitPlayer) if (hitPlayer == localPlayer) then guiSetVisible(GUIEditor_Window[1], true) showCursor(true) end end) function CreateGUIWindow() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(502,268,480,290,"Buy Ticket",false) GUIEditor_Image[1] = guiCreateStaticImage(240,20,229,261,"images/space.png",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(9,251,91,30,"Buy Ticket",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(155,251,69,30,"Exit",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(15,20,219,221,"=====|MoonTrip|=====\nWelcome to the\" MoonTrip\", the moon trip is wonderful trip full of mystery stuff and nice gravitation,You'll find the absolute fun but try to find fun enough \nbecause time is only 10 minutes you will find above signs should find it in different areas, each one under 5k have a nice time\n====|Ticket|====\nMoon 50,000$=====|MoonTrip|====",false,GUIEditor_Window[1]) guiSetVisible(GUIEditor_Window[1], false) addEventHandler("onClientResourceStart", getRootElement(), CreateGUIWindow) addEventHandler('onClientMarkerHit', Marker,function() if ( source == GUIEditor_Button[1] ) then triggerServerEvent('SetM', localPlayer) elseif ( source == GUIEditor_Button[2]) then guiSetVisible(GUIEditor_Window[1],false) guiSetInputEnabled(false) showCursor(false) end end) end Server-Side addEvent('setM', true) addEventHandler('SetM', root, function() takePlayerMoney(source, 5000) end) Link to comment
Jaysds1 Posted May 21, 2012 Share Posted May 21, 2012 here: addEvent('setM', true) addEventHandler('SetM', root,function() takePlayerMoney(client, 5000) end) Link to comment
X-SHADOW Posted May 21, 2012 Share Posted May 21, 2012 Why you use Client insted of source ? Link to comment
Tete omar Posted May 21, 2012 Author Share Posted May 21, 2012 It's the same thing X-SHADOW. Why local Marker = createMarker ( 1007.4000244141, -2302.6999511719, 12.10000038147, "cylinder", 1.29999995, 255, 0, 0, 255 ) addEventHandler('onClientMarkerHit', Marker,function(hitPlayer) if (hitPlayer == localPlayer) then guiSetVisible(GUIEditor_Window[1], true) showCursor(true) end end) function CreateGUIWindow() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(502,268,480,290,"",false) GUIEditor_Image[1] = guiCreateStaticImage(240,20,229,261,"images/space.png",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(155,251,69,30,"Exit",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(15,20,219,221,"=====|MoonTrip|=====\nWelcome to the\" MoonTrip\", the moon trip is wonderful trip full of mystery stuff and nice gravitation,You'll find the absolute fun but try to find fun enough \nbecause time is only 10 minutes you will find above signs should find it in different areas, each one under 5k have a nice time\n====|Ticket|====\nMoon 50,000$=====|MoonTrip|====",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(10,251,91,30,"Buy Ticket",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) guiSetVisible(GUIEditor_Window[1], false) addEventHandler("onClientGUIClick", GUIEditor_Button[2], DestroyWindow, false) end addEventHandler("onClientResourceStart", getRootElement(), CreateGUIWindow) function DestroyWindow() guiSetVisible(GUIEditor_Window[1],false) guiSetInputEnabled(false) showCursor(false) end function take() takePlayerMoney (100000) end addEventHandler("onClientGUIClick", GUIEditor_Button[1], takePlayerMoney, false) GUIEditor_Button[1] why it's a nil value ? Link to comment
Jaysds1 Posted May 21, 2012 Share Posted May 21, 2012 I think it's because the event handler was out of the function with the defined button, try this: local Marker = createMarker ( 1007.4000244141, -2302.6999511719, 12.10000038147, "cylinder", 1.29999995, 255, 0, 0, 255 ) addEventHandler('onClientMarkerHit', Marker,function(hitPlayer) if (hitPlayer == localPlayer) then guiSetVisible(GUIEditor_Window[1], true) showCursor(true) end end) function CreateGUIWindow() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(502,268,480,290,"",false) GUIEditor_Image[1] = guiCreateStaticImage(240,20,229,261,"images/space.png",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(10,251,91,30,"Buy Ticket",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(155,251,69,30,"Exit",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(15,20,219,221,"=====|MoonTrip|=====\nWelcome to the\" MoonTrip\", the moon trip is wonderful trip full of mystery stuff and nice gravitation,You'll find the absolute fun but try to find fun enough \nbecause time is only 10 minutes you will find above signs should find it in different areas, each one under 5k have a nice time\n====|Ticket|====\nMoon 50,000$=====|MoonTrip|====",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) guiSetVisible(GUIEditor_Window[1], false) addEventHandler("onClientGUIClick", GUIEditor_Button[2], DestroyWindow, false) addEventHandler("onClientGUIClick", GUIEditor_Button[1], takePlayerMoney, false) end addEventHandler("onClientResourceStart", getRootElement(), CreateGUIWindow) function DestroyWindow() guiSetVisible(GUIEditor_Window[1],false) guiSetInputEnabled(false) showCursor(false) end function take() takePlayerMoney (100000) end Link to comment
Tete omar Posted May 21, 2012 Author Share Posted May 21, 2012 I think it's because the event handler was out of the function with the defined button, try this: local Marker = createMarker ( 1007.4000244141, -2302.6999511719, 12.10000038147, "cylinder", 1.29999995, 255, 0, 0, 255 ) addEventHandler('onClientMarkerHit', Marker,function(hitPlayer) if (hitPlayer == localPlayer) then guiSetVisible(GUIEditor_Window[1], true) showCursor(true) end end) function CreateGUIWindow() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(502,268,480,290,"",false) GUIEditor_Image[1] = guiCreateStaticImage(240,20,229,261,"images/space.png",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(10,251,91,30,"Buy Ticket",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(155,251,69,30,"Exit",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(15,20,219,221,"=====|MoonTrip|=====\nWelcome to the\" MoonTrip\", the moon trip is wonderful trip full of mystery stuff and nice gravitation,You'll find the absolute fun but try to find fun enough \nbecause time is only 10 minutes you will find above signs should find it in different areas, each one under 5k have a nice time\n====|Ticket|====\nMoon 50,000$=====|MoonTrip|====",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) guiSetVisible(GUIEditor_Window[1], false) addEventHandler("onClientGUIClick", GUIEditor_Button[2], DestroyWindow, false) addEventHandler("onClientGUIClick", GUIEditor_Button[1], takePlayerMoney, false) end addEventHandler("onClientResourceStart", getRootElement(), CreateGUIWindow) function DestroyWindow() guiSetVisible(GUIEditor_Window[1],false) guiSetInputEnabled(false) showCursor(false) end function take() takePlayerMoney (100000) end So when the player hit the marker force taking of money with out click on the button and i tried it if i have no money it show like this -100000 but i think this script has crashed fully : ( Link to comment
X-SHADOW Posted May 21, 2012 Share Posted May 21, 2012 yes takePlayerMoney is serverSide to work it wont work clientSide Use my script if you press button 1 then take 5000 and do your work .. Link to comment
Tete omar Posted May 21, 2012 Author Share Posted May 21, 2012 yes takePlayerMoney is serverSide to work it wont work clientSideUse my script if you press button 1 then take 5000 and do your work .. GUIEditor_Window ( a nil value ) Link to comment
Jaysds1 Posted May 21, 2012 Share Posted May 21, 2012 ok, try this: local Marker = createMarker ( 1007.4000244141, -2302.6999511719, 12.10000038147, "cylinder", 1.29999995, 255, 0, 0, 255 ) addEventHandler('onClientMarkerHit', Marker,function(hitPlayer) if (hitPlayer == localPlayer) then guiSetVisible(GUIEditor_Window[1], true) showCursor(true) end end) function CreateGUIWindow() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(502,268,480,290,"",false) GUIEditor_Image[1] = guiCreateStaticImage(240,20,229,261,"images/space.png",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(10,251,91,30,"Buy Ticket",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(155,251,69,30,"Exit",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(15,20,219,221,"=====|MoonTrip|=====\nWelcome to the\" MoonTrip\", the moon trip is wonderful trip full of mystery stuff and nice gravitation,You'll find the absolute fun but try to find fun enough \nbecause time is only 10 minutes you will find above signs should find it in different areas, each one under 5k have a nice time\n====|Ticket|====\nMoon 50,000$=====|MoonTrip|====",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) guiSetVisible(GUIEditor_Window[1], false) addEventHandler("onClientGUIClick", GUIEditor_Button[2], DestroyWindow, false) addEventHandler("onClientGUIClick", GUIEditor_Button[1], take, false) end addEventHandler("onClientResourceStart", getRootElement(), CreateGUIWindow) function DestroyWindow() guiSetVisible(GUIEditor_Window[1],false) guiSetInputEnabled(false) showCursor(false) end function take() if(getPlayerMoney(localPlayer)>=100000)then takePlayerMoney (100000) guiSetVisible(GUIEditor_Window[1],false) guiSetInputEnabled(false) showCursor(false) else outputChatBox("Sorry, you don't have enough money",100,0,0) end end Link to comment
X-SHADOW Posted May 21, 2012 Share Posted May 21, 2012 Jaysds1 takePlayerMoney won't Work ClientSide Link to comment
Tete omar Posted May 21, 2012 Author Share Posted May 21, 2012 ok, try this: local Marker = createMarker ( 1007.4000244141, -2302.6999511719, 12.10000038147, "cylinder", 1.29999995, 255, 0, 0, 255 ) addEventHandler('onClientMarkerHit', Marker,function(hitPlayer) if (hitPlayer == localPlayer) then guiSetVisible(GUIEditor_Window[1], true) showCursor(true) end end) function CreateGUIWindow() GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(502,268,480,290,"",false) GUIEditor_Image[1] = guiCreateStaticImage(240,20,229,261,"images/space.png",false,GUIEditor_Window[1]) GUIEditor_Button[1] = guiCreateButton(10,251,91,30,"Buy Ticket",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(155,251,69,30,"Exit",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(15,20,219,221,"=====|MoonTrip|=====\nWelcome to the\" MoonTrip\", the moon trip is wonderful trip full of mystery stuff and nice gravitation,You'll find the absolute fun but try to find fun enough \nbecause time is only 10 minutes you will find above signs should find it in different areas, each one under 5k have a nice time\n====|Ticket|====\nMoon 50,000$=====|MoonTrip|====",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) guiSetVisible(GUIEditor_Window[1], false) addEventHandler("onClientGUIClick", GUIEditor_Button[2], DestroyWindow, false) addEventHandler("onClientGUIClick", GUIEditor_Button[1], take, false) end addEventHandler("onClientResourceStart", getRootElement(), CreateGUIWindow) function DestroyWindow() guiSetVisible(GUIEditor_Window[1],false) guiSetInputEnabled(false) showCursor(false) end function take() if(getPlayerMoney(localPlayer)>=100000)then takePlayerMoney (100000) guiSetVisible(GUIEditor_Window[1],false) guiSetInputEnabled(false) showCursor(false) else outputChatBox("Sorry, you don't have enough money",100,0,0) end end Thaaaaaaaanks bro !!! i love youuu i 'll never ever forget that : ) Link to comment
Jaysds1 Posted May 21, 2012 Share Posted May 21, 2012 np, @X-Shadow, It works in MTA 1.4 Nightly, so I think it's fixed... Link to comment
Tete omar Posted May 21, 2012 Author Share Posted May 21, 2012 np,@X-Shadow, It works in MTA 1.4 Nightly, so I think it's fixed... X-shaDOW IT WORKS ! Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now