LasHa Posted June 7, 2014 Share Posted June 7, 2014 guys can yo uhelp me? everything works fine, everything what i did, but not Participate button which is the main thing, i have added it in fucntion but didn't work, in eventhandler again ddidn't work, please fix it and help me local ddmarker = createMarker( 2719, -1828, 11, "cylinder", 2, 255, 255, 0, 170, false ) createBlipAttachedTo(ddmarker, 11) local playerName = getPlayerName(getLocalPlayer()) participateWindow = guiCreateWindow(436, 368, 448, 220, "CSU DD Event", false) guiWindowSetSizable(participateWindow, false) participateButton = guiCreateButton(76, 150, 128, 43, "Participate", false, participateWindow) guiSetFont(participateButton, "default-bold-small") participateLabel = guiCreateLabel(10, 21, 432, 127, "Hello "..playerName..", you are about to participate in dd event, \nwhere you can kill people by car, with shooting them rockets from car. Click \nbutton Participate, but it costs 5,000$. \nIf you don't want to participate, or lose 5,000$ click Cansel Button. \nBut also you must know that, if you win this event you will get \n50,000$.", false, participateWindow) guiSetFont(participateLabel, "clear-normal") canselButton = guiCreateButton(233, 150, 128, 43, "Cansel", false, participateWindow) guiSetFont(canselButton, "default-bold-small") guiSetVisible (participateWindow, false) addEventHandler("onClientGUIClick", canselButton, function () guiSetVisible(participateWindow, false) showCursor(false) end, false) addEventHandler("onClientGuiClick", participateButton, function () local count = getElementData(localPlayer,"Your_Data")setElementData(localPlayer,"Your_Data",count+1) takePlayerMoney(5000) exports.CSUtexts:output("You have been participated in event, wait for other players, to participate and when you reach 10 players, event will be started automaticaly.", 255, 255, 0) guiSetVisible ( participateWindow, false ) end, false) Link to comment
Max+ Posted June 7, 2014 Share Posted June 7, 2014 (edited) Your Code , has alot of erros , takeMoney wont work , on ClientSide better use , trigger, --ClientSide , local ddmarker = createMarker( 2719, -1828, 11, "cylinder", 2, 255, 255, 0, 170, false ) createBlipAttachedTo(ddmarker, 11) participateWindow = guiCreateWindow(436, 368, 448, 220, "CSU DD Event", false) guiWindowSetSizable(participateWindow, false) participateButton = guiCreateButton(76, 150, 128, 43, "Participate", false, participateWindow) guiSetFont(participateButton, "default-bold-small") participateLabel = guiCreateLabel(10, 21, 432, 127, "Hello "..playerName..", you are about to participate in dd event, \nwhere you can kill people by car, with shooting them rockets from car. Click \nbutton Participate, but it costs 5,000$. \nIf you don't want to participate, or lose 5,000$ click Cansel Button. \nBut also you must know that, if you win this event you will get \n50,000$.", false, participateWindow) guiSetFont(participateLabel, "clear-normal") canselButton = guiCreateButton(233, 150, 128, 43, "Cansel", false, participateWindow) guiSetFont(canselButton, "default-bold-small") guiSetVisible (participateWindow, false) addEventHandler('onClientGUIClick', root, function () if ( localPlayer == participateButton ) then local count = (getElementData(localPlayer,"Your_Data")) if count == false then setElementData ( localPlayer, "Your_Data", "0" ) elseif count == true then setElementData(localPlayer,"Your_Data", count +1) triggerServerEvent('TakeMoney', localPlayer) exports.CSUtexts:output("You have been participated in event, wait for other players, to participate and when you reach 10 players, event will be started automaticaly.", 255, 255, 0) guiSetVisible(participateWindow, false) showCursor(false) elseif ( localPlayer == canselButton ) then guiSetVisible(participateWindow, false) showCursor(false) end end end ) ---ServerSide , addEvent('TakeMoney', true) addEventHandler('TakeMoney', root, function () takePlayerMoney(source, 5000) outputChatBox('we have take $500 for this', source, getRootElement(), 255, 0,0) end ) Edited , Edited June 7, 2014 by Guest Link to comment
LasHa Posted June 7, 2014 Author Share Posted June 7, 2014 really? prooo <3 doesn't works any other wayS? Link to comment
Max+ Posted June 7, 2014 Share Posted June 7, 2014 really? prooo <3 doesn't works any other wayS? I edited my post , try now Link to comment
LasHa Posted June 7, 2014 Author Share Posted June 7, 2014 doesn't works + so many bugs also when start script it shows me gui and when do end to don't show this window it fails script so please cadell help me. Link to comment
Max+ Posted June 7, 2014 Share Posted June 7, 2014 Well i dont see any key to open the gui , you want open it with key or on marke hit ? Link to comment
LasHa Posted June 7, 2014 Author Share Posted June 7, 2014 marker hit but i have it i am opening gui in my script i didn't write whole script i wrote script where is gui and i want just button click i already have gui i will post whole script if its needed [lua]local ddmarker = createMarker( 2719, -1828, 11, "cylinder", 2, 255, 255, 0, 170, false ) createBlipAttachedTo(ddmarker, 43) local playerName = getPlayerName(getLocalPlayer()) participateWindow = guiCreateWindow(436, 368, 448, 220, "CSU DD Event", false) guiWindowSetSizable(participateWindow, false) participateButton = guiCreateButton(76, 150, 128, 43, "Participate", false, participateWindow) guiSetFont(participateButton, "default-bold-small") participateLabel = guiCreateLabel(10, 21, 432, 127, "Hello "..playerName..", you are about to participate in dd event, \nwhere you can kill people by car, with shooting them rockets from car. Click \nbutton Participate, but it costs 5,000$. \nIf you don't want to participate, or lose 5,000$ click Cansel Button. \nBut also you must know that, if you win this event you will get \n50,000$.", false, participateWindow) guiSetFont(participateLabel, "clear-normal") canselButton = guiCreateButton(233, 150, 128, 43, "Cansel", false, participateWindow) guiSetFont(canselButton, "default-bold-small") guiSetVisible (participateWindow, false) addEventHandler("onClientGUIClick", canselButton, function () guiSetVisible(participateWindow, false) showCursor(false) end, false) addEventHandler("onClientGuiClick", participateButton, function () local count = getElementData(localPlayer,"Your_Data")setElementData(localPlayer,"Your_Data",count+1) takePlayerMoney(5000) exports.CSUtexts:output("You have been participated in event, wait for other players, to participate and when you reach 10 players, event will be started automaticaly.", 255, 255, 0) guiSetVisible ( participateWindow, false ) end, false) function enteredMarker() if ( guiGetVisible ( participateWindow ) == false ) then guiSetVisible ( participateWindow, true ) showCursor(true) end end addEventHandler ( "onClientMarkerHit", ddmarker, enteredMarker ) function onQuitGame( ) local playerLeft = getPlayerName(source) local count = getElementData(localPlayer,"Your_Data") setElementData(localPlayer,"Your_Data",count-1) exports.CSUtexts:output(""..playerLeft.." left the event, Paricipate players in event "..count.."", 255, 255, 0) end addEventHandler( "onClientPlayerQuit", getRootElement(), onQuitGame ) addCommandHandler("leavedd", onQuitGame) function checkPlayers() local playersInDD = getElementData(localPlayer,"Your_Data") exports.CSUtexts:output("There are "..playersInDD.."/10 players signed in event", 255, 255, 0) end addCommandHandler("ddevent", checkPlayers) function warpPlayers() if (getElementData(localPlayer,"Your_Data", 10)) then exports.CSUtexts:output("10/10 players have signed in event, wait 10 seconds, to be warped.", 255, 255, 0) setTimer(1000, 1) end end Link to comment
LasHa Posted June 7, 2014 Author Share Posted June 7, 2014 marker hit but i have it i am opening gui in my script i didn't write whole script i wrote script where is gui and i want just button click i already have gui i will post whole script if its needed local ddmarker = createMarker( 2719, -1828, 11, "cylinder", 2, 255, 255, 0, 170, false ) createBlipAttachedTo(ddmarker, 43) local playerName = getPlayerName(getLocalPlayer()) participateWindow = guiCreateWindow(436, 368, 448, 220, "CSU DD Event", false) guiWindowSetSizable(participateWindow, false) participateButton = guiCreateButton(76, 150, 128, 43, "Participate", false, participateWindow) guiSetFont(participateButton, "default-bold-small") participateLabel = guiCreateLabel(10, 21, 432, 127, "Hello "..playerName..", you are about to participate in dd event, \nwhere you can kill people by car, with shooting them rockets from car. Click \nbutton Participate, but it costs 5,000$. \nIf you don't want to participate, or lose 5,000$ click Cansel Button. \nBut also you must know that, if you win this event you will get \n50,000$.", false, participateWindow) guiSetFont(participateLabel, "clear-normal") canselButton = guiCreateButton(233, 150, 128, 43, "Cansel", false, participateWindow) guiSetFont(canselButton, "default-bold-small") guiSetVisible (participateWindow, false) addEventHandler("onClientGUIClick", canselButton, function () guiSetVisible(participateWindow, false) showCursor(false) end, false) addEventHandler("onClientGuiClick", participateButton, function () local count = getElementData(localPlayer,"Your_Data")setElementData(localPlayer,"Your_Data",count+1) takePlayerMoney(5000) exports.CSUtexts:output("You have been participated in event, wait for other players, to participate and when you reach 10 players, event will be started automaticaly.", 255, 255, 0) guiSetVisible ( participateWindow, false ) end, false) function enteredMarker() if ( guiGetVisible ( participateWindow ) == false ) then guiSetVisible ( participateWindow, true ) showCursor(true) end end addEventHandler ( "onClientMarkerHit", ddmarker, enteredMarker ) function onQuitGame( ) local playerLeft = getPlayerName(source) local count = getElementData(localPlayer,"Your_Data") setElementData(localPlayer,"Your_Data",count-1) exports.CSUtexts:output(""..playerLeft.." left the event, Paricipate players in event "..count.."", 255, 255, 0) end addEventHandler( "onClientPlayerQuit", getRootElement(), onQuitGame ) addCommandHandler("leavedd", onQuitGame) function checkPlayers() local playersInDD = getElementData(localPlayer,"Your_Data") exports.CSUtexts:output("There are "..playersInDD.."/10 players signed in event", 255, 255, 0) end addCommandHandler("ddevent", checkPlayers) function warpPlayers() if (getElementData(localPlayer,"Your_Data", 10)) then exports.CSUtexts:output("10/10 players have signed in event, wait 10 seconds, to be warped.", 255, 255, 0) setTimer(1000, 1) end end Link to comment
Max+ Posted June 7, 2014 Share Posted June 7, 2014 Now it's working , i Fixed alot of bugs you had , and Fixed the gui , show on start , Fixed ,buttons click , Fixed , money take , Fixed marker , Fixed the count if it's 10 then == start the game , and please learn form these erros , and make sure to organize your code next time ( use shortcuts ) .. . . ---ClientSide, participateWindow = guiCreateWindow(436, 368, 448, 220, "CSU DD Event", false) guiWindowSetSizable(participateWindow, false) participateButton = guiCreateButton(76, 150, 128, 43, "Participate", false, participateWindow) guiSetFont(participateButton, "default-bold-small") participateLabel = guiCreateLabel(10, 21, 432, 127, "Hello "..getPlayerName(localPlayer)..", you are about to participate in dd event, \nwhere you can kill people by car, with shooting them rockets from car. Click \nbutton Participate, but it costs 5,000$. \nIf you don't want to participate, or lose 5,000$ click Cansel Button. \nBut also you must know that, if you win this event you will get \n50,000$.", false, participateWindow) guiSetFont(participateLabel, "clear-normal") canselButton = guiCreateButton(233, 150, 128, 43, "Cansel", false, participateWindow) guiSetFont(canselButton, "default-bold-small") addEventHandler('onClientGUIClick', root, function () if ( source == participateButton ) then guiSetVisible(participateWindow, false) showCursor(false) local count = (getElementData(localPlayer,"Your_Data")) or 0 setElementData(localPlayer,"Your_Data", count +1) triggerServerEvent('TakeMoney', localPlayer) exports.CSUtexts:output("You have been participated in event, wait for other players, to participate and when you reach 10 players, event will be started automaticaly.", 255, 255, 0) elseif ( source == canselButton ) then guiSetVisible(participateWindow, false) showCursor(false) end end ) addEventHandler('onClientResourceStart', resourceRoot, function () guiSetVisible(participateWindow, false) showCursor(false) end ) function onQuitGame( ) local count = getElementData(localPlayer,"Your_Data") setElementData(localPlayer,"Your_Data",count -1) exports.CSUtexts:output(""..getPlayerName(localPlayer).." left the event, Paricipate players in event "..count.."", 255, 255, 0) end addEventHandler( "onClientPlayerQuit", getRootElement(), onQuitGame ) addCommandHandler("leavedd", onQuitGame) function checkPlayers() local playersInDD = getElementData(localPlayer,"Your_Data") exports.CSUtexts:output("There are "..playersInDD.."/10 players signed in event", 255, 255, 0) end addCommandHandler("ddevent", checkPlayers) function warpPlayers() if (getElementData(localPlayer,"Your_Data" == 10 )) then exports.CSUtexts:output("10/10 players have signed in event, wait 10 seconds, to be warped.", 255, 255, 0) setTimer(1000, 1) end end addEvent("ShowGUI", true) addEventHandler("ShowGUI", root, function() guiSetVisible(participateWindow, true) showCursor(true) end ) ---ServerSide , local ddmarker = createMarker( 2719, -1828, 11, "cylinder", 2, 255, 255, 0, 170, false ) createBlipAttachedTo(ddmarker, 11) addEventHandler('onMarkerHit', root, function (hitElement) if (getElementType(hitElement) == 'player' ) then triggerClientEvent(hitElement, "ShowGUI", hitElement) end end ) addEvent('TakeMoney' , true) addEventHandler('TakeMoney', root, function () takePlayerMoney(source, 5000) end ) Link to comment
LasHa Posted June 7, 2014 Author Share Posted June 7, 2014 do you try them in your local server? it doesn't works Link to comment
Max+ Posted June 7, 2014 Share Posted June 7, 2014 Yes i did and it's hide after select the participateButton and take money , also with canseButton and show when hit the marker next the airport but i dont have the resource exports.CSUtexts:output to test rest of it , Link to comment
LasHa Posted June 7, 2014 Author Share Posted June 7, 2014 max it didn't work for me idk why Link to comment
LasHa Posted June 7, 2014 Author Share Posted June 7, 2014 ah srry srry <3 ty you fixed it i just added wrongly in meta Link to comment
Max+ Posted June 8, 2014 Share Posted June 8, 2014 your welcome , take a look here , https://wiki.multitheftauto.com/wiki/Meta.xml 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