Dear members of the MTA Sa Forum,
I have a new problem. If i start this script when i am in the server, i see the GUI and i can't click anything, after that i need to reconnect because of this script.
The marker doesn't work but i can luckly see it. I think that there is a problem with guiSetVisible. Can someone help me?
Thanks in advance,
Oekeokiki
Client:
local trainsf = createMarker( -1959, 138, 28, 'cylinder', 2.0, 255, 0, 0, 150 )
function weedspeedtrains ()
GUIEditor_Button = {}
GUIEditor_Label = {}
Weedspeed_Trains = guiCreateWindow(307,256,418,282,"Weedspeed Trains",false)
GUIEditor_Label[1] = guiCreateLabel(0.1124,0.117,0.8062,0.2057,"Welcome at WeedSpeed Trains, where do you want to go?",true,Weedspeed_Trains)
guiLabelSetColor(GUIEditor_Label[1],255,255,255)
guiLabelSetVerticalAlign(GUIEditor_Label[1],"top")
guiLabelSetHorizontalAlign(GUIEditor_Label[1],"left",false)
lossantosmarket = guiCreateButton(0.0622,0.3227,0.3038,0.1773,"Los Santos Market",true,Weedspeed_Trains)
GUIEditor_Button[2] = guiCreateButton(0.5694,0.3227,0.3038,0.1773,"Los Santos Little Mexico",true,Weedspeed_Trains)
GUIEditor_Button[3] = guiCreateButton(0.0646,0.5532,0.3038,0.1773,"San Fierro",true,Weedspeed_Trains)
GUIEditor_Button[4] = guiCreateButton(0.3254,0.7695,0.3038,0.1773,"Las Venturas East",true,Weedspeed_Trains)
GUIEditor_Button[5] = guiCreateButton(0.5718,0.5532,0.3038,0.1773,"Las Venturas North",true,Weedspeed_Trains)
guiSetVisible(Weedspeed_Trains, false)
end
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),
function ()
weedspeedtrains()
if (Weedspeed_Trains ~= nil) then
guiSetVisible(Weedspeed_Trains, true)
end
showCursor(true)
guiSetInputEnabled(true)
end
)
function lossantosmarketgo(button)
if button == "left" then
triggerServerEvent("warplsmarket", getRootElement() )
guiSetVisible(Weedspeed_Trains, false)
showCursor(false)
end
end
addEventHandler("onClientGUIClick", lossantosmarket, lossantosmarketgo, false)
addEventHandler( "onMarkerHit", trainsf, weedspeedtrains )
Server:
function spawnlsmarket(client)
local x,y,z
x = 1738
y = -1949
z = 15
if (client) then
spawnPlayer(client, x, y, z)
fadeCamera(client, true)
end
end
addEvent("warplsmarket", true)
addEventHandler("warplsmarket", getRootElement(), spawnlsmarket)