Jump to content

Stevenn

Members
  • Posts

    97
  • Joined

  • Last visited

Everything posted by Stevenn

  1. no, but i tried without, any i had no succes either so..
  2. Oh, what an idiot i am, debug message: bad arguement @ 'getElementPosition'
  3. Alright, it works perfectly thank ya'll. (I decided to use it serversided)
  4. well its rather obvious isn't it? i can't test the code atm as im not on my normal PC
  5. yes, i forgot to add this. but this is what i got so far function createMarkerOnVehicleEnter () if getElementModel ( getPedOccupiedVehicle ( localPlayer ) ) == myid then triggerEvent ( "my event", localPlayer ) end addEventHandler ( "onClientVehicleEnter", root, createMarkerOnVehicleEnter )
  6. Hello, i got an question, i want when a client enters a vehicle, and if the vehicle id is a special one then it will trigger an event but im new to this kind of things and i don't know how to do it. could anyone help out with givng an example?
  7. how can I use it like this: if ( hitElement == localPlayer and source == cMarker and isTruck(lp) ) then and function isTruck(lp) if ( getElementModel ( getPedOccupiedVehicle ( localPlayer ) ) == 437 ) then return true end end or if ( hitElement == localPlayer and source == cMarker and ( getElementModel ( getPedOccupiedVehicle ( localPlayer ) ) == 437 ) ) then none of them works, bad argument..
  8. hey, im trying to use local lp = getLocalPlayer() if getElementModel(getPedOccupiedVehicle(lp)) == 437 but it gives me: bad argument @ 'getElementModel'
  9. if ( source == cMarker and hitElement == localPlayer ) then ?
  10. Well, when I hit the "cMarker" I want to trigger the server event, but like I said: Expected element at argument 2, got nil
  11. because i was trying something but i remove it, and lp = getLocalPlayer()
  12. cMarker is not global. You must remove "local" before cMarker in the code to use it in other functions. See: http://en.wikipedia.org/wiki/Global_variable addEventHandler ( 'onClickCreateMarker', root, function ( ) local nX, nY, nZ = getRandomLocation ( ); cMarker = createMarker ( nX, nY, nZ, "cylinder",4,250,250,255 ); local blip = createBlipAttachedTo ( cMarker, 53 ); end ) addEventHandler ( "onClientMarkerHit", cMarker, function ( ) triggerServerEvent ( "truckStop", localPlayer ) end ) doesn't work...
  13. ty it works draken, but how can I do this ? addEventHandler ( "onClientMarkerHit", cMarker , function ( ) if getElementModel(getPedOccupiedVehicle(lp)) == 437 then triggerServerEvent ( "busStop", lp ) end end ) bad argument @ 'addEventHandler' [Expected element at argument 2, got nil]
  14. still bad argument at createMarker..
  15. i dont know what i am doing wrong bad argument @ 'createMarker' local locationTable = { { -2128, -80, 36 }, } function getRandomLocation ( ) return unpack ( locations [ math.random ( #locationTable ) ] ) end function buttonClick(button) if (button) ~= "left" then return end if (source == acceptJob) then triggerEvent ( "markerLocation3",lp ) end end addEventHandler("onClientGUIClick", resourceRoot, buttonClick, true) addEvent ( "markerLocation3", true) function markerLocation () markerLocation2 = createMarker ( x, y, z, "cylinder",250,250,250 ) blip = createBlipAttachtedTo ( markerLocation2, 53 ) end addEventHandler("markerLocation3",root,markerLocation) acceptJob = guiCreateButton(37,58,94,49,"Accept",false,truckWindow) viewtopic.php?f=91&t=42187#p426764
  16. Thank you for the really fast reply, as always. But, if I'm gonna create a marker at one of those, how would I do that? outputChatBox ( "my message" ..locations.. "hehe" ) mymarker = createMarker (locations, "cylinder", 1.5, 255, 255, 0, 170 ) I'm probably wrong but..
  17. Oh, looks like I wasn't that gone after all, now, if I need to give the player a random location every time and then output in chatbox which location they got and create a marker at that I have absolutely no idea how to do it, and I'd appreciate some help like (i know this is obviously wrong) outputChatBox("Now depart to" ..location.. "to get your next pay") -- where location will be randomly choosen from a table (x,y,x) and a name attached to it, like location = { [jefferson]=x,y,z, [allsaints]=x,y,z
  18. Okay so, im trying to do a job, but i need to know can i give a player a random pay, should i use math.random or random from a table? like givePlayerMoney(math.random (200, 500)) would give the player a random pay from 200-500? and, if i use any of those alternative how can I output it in chatbox like givePlayerMoney(math.random (200, 500)) outputChatBox("well done you have earned" ..what_to_pu_here.. "$")
  19. Stevenn

    play sound

    okay, but is it possible to bind the sound into a comamnand?
  20. lol, it's 4:50 am and i'm quite tired, i obviously meant onClientResourceStart and it works now, thanks for the sarcastic comment though solid. @Jay thanks.
  21. function dxText ( ) dxDrawText("my message",511.0,354.0,995.0,637.0,tocolor(255,255,255,255),1.5,"pricedown","left","top",false,false,false) end addEventHandler('onClientResourceRoot', root, function(reason) addEventHandler ( "onClientRender", root, dxText ) setTimer ( function ( ) removeEventHandler ( "onClientRender", root, dxText ) end ,5000,1 ) end ) no debugs, but no message either.
  22. Stevenn

    play sound

    oh, is it possible to not make it trigger? try this: addEventHandler ( "onClientPlayerJoin", root,function( ) sound = playSound ("files/mission.mp3", false ) setSoundVolume ( sound, 1.0 ) end) wouldn't that specifically play the sound when i join? i want it to only play when i restart the resource.
×
×
  • Create New...