Jump to content

Tete omar

Members
  • Posts

    3,267
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by Tete omar

  1. wait i show all the code server side local blip = createBlip ( 0, 0, 0, 0, 3 ) local BusJobMarker = createMarker ( 1620.2777099609, -1041.3696289063, 22.8984375, "cylinder", 2, 255, 0, 0, 255 ) local busteam = createTeam ( "Bus drivers", 255, 255, 0 ) function attachblipwith() attachElements ( blip, BusJobMarker, 0, 0, 0 ) end addEventHandler("onResourceStart", getRootElement(), attachblipwith) function showWindow(player) if not isPedInVehicle(player) then triggerClientEvent(player,"Showbusjobwindow", player) end end addEventHandler("onMarkerHit", getRootElement(), showWindow) addEvent("StartBusJob", true) buses = { } function StartBusJob ( ) setPlayerTeam ( source, busteam ) local gX, gY, gZ = getElementPosition ( source ) if ( isElement ( buses [ source ] ) ) then destroyElement ( buses [ source ] ) end buses [ source ] = createVehicle ( 431, gX, gY, gZ ) setTimer ( warpPedIntoVehicle, 200, 1, source, buses [ source ]) setPedSkin ( source, 253 ) triggerClientEvent("theMarkers", getRootElement(), buses) end addEventHandler ( "StartBusJob", root, StartBusJob ) " GUI client side " addEvent("Showbusjobwindow", true) function Showbusjobwindow() guiSetVisible(GUIEditor_Window[1], true) showCursor(true) guiSetInputEnabled(false) end addEventHandler("Showbusjobwindow",getRootElement(),Showbusjobwindow) GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Grid = {} GUIEditor_Window[1] = guiCreateWindow(318,268,494,200,"[LSR]BusJob",false) guiSetAlpha(GUIEditor_Window[1],1) GUIEditor_Button[1] = guiCreateButton(162,144,144,36,"Start Job",false,GUIEditor_Window[1]) GUIEditor_Button[2] = guiCreateButton(9,158,71,30,"EXIT",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(438,26,41,32,"?",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(81,84,339,54,"============|Bus Job|=============\nThe objective of this Job and passenger movement between the positions and the streets must be moved from position to another this Job does not have a fixed salary is dependent on your effort to work\n============|Bus Job|=============t",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) guiSetVisible( GUIEditor_Window[1], false ) guiSetVisible( GUIEditor_Memo[1], false ) function exiting() if ( source == GUIEditor_Button[2] ) then guiSetVisible ( GUIEditor_Window[1], false ) showCursor( false ) guiSetInputEnabled( false ) end end addEventHandler("onClientGUIClick", getRootElement(), exiting) function showTheMemo() if ( source == GUIEditor_Button[3] ) then guiSetVisible ( GUIEditor_Memo[1], true ) end end addEventHandler("onClientGUIClick", getRootElement(), showTheMemo) function startTheJob() if ( source == GUIEditor_Button[1] ) then triggerServerEvent ("StartBusJob", localPlayer, player) guiSetVisible ( GUIEditor_Window[1], false ) showCursor( false ) guiSetInputEnabled( false ) end end addEventHandler("onClientGUIClick", getRootElement(), startTheJob) and finally client side addEvent("theMarkers", true) addEventHandler("theMarkers",root,function() local Marker1 = createMarker ( math.random (1431,1613), math.random (-1046,-1029), math.random (22.5,22.906229019165), "cylinder", 3, 255, 0, 0, 255 ) local Bblip1 = createBlip ( 0, 0, 0, 56, 3 ) attachElements ( Marker1, Bblip1 ) --attach elements outside of the event addEventHandler("onClientMarkerHit", Marker1,function(hitPlayer) if (hitPlayer == localPlayer) then --check if the hitPlayer is localPlayer first if isPedInVehicle ( hitPlayer ) then local randomly = math.random ( 5, 100 ) givePlayerMoney ( randomly ) outputChatBox(" You've got #00ff00$"..randomly.." #ffff00from the station",255,255,0, true) else outputChatBox("you must be in your bus") addEventHandler("onClientMarkerLeave", Marker1,function(leavePlayer) destroyElement ( Marker1 ) setElementPosition(Marker1,math.random (1431,1613), math.random (-1046,-1029), math.random (22.5,22.906229019165)) --set Markers Position end) end end end) end) this is bus job .. if i created a counted markers .. shall i create it every time .. ? or it must be "infinity" marker but i have an idea ok if i created the markers .. is there any thing that return the action i mean if hit the final marker the first marker will show up etc etc etc ..
  2. i did like this addEvent("theMarkers", true) addEventHandler("theMarkers",root,function()--there is no need for the first arguement local Marker1 = createMarker ( math.random (1431,1613), math.random (-1046,-1029), math.random (22.5,22.906229019165), "cylinder", 3, 255, 0, 0, 255 ) local Bblip1 = createBlip ( 0, 0, 0, 56, 3 ) attachElements ( Marker1, Bblip1 ) --attach elements outside of the event addEventHandler("onClientMarkerHit", Marker1,function(hitPlayer) if (hitPlayer == localPlayer) then --check if the hitPlayer is localPlayer first if isPedInVehicle ( hitPlayer ) then local randomly = math.random ( 5, 100 ) and math.random ( 50, 500 ) givePlayerMoney ( randomly ) outputChatBox(" You've got #00ff00$"..randomly.." #ffff00from the station",255,255,0, true) else outputChatBox("you must be in your bus") addEventHandler("onClientMarkerLeave", Marker1,function(leavePlayer) destroyElement ( Marker1 ) setElementPosition(Marker1,math.random (1431,1613), math.random (-1046,-1029), math.random (22.5,22.906229019165)) --set Markers Position end) end end end) end) the outPutChatBox problem was fixed but when i hit this marker it won't disappear and show up on another position
  3. Thanks alot Jaysds But if hit this marker which on the random position it gives me alot of money like this you've got ... from the station you've got ... from the station you've got ... from the station you've got ... from the station you've got ... from the station it also show up on 1 position only should i use destroyElement onClientMarkerLeave or what ?
  4. He confused between the client side and server side lol sorry i got careless of your code but good luck
  5. I didn't know that you triggered the code but you good luck with this function onPayDay() local money = math.random( 400, 800 ) local player = getLocalPlayer() local currentMoney = getPlayerMoney( player ) outputChatBox(" ") outputChatBox("|||------------ Pay Day ------------|||", 70, 200, 0) outputChatBox(" ") outputChatBox("Saldo actual -| #EEDDAA"..currentMoney, 250, 250, 250, true) outputChatBox("Ganho -| #EEDDAA"..money, 250, 250, 250, true) outputChatBox("Novo saldo -| #EEDDAA"..currentMoney and money, 250, 250, 250, true) outputChatBox(" ") outputChatBox("|||------------------------------------|||", 70, 200, 0) exports.players:giveMoney( player, money ) if isPlayerDead( player ) then givePlayerMoney( player, money ) end end and your welcome
  6. firstly you shouldn't use comma after the function name like this onPayDay () and where's it's event handler ? try this function onPayDay() local money = math.random( 400, 800 ) local player = getLocalPlayer() local currentMoney = getPlayerMoney( player ) outputChatBox(" ") outputChatBox("|||------------ Pay Day ------------|||", 70, 200, 0) outputChatBox(" ") outputChatBox("Saldo actual -| #EEDDAA"..currentMoney, 250, 250, 250, true) outputChatBox("Ganho -| #EEDDAA"..money, 250, 250, 250, true) outputChatBox("Novo saldo -| #EEDDAA"..currentMoney and money, 250, 250, 250, true) outputChatBox(" ") outputChatBox("|||------------------------------------|||", 70, 200, 0) exports.players:giveMoney( player, money ) if isPlayerDead( source ) then givePlayerMoney( player, money ) end end addEventHandler("onPlayerQuit", getRootElement(), onPayDay) addEventHandler("onPlayerWasted", getRootElement(), onPayDay) this is must be on server side but i'm not sure because you didn't specific what side is this code
  7. I want if i hit the " RANDOM " marker .. it simply will be disappeared .. so .. i won't create a new markers i just want this marker show up on random positions if i hit it .. it will be created again then again but on random positions you understand me ?
  8. well, it's not fixed lol i don't see the marker or the blip
  9. Hi i want marker that can be on different positions .. example local Marker = createMarker ( 1431.1999511719, -1029.5, 22.5, "cylinder", 3, 255, 0, 0, 0 ) addEventHandler("onClientMarkerHit", Marker ,function(hitPlayer) if (hitPlayer == localPlayer) then destroyElement( Marker ) ok with destroyElement can't get the marker back i don't want to create a new marker then new then new then new... i want this marker if i hit it then it will be destroyed and show up on another position just like if this Marker destroyed then return this action but on another position using math.random local Marker1 = createMarker ( math.random (1431,1613), math.random (-1046,-1029), math.random (22.5,22.906229019165), "cylinder", 3, 255, 0, 0, 255 ) if i set it at 3 positions it gives me an error but it only can be 2 positions here's full code addEvent("theMarkers", true) function theMarkers(Player) local Marker1 = createMarker ( math.random (1431,1613), math.random (-1046,-1029), math.random (22.5,22.906229019165), "cylinder", 3, 255, 0, 0, 255 ) local Bblip1 = createBlip ( 0, 0, 0, 56, 3 ) addEventHandler("onClientMarkerHit", Marker1,function(hitPlayer) attachElements ( Marker1, Bblip1 ) if isPedInVehicle ( localPlayer ) then if (hitPlayer == localPlayer) then local randomly = math.random ( 5, 100 ) and math.random ( 50, 500 ) givePlayerMoney ( randomly ) outputChatBox(" You've got #00ff00$"..randomly.." #ffff00from the station",255,255,0, true) else outputChatBox("you must be on your bus") end end end ) addEventHandler("onClientMarkerLeave", Marker1,function(leavePlayer) destroyElement ( Marker1 ) destroyElement ( Bblip1 ) end ) end addEventHandler("theMarkers",getRootElement(),theMarkers) here if hit the marker it crashes the mta.exe .. and the blip goes to another position ..
  10. That's right .. well it's done i guess
  11. there's extra end :\
  12. buses = { } function StartBusJob ( ) setPlayerTeam ( source, busteam ) local gX, gY, gZ = getElementPosition ( source ) if ( isElement ( buses [ source ] ) ) then destroyElement ( buses [ source ] ) end buses [ source ] = createVehicle ( 431, gX, gY, gZ ) setTimer ( warpPedIntoVehicle, 200, 1 source, buses [ source ] ) -- here's the debug error end end addEventHandler ( "StartBusJob", root, StartBusJob ) debug says : ')' expected near source
  13. i did it like this buses = { } function StartBusJob() setPlayerTeam ( source, busteam) gX, gY, gZ = getElementPosition ( source ) if ( isElement ( buses [ source ] ) ) then bus = createVehicle ( 431, gX, gY, gZ ) warpPedIntoVehicle ( source, bus ) destroyElement ( buses [ source ] ) buses [ source ] = bus end end addEventHandler("StartBusJob",getRootElement(),StartBusJob) i'm sure it's wrong
  14. But this is not the right forum you better go to resources.
  15. i got this Castillo client side function startTheJob() if ( source == GUIEditor_Button[1] ) then local getvehicle = guiGridListGetSelectedItem ( GUIEditor_Grid[1] ) if getvehicle == "Bus" then triggerServerEvent("StartBusJob", localPlayer) elseif getvehicle == "Coach" then triggerServerEvent("StartCoachJob", localPlayer) guiSetVisible ( GUIEditor_Window[1], false ) showCursor( false ) guiSetInputEnabled( false ) end end end addEventHandler("onClientGUIClick", getRootElement(), startTheJob) server side addEvent("StartBusJob", true) function StartBusJob() setPlayerTeam ( source, busteam) gX, gY, gZ = getElementPosition ( source ) bus = createVehicle ( 431, gX, gY, gZ ) warpPedIntoVehicle ( source, bus ) end addEventHandler("StartBusJob",getRootElement(),StartBusJob) addEvent("StartCoachJob", true) function StartBusJob() setPlayerTeam ( source, busteam) gX, gY, gZ = getElementPosition ( source ) coach = createVehicle ( 437, gX, gY, gZ ) warpPedIntoVehicle ( source, coach ) end addEventHandler("StartBusJob",getRootElement(),StartBusJob) i've created a gridlist here which allows you to choose coach or bus but if clicked on the button nothing happens
  16. Problem resolved thanks warpPedIntoVehicle ( source, bus ) but i got 1 more problem .. is there any code that destroy the old vehicle .. if the player keep clicking on start then it spawns 2 buses than more
  17. How fast was you but it says bad argument @ warpPedIntoVehicle only and thanks
  18. server side local blip = createBlip ( 0, 0, 0, 0, 3 ) local BusJobMarker = createMarker ( 1620.2777099609, -1041.3696289063, 22.8984375, "cylinder", 2, 255, 0, 0, 255 ) local busteam = createTeam ( "Bus drivers", 255, 255, 0 ) function attachblipwith() attachElements ( blip, BusJobMarker, 0, 0, 0 ) end addEventHandler("onResourceStart", getRootElement(), attachblipwith) function showWindow(player) triggerClientEvent(player,"Showbusjobwindow", player) end addEventHandler("onMarkerHit", getRootElement(), showWindow) addEvent("StartBusJob", true) function StartBusJob(thePed) setPlayerTeam ( source, busteam) gX, gY, gZ = getElementPosition ( source ) bus = createVehicle ( 431, gX, gY, gZ ) warpPedIntoVehicle ( thePed, bus ) end addEventHandler("StartBusJob",getRootElement(),StartBusJob) client side addEvent("Showbusjobwindow", true) function Showbusjobwindow() guiSetVisible(GUIEditor_Window[1], true) showCursor(true) guiSetInputEnabled(false) end addEventHandler("Showbusjobwindow",getRootElement(),Showbusjobwindow) GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Memo = {} GUIEditor_Window[1] = guiCreateWindow(335,371,488,186,"[LSR]BusJob",false) GUIEditor_Button[1] = guiCreateButton(186,142,104,35,"START",false,GUIEditor_Window[1]) guiSetAlpha(GUIEditor_Button[1],1) GUIEditor_Button[2] = guiCreateButton(457,153,22,24,"?",false,GUIEditor_Window[1]) GUIEditor_Button[3] = guiCreateButton(9,21,74,28,"EXIT",false,GUIEditor_Window[1]) GUIEditor_Memo[1] = guiCreateMemo(92,46,301,87,"",false,GUIEditor_Window[1]) guiMemoSetReadOnly(GUIEditor_Memo[1],true) guiSetVisible( GUIEditor_Window[1], false ) guiSetVisible( GUIEditor_Memo[1], false ) function exiting() if ( source == GUIEditor_Button[3] ) then guiSetVisible ( GUIEditor_Window[1], false ) showCursor( false ) guiSetInputEnabled( false ) end end addEventHandler("onClientGUIClick", getRootElement(), exiting) function showTheMemo() if ( source == GUIEditor_Button[2] ) then guiSetVisible ( GUIEditor_Memo[1], true ) end end addEventHandler("onClientGUIClick", getRootElement(), showTheMemo) function startTheJob() if ( source == GUIEditor_Button[1] ) then triggerServerEvent("StartBusJob", getRootElement()) guiSetVisible ( GUIEditor_Window[1], false ) showCursor( false ) guiSetInputEnabled( false ) end end addEventHandler("onClientGUIClick", getRootElement(), startTheJob) DEBUG ERRORS : SERVER SIDE WARNING: Bad 'Player' pointer @ 'setPlayerTeam'(1) WARNING Bad argument @ 'warpPedIntoVehicle' CLIENT SIDE NONE
  19. Also look at this https://community.multitheftauto.com/ind ... 026&vote=1 porn pictures at community ??
  20. No as he want the sound moving this is impossible since getElementPosition with a command dont go in and get the position of him 24/7, it only gives it once. He need to use attachelements if he wants the sound following him all the way. you said sound moving ? .. so he can use this local gX, gY, gZ = getElementPosition ( localPlayer ) local myobject = createObject ( any object, floatX, floatY, floatZ ) etc.... local mysound = playSound ( "mysound.mp3", gX, gY, gZ ) etc ..... moveObject ( myobject , floatX, floatY, floatZ ) etc.... attachElements ( mysound , myobject ) that's enough i guess
  21. This is one of nicest scripts i have ever seen in my life !
  22. Regardless of createObject and attachElements you can use this playSound3D setSoundMaxDistance setSoundMinDistance
  23. debugscript 3 and show what's wrong
×
×
  • Create New...