SkullBreaker
Members-
Posts
34 -
Joined
-
Last visited
Everything posted by SkullBreaker
-
Worked! Thanks!
-
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
-
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!
-
[HELP] givePlayerMoney onMarkerHit with timer
SkullBreaker replied to SkullBreaker's topic in Scripting
[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! -
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...
-
[HELP] givePlayerMoney onMarkerHit with timer
SkullBreaker replied to SkullBreaker's topic in Scripting
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? -
[HELP] givePlayerMoney onMarkerHit with timer
SkullBreaker replied to SkullBreaker's topic in Scripting
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 -
[HELP] givePlayerMoney onMarkerHit with timer
SkullBreaker replied to SkullBreaker's topic in Scripting
Thanks for your replies! I am going to try some out -
[HELP] givePlayerMoney onMarkerHit with timer
SkullBreaker replied to SkullBreaker's topic in Scripting
I mean that if you stand in a random marker, colshape or something like that, you get for example $50 every 10 seconds. -
[HELP] givePlayerMoney onMarkerHit with timer
SkullBreaker replied to SkullBreaker's topic in Scripting
Works! thanks! but how to make it on a timer? -
[HELP] givePlayerMoney onMarkerHit with timer
SkullBreaker replied to SkullBreaker's topic in Scripting
doesn't work and what happened to the timer? -
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)
-
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)
-
Hmm I'll try those out today! Thanks for your help guys!
-
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:
-
It's solved! Anyway thanks if you read this!
-
It was probably the "Moveobject", now I have: local gate = createObject ( 980, 1366.9, -1401.6, 15.2, 0, 0, 89.75 ) local marker = createMarker ( 1366.6, -1402.6, 13.0, "cylinder", 25, 200, 50, 0, 0 ) addEventHandler( "onMarkerHit", marker, function() moveObject(gate, 5000, 1366.9, -1401.6, 9 ) end ) addEventHandler( "onMarkerLeave", marker, function() moveObject(gate, 5000, 1366.9, -1401.6, 15.2 ) end )
-
I've made this script for a gate with a marker. When I enter the marker, the gate opens. But when I leave the marker, it does not close the gate. This is my script: local gate = createObject ( 980, 1366.9, -1401.6, 15.2, 0, 0, 89.75 ) local marker = createMarker ( 1366.6, -1402.6, 13.0, "cylinder", 25, 200, 50, 0, 0 ) addEventHandler( "onMarkerHit", marker, function() moveObject(gate, 5000, 1366.9, -1401.6, 9 ) end ) addEventHandler( "onMarkerLeave", marker, function() Moveobject (gate, 5000, 1366.9, -1401.6, 15.2 ) end ) I personally cannot see what the problem is, so it would be really helpful if someone can help me out! Thanks!
-
Thanks
-
Hi guys. I want to make a script that if a vehicle is destroyed, it disappears. I know that I probably have to use: addEventHandler ( "onVehicleExplode" ) function vehdisappear ( ) destroyElement Could anyone help me out with this? Thanks
-
Wow.... This was what I was looking for, huge thanks man!
-
Thanks
-
Well, great, I suck at GUI
-
Hi guys! I would like a GUI which pop-ups when you hit a marker, and then you can choose a few different vehicles. So far I got this: local marker = createMarker( 688.8, -1344.7, 12, "cylinder", 2, 0, 0, 255, 255 ) function spawnENF ( hitElement, matchingDimension ) if ( getElementType ( hitElement ) == "player" ) then if ( not isPedInVehicle ( hitElement ) ) then local x, y, z = getElementPosition ( hitElement ) local ENF = createVehicle ( 427, x, y, z + 1, 0, 0, 180 ) warpPedIntoVehicle ( hitElement, ENF ) else outputChatBox ( "You already got a vehicle!" ) end end end addEventHandler ( "onMarkerHit", marker, spawnENF ) (This will only spawn one enforcer....)
-
Still the same error, this time on line 15 and 24..