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

F4MZM4.gif

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

==================================================================

~|منٌ رأيّتُموِۂ يّعتُدُيّ على عرض فُتُٱة مؤمنٌة فُٱسًحًقَوِوِوِوِوِوِوِة|~

134479106051.png

==================================================================

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) 
  

==================================================================

~|منٌ رأيّتُموِۂ يّعتُدُيّ على عرض فُتُٱة مؤمنٌة فُٱسًحًقَوِوِوِوِوِوِوِة|~

134479106051.png

==================================================================

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

F4MZM4.gif

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

F4MZM4.gif

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 
  

My in-game name: Jaysds1

Retired CMG Scripter

World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode

Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/

 

sE5Qm.png

TiV3C.png

img.php?id=0&text=Lua%20Scripter

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) 
  

MTA Scripter.

If you want scripter PM me and i will accept every job for fair price.

Posted

Note: Using this function client side (not recommended) will not change a players money server side.

My ingame nickname : Ops!

-DeathMatch GameMode By Ops! : 5%

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) 

My ingame nickname : Ops!

-DeathMatch GameMode By Ops! : 5%

Posted

It's the same thing X-SHADOW.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

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 ?

F4MZM4.gif

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 

My in-game name: Jaysds1

Retired CMG Scripter

World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode

Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/

 

sE5Qm.png

TiV3C.png

img.php?id=0&text=Lua%20Scripter

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

F4MZM4.gif

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

My ingame nickname : Ops!

-DeathMatch GameMode By Ops! : 5%

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 )

F4MZM4.gif

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 

My in-game name: Jaysds1

Retired CMG Scripter

World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode

Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/

 

sE5Qm.png

TiV3C.png

img.php?id=0&text=Lua%20Scripter

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

F4MZM4.gif

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