Jump to content

SkullBreaker

Members
  • Posts

    34
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

SkullBreaker's Achievements

Rat

Rat (9/54)

0

Reputation

  1. I tried to create a little 'mission' where a vehicle is spawned and if the player enters the vehicle, a marker appears and this works. If the player hits the marker, a text message should appear, but it doesn't. I get the following error: WARNING: mission\script.lua:15: Bad argument @ 'addEventHandler' [Expected element at argument 2, got nil] Here's my code: local veh1 = createVehicle (478, 2474, -1690.4, 13.6, 0, 0, 0) function showMarker (vehicle) if getElementType (vehicle) == "vehicle" and getElementModel (vehicle) == 478 then theMarker = createMarker (2515.6001, -1671.9, 11.8, "cylinder", 5.0, 100, 200, 100, 200) end end addEventHandler("onPlayerVehicleEnter", getRootElement(), showMarker) function showText () if theMarker == true then outputChatBox("It worked!") end end addEventHandler("onMarkerHit", theMarker, showText) Thanks for helping me
  2. Hello guys, I know I am posting a lot, but I really want to learn how to script I got a question: What is "root" or "getRootElement()" and when do I use it? Thanks!
  3. [quote name=..&G:..]Colshape is an invisible area, a square or any other shape. You can use that instead of a marker, more realistic., Okay Thanks!
  4. You probably have to make/search for a script with: addEventHandler("onResourceStart", getRootElement(), --the function--) fadeCamera ( player thePlayer, bool fadeIn, [ float timeToFade = 1.0, int red = 0, int green = 0, int blue = 0 ] ) further I don't know what problem it is...
  5. why he should use a table ? MTA isn't single player, you can't just use one variable for more than one player. Actually there's no need for using the event onMarkerHit and onMarkerLeave. Use one timer and loop all players in the marker and give them money. getElementColShape getElementsWithinColShape What exactly is a "colshape" and what can I do with it?
  6. It worked perfectly! This is what I got now: local moneymarker = createMarker(2505.2, -1672.5, 12, "cylinder", 5, 60, 240, 32, 200) function giveMoney(player) if getElementType(player) == "player" then theTime = setTimer (function() givePlayerMoney(player, 50) end, 10000, 0) end end addEventHandler("onMarkerHit", moneymarker, giveMoney) function killTime() if isTimer(theTime) then killTimer(theTime) end end addEventHandler("onMarkerLeave", moneymarker, killTime) Thanks for your help
  7. Thanks for your replies! I am going to try some out
  8. I mean that if you stand in a random marker, colshape or something like that, you get for example $50 every 10 seconds.
  9. Hi guys! I would like to add a timer on this script. (for example: if you stand in the marker, you get 50$ every 10 seconds.) This is my script: local moneymarker = createMarker (2505.2, -1672.5, 12, "cylinder", 2, 60, 240, 32, 200) function giveMoney(player) if getElementType(player) == "player" then givePlayerMoney(player, 10) end end addEventHandler("onMarkerHit", moneymarker, giveMoney) I'll be glad if you could help me out FIXED, THANKYOU! This is my script now: local moneymarker = createMarker(2505.2, -1672.5, 12, "cylinder", 5, 60, 240, 32, 200) function giveMoney(player) if getElementType(player) == "player" then theTime = setTimer (function() givePlayerMoney(player, 50) end, 10000, 0) end end addEventHandler("onMarkerHit", moneymarker, giveMoney) function killTime() if isTimer(theTime) then killTimer(theTime) end end addEventHandler("onMarkerLeave", moneymarker, killTime)
  10. It worked! thanks! This is my script now: local marker = createMarker(1567.3, -1609.7, 12.6, "cylinder", 2, 53, 53, 255, 255) function spawn(player) if getElementType(player) ~="player" then return end if isPedInVehicle (player) then outputChatBox ("You already are in a vehicle!") else local car1 = createVehicle(596, 1567.4, -1610.5, 14, 0, 0, 180) warpPedIntoVehicle(player, car1) end end addEventHandler("onMarkerHit", marker, spawn)
  11. Hmm I'll try those out today! Thanks for your help guys!
  12. Hi! I would like to learn how to make a simple vehicle spawner. I tried to make a marker, and if the player enters the marker, it will spawn a policecar and warp the player in the car. Also, I tried to script that if the player already is in a vehicle, nothing happens, but it does not work like I want it to... This is the script and a screenshot of what happens if a player enters. local marker = createMarker(1567.3, -1609.7, 12.6, "cylinder", 2, 53, 53, 255, 255) function spawn(player) if isPedInVehicle (player) then outputChatBox ("You already are in a vehicle!") else local car1 = createVehicle(596, 1567.4, -1610.5, 14, 0, 0, 180) warpPedIntoVehicle(player, car1) end end addEventHandler("onMarkerHit", marker, spawn) and some screenshots:
×
×
  • Create New...