Jump to content

takePlayerMoney problem


Recommended Posts

Posted
  
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

Posted (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 by Guest
Posted
  
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) 
  

Posted
  
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

Posted
  
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

Posted

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 
  

Posted

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) 
  

Posted

a TIP : use a triggerServerEvent or triggerClientEvent, beucase the takePlayerMoney work in server side, in client-side, when the player reconnect have the money

Posted

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) 

Posted
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 ?

Posted

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 

Posted
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 : (

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

GUIEditor_Window ( a nil value )

Posted

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 

Posted
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 : )

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