Jump to content

Bean666

Members
  • Posts

    732
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Bean666

  1. Bean666

    Question

    function object() object = createObject ( 1337, 5540.6654, 1020.55122, 1240.545, 90, 0, 0 ) outputChatBox("created", source) end addEvent("object", true) addEventHandler("object", getRootElement(), object) so, i'll need to move this in clientside? i kind of get it about the triggerClientEvent, but i don't know what event i am going to trigger from "Client" is it this one?
  2. Bean666

    Question

    can you kindly explain why i'll need to use triggerClientEvent just to make the object show for the localPlayer and others not being able to see it?? so when i use this , it triggers Event for localPlayer right, will the object only show for the localPlayer? i just need yes or no, thanks in advance. i'm just not sure if i triggerServerEvent "object" with localPlayer , other players can see the object that the localplayer created because i'm playing alone, i just need a yes or a no. triggerServerEvent("object", localPlayer)
  3. Bean666

    Question

    will this only show the object to the localPlayer? because i don't want any other players to see the object you will spawn. or will i need setElementVisibleTo or nah? any tips? client: function create() if ( source == button ) then if ( getPlayerMoney (localPlayer) <= 4999 ) then return end triggerServerEvent("object", localPlayer) guiSetVisible(classWnd, false) showCursor(false) end end addEventHandler("onClientGUIClick", getRootElement(),create) server: function object() object = createObject ( 1337, 5540.6654, 1020.55122, 1240.545, 90, 0, 0 ) outputChatBox("created", source) end addEvent("object", true) addEventHandler("object", getRootElement(), object)
  4. Bean666

    Help

    serverside starts before client. so pretty much yeah. check debugscript 3 for the solution
  5. Bean666

    Help

    could you try replacing resourceRoot with localPlayer?, i don't think it will make any changes but you could try, AND make sure the server , client is defined in meta.xml triggerServerEvent ("setInvisiblity", localPlayer) P.S: I don't see anything wrong in CodyL's code tho...
  6. Bean666

    Help

    i know, pardon.
  7. Bean666

    Help

    i suggest using triggerServerEvent for the invisibility, because localPlayer is only for the localPlayer so other players might won't see you as invisible. this is serverside: function toggleInvis ( player ) if getElementAlpha( player ) == 255 then setElementAlpha ( player, 0 ) else setElementAlpha ( player, 255 ) end addEvent("toggleInvis", true) addEventHandler("toggleInvis", getRootElement(), toggleInvis) ' this could work. or maybe this too(you could use elseif if you want but this method could work): function toggleInvis ( player ) local alpha = getElementAlpha(player) if alpha == 255 then setElementAlpha(player, 0) end if alpha == 0 then setElementAlpha(player, 255) end addEvent("toggleInvis", true) addEventHandler("toggleInvis", getRootElement(), toggleInvis) Client: function toggleInvis () triggerServerEvent("toggleInvis", getLocalPlayer(), toggleInvis) end
  8. Bean666

    Help

    function toggleInvis () if getElementAlpha( thePlayer ) == 0 then setElementAlpha ( thePlayer, 0 ) else setElementAlpha ( thePlayer, 255 end this won't work i think try replacing with this: i suggest using serverside for the invisiblity tho, but here's client side. function toggleInvis ( ) local n = ( getElementAlpha ( localPlayer ) > 0 ) and 0 or 255; setElementAlpha ( localPlayer, n ); end
  9. i don't see anything wrong but i think yeah give it a try! if there is something wrong tell me whats wrong. better if u mix getplayeracc and get account name. addCommandHandler("tsunami", function(source) local sourceAccount = getAccountName ( getPlayerAccount ( source ) ) if isObjectInACLGroup("user."..sourceAccount, aclGetGroup("Admin")) then triggerClientEvent(source, "setWaterL", source) end end )
  10. make an event that adds +0.1 each second then use triggerClientEvent
  11. use triggerClientEvent, use this kind of function TheTimer = setTimer( function() -- your stuff-- end, 1000, 0) setTimer of triggerclient event example which you could add in that function setTimer(triggerClientEvent, 1000, 0, element, "event", element) 1: means once only 0: means endless
  12. why not keep them on client side then, setWaterLevel is shared.
  13. getZoneName ( float x, float y, float z, [bool citiesonly=false] ) yep, pretty much try changing adding true argument. citiesonly: An optional argument to choose if you want to return the city name (eg Las Venturas)
  14. Bean666

    not working

    it also doesn't work if i remove the setElementDimension how? the onClientMarkerHit works....
  15. Bean666

    not working

    hi why it doesn't work when i set another marker's dimension? local marker = createMarker(2216.41675, -1151.71008, 1025, "cylinder", 1.2, 0, 0, 255, 200) setElementDimension(marker, 1) setElementInterior(marker, 15) function gui( hitElement, matchingDimension ) if not matchingDimension then return end if isPedInVehicle(hitElement) then return; end if getElementType( hitElement ) == "player" then triggerClientEvent(hitElement, "stationGUI", hitElement) end end addEventHandler("onMarkerHit", root, gui) addEvent("stationGUI", true) function guishow(player) guiSetVisible(classWnd, true) showCursor(true) end addEventHandler("stationGUI",getRootElement(),guishow)
  16. that's why it's "LoadingMap", i can't help you if you don't know anything, i can also barely understand what you mean. anyways if possible can u show me a video of whats wrong so i can understand what you mean. check what you need here and change it with it: undefined NoMap LoadingMap PreGridCountdown GridCountdown Running MidMapVote SomeoneWon TimesUp EveryoneFinished PostFinish NextMapSelect NextMapVote ResourceStopping
  17. that's why it's "LoadingMap", i can't help you if you don't know anything, i can also barely understand what you mean. check what you need here and change it with it: undefined NoMap LoadingMap PreGridCountdown GridCountdown Running MidMapVote SomeoneWon TimesUp EveryoneFinished PostFinish NextMapSelect NextMapVote ResourceStopping
  18. try. function startVehicleChanging() if isTimer(vehChangeTimer) then killTimer(vehChangeTimer) end vehChangeTimer = setTimer( function() for _,plr in pairs(getElementsByType("player")) do local veh = getPedOccupiedVehicle(plr) local model = vehicleIDS[math.random(1,#vehicleIDS)] if veh and model and getPedOccupiedVehicleSeat(plr) == 0 then local x,y,z = getElementVelocity(veh) setElementVelocity(veh,x,y,z+0.05) local hp = getElementHealth(veh) setElementModel(veh,model) setElementHealth(veh,hp) end end end ,15000,0) end addEvent("onRaceStateChanging",true) addEventHandler("onRaceStateChanging",root, function (new) if (new == "Running") then startVehicleChanging() triggerClientEvent(source,"onCounterStart",source) end if (new =="LoadingMap") then triggerClientEvent(source,"removeCounter",source) if isTimer(vehChangeTimer) then resetTimer(vehChangeTimer) end if isTimer(vehChangeTimer) then killTimer(vehChangeTimer) end end end ) function startEverything() addEventHandler("onClientRender",root,drawCounterSHI) timer = setTimer(function() counter = counter - 1 if counter < 0 then counter = 15 r,g,b = 0,255,0 end if counter <= 3 then r,g,b = 255,0,0 end end,1000,0) end addEvent("onCounterStart",true) addEventHandler("onCounterStart",getRootElement(),startEverything) addEvent("removeCounter", true) addEventHandler("removeCounter", getRootElement(), function () removeEventHandler("onClientRender", root, draw) if isTimer(timer) then resetTimer(timer) end if isTimer(timer) then killTimer(timer) end end )
  19. if you want to add more functions to other buttons, don't add more events, just add an "elseif" for a shorter and a clean code and if you test scripts please use /debugscript 3 , it will show you errors if your script / is not working / not functioning properly. then tell us what the debugscript says. addEventHandler("onClientGUIClick",resourceRoot,function() if ( source == GUIEditor.button[1]) then setElementModel(localPlayer, 285) guiSetVisible(GUIEditor.window[1], false) showCursor(false) elseif ( source == buttonname) then -- your stuff here -- end end ) we won't need mic , chat would do good. chat is easier and we can send codes easily. skype is not just for call , you can also chat there and send lua files. Well i might wont be able to reply now since im going to sleep , didn't sleep since yesterday. good luck on your scripting and keep learning. don't hesitate to PM me on forums when you need help.
  20. i use my skype alot more and MTA Forums. skype: shadewshamen123
  21. i don't mind if i can just help i'll help.
  22. i don't see that you made a close button , i can only see a Start job button. you should've made a close button then? you should make another button for the close option addEventHandler("onClientGUIClick",resourceRoot,function() if ( source == GUIEditor.button[1]) then setElementModel(localPlayer, 285) guiSetVisible(GUIEditor.window[1], false) showCursor(false) end end ) here is example of when you click start job button changes your skin and closes GUI.
  23. np it's actually fun to help people , good thing you are learning. and trying something by yourself. just learn , and you'll be fine , if you need anything search Wiki for what you need and try something by yourself, if you can't do it and made a code , post it here we will fix it for you. https://wiki.multitheftauto.com/wiki/Sc ... troduction learn some serverside / clientside functions. https://wiki.multitheftauto.com/wiki/Se ... _Functions https://wiki.multitheftauto.com/wiki/Cl ... _Functions useful functions https://wiki.multitheftauto.com/wiki/Useful_Functions
  24. u missed the window = {}, lol try this code now. client first code 2nd code server Stuff u did wrong: you missed 1 table item the window = {} you put comma "," on the last item of the table. make sure to don't add commas in the last item of the table. GUIEditor = { tab = {}, tabpanel = {}, label = {}, button = {}, window = {} } GUIEditor.window[1] = guiCreateWindow(193, 147, 521, 353, "Oil Refinery - Job", false) guiWindowSetSizable(GUIEditor.window[1], false) guiSetVisible(GUIEditor.window[1], false) guiSetProperty(GUIEditor.window[1], "CloseButton", true) GUIEditor.label[1] = guiCreateLabel(10, 42, 129, 17, "Job's Name", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[1], "default-small") GUIEditor.label[2] = guiCreateLabel(10, 59, 129, 17, "Income", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[2], "default-small") GUIEditor.label[3] = guiCreateLabel(10, 76, 129, 17, "Rental Vehicle", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[3], "default-small") GUIEditor.label[4] = guiCreateLabel(139, 42, 15, 17, "-", false, GUIEditor.window[1]) GUIEditor.label[5] = guiCreateLabel(139, 76, 15, 17, "-", false, GUIEditor.window[1]) GUIEditor.label[6] = guiCreateLabel(139, 59, 15, 17, "-", false, GUIEditor.window[1]) GUIEditor.label[7] = guiCreateLabel(154, 42, 333, 17, "Oil Refinery", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[7], "default-bold-small") GUIEditor.label[8] = guiCreateLabel(154, 59, 333, 17, "Not Set", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[8], "default-bold-small") GUIEditor.label[9] = guiCreateLabel(154, 76, 333, 17, "Yes", false, GUIEditor.window[1]) guiSetFont(GUIEditor.label[9], "default-bold-small") GUIEditor.label[10] = guiCreateLabel(232, 93, 106, 16, "Help", false, GUIEditor.window[1]) GUIEditor.button[1] = guiCreateButton(186, 303, 145, 40, "START JOB", false, GUIEditor.window[1]) GUIEditor.tabpanel[1] = guiCreateTabPanel(61, 118, 387, 166, false, GUIEditor.window[1]) GUIEditor.tab[1] = guiCreateTab("Basic Help ", GUIEditor.tabpanel[1]) GUIEditor.label[11] = guiCreateLabel(10, 5, 367, 127, "Your job is to extract oil and deliver it to refiner machine. After that refine the oil and it will be automatically stored in tanks. After that collect your money ...", false, GUIEditor.tab[1]) guiLabelSetHorizontalAlign(GUIEditor.label[11], "left", true) GUIEditor.tab[2] = guiCreateTab("How to do job ?", GUIEditor.tabpanel[1]) GUIEditor.label[12] = guiCreateLabel(6, 7, 371, 125, "This is a complex job. Follow the steps to complete the job - 1. Turn on the electric generator. 2. Switch on the power supply for machines. 3. Wait until progress bar shows 100%. 4. Now take your vehicle to every oil drill. 5. Now unload all the oil. 6. Turn on refiner. 7. Wait until it is refined 8. Now collect the money.", false, GUIEditor.tab[2]) guiLabelSetHorizontalAlign(GUIEditor.label[12], "left", true) GUIEditor.tab[3] = guiCreateTab("Miscs.", GUIEditor.tabpanel[1]) GUIEditor.label[13] = guiCreateLabel(6, 5, 371, 127, "The more you work the more you will get exp. .... The more exp. you have the more you earn ....", false, GUIEditor.tab[3]) guiLabelSetHorizontalAlign(GUIEditor.label[13], "left", true) addEvent("GUIhelp", true) function guishow(player) guiSetVisible(GUIEditor.window[1], true) showCursor(true) end addEventHandler("GUIhelp",getRootElement(),guishow) local marker = createMarker(2489,-1673,14, "cylinder", 1.5, 200, 150, 50, 150) function gui( hitElement ) if isPedInVehicle(hitElement) then return; end if getElementType( hitElement ) == "player" then triggerClientEvent(hitElement, "GUIhelp", hitElement) end end addEventHandler("onMarkerHit", root, gui)
  25. check my code if its working , did u try it?
×
×
  • Create New...