Wojak
Members-
Posts
321 -
Joined
-
Last visited
-
Days Won
2
Everything posted by Wojak
-
why? function vehiclelights (player ) -- The player who triggered the command local aName = getPlayerName(player) if ( getVehicleOverrideLights ( playervehicle ) == 1) then setVehicleOverrideLights ( playervehicle, 2 ) outputChatBox ( "Vehicle Lights On" ) outputChatBox (aName.. " turns his vehicles lights on",getRootElement(), 194, 103, 181) -- = /me turns his vehicles lights on. else setVehicleOverrideLights ( playervehicle, 1 ) outputChatBox ( "Vehicle Lights Off" ) outputChatBox (aName.. " turns his vehicles lights off",getRootElement(), 194, 103, 181) -- = /me turns his vehicles lights off. end end addCommandHandler( "lights", vehiclelights )
-
Although it dos not mater, while the markers are useless, and I have to rewrite the whole thing, but I want to know, why the parameters in 'isElementWithinMarker' are invalid? (line 34 and 38) I’ve passed the data incorrectly or what? local panicped1 = createPed (79, 1601, -2620, 14 ) local panicSrange1 = createMarker(1601, -2620, 20,"cylinder",4,255,255,255,100) setElementID(panicSrange1,"shotrpanic1") local panicLrange1 = createMarker(1601, -2620, 20,"cylinder",50,255,255,255,100) setElementID(panicLrange1,"longpanic1") attachElements(panicSrange1,panicped1) attachElements( panicLrange1,panicped1) addEventHandler("onMarkerHit", getRootElement(), function(hitElement, matchingDimension) outputChatBox("hit" ) if getElementType( hitElement ) == "vehicle" then outputChatBox("veh" ) if getVehicleOccupant(hitElement) then outputChatBox("player" ) local markername = getElementID(source) local a,dontneded1 = string.find(markername, "longpanic") local b,dontneded2 = string.find(markername, "shotrpanic") if a then local panicped = getElementAttachedTo(source) if (getElementData(panicped, "pedTarget") == "non") and (getElementData(panicped, "pedStatus") == "live" ) then setElementData ( panicped, "pedTarget", "veh" ) dontWantBeDed(panicped, source, hitElement) end end if b then local panicped = getElementAttachedTo(source) if getElementData(panicped, "pedStatus") == "live" then setElementData ( aped, "pedStatus", "ded" ) dedAndBust(panicped, source, hitElement) end end end end end) function dontWantBeDed(thePed, theMarker, theVehicle) if (getElementData(thePed, "pedTarget") == "veh") and (getElementData(thePed, "pedStatus") == "live") and (isElementWithinMarker(theVehicle,theMarker)) then setPedAnimation ( thePed, "PED", "sprint_panic", -1, true, true, true) setTimer ( dontWantBeDed, 2000, 1, thePed ) elseif (getElementData(thePed, "pedTarget") == "veh") and (isElementWithinMarker(theVehicle,theMarker) == false) then setElementData ( thePed, "pedTarget", "non" ) doWotYouWant(thePed) end end function dedAndBust(thePed, theMarker, theVehicle) setPedAnimation ( thePed, "PED", "FALL_land", -1, false, true, true) setTimer (function() setElementHealth ( thePed, 100 ) setPedAnimation ( thePed, "PED", "getup_front", -1, false, true, true) setElementData ( aped, "pedStatus", "live" ) doWotYouWant(thePed) end, 5000, 1) end function doWotYouWant(thePed) if ( getElementData ( thePed, "pedStatus" ) == "live" ) and ( getElementData ( thePed, "pedTarget" ) == "non" ) then local rdmangle = math.random( 1, 359 ) setPedRotation( thePed, rdmangle ) setPedAnimation ( thePed, "PED", "WALK_gang1", -1, true, true, true) setTimer ( doWotYouWant, 8000, 1, thePed ) end end function startthisthing() local allpeds = getElementsByType ( "ped" ) for pedkey, aped in ipairs(allpeds) do setElementData ( aped, "pedTarget", "non" ) setElementData ( aped, "pedStatus", "live" ) setTimer(doWotYouWant, 1000, 1, aped) end end addEventHandler("onResourceStart", getRootElement(), startthisthing) Everything else works except: [edit] I’ve forgot passing the data at line 37 I hope that if someone will have the same problem, will use the search option
-
Although it dos not mater, while the markers are useless, and I have to rewrite the whole thing, but I want to know, why the parameters in 'isElementWithinMarker' are invalid? (line 34 and 38) I’ve passed the data incorrectly or what? local panicped1 = createPed (79, 1601, -2620, 14 ) local panicSrange1 = createMarker(1601, -2620, 20,"cylinder",4,255,255,255,100) setElementID(panicSrange1,"shotrpanic1") local panicLrange1 = createMarker(1601, -2620, 20,"cylinder",50,255,255,255,100) setElementID(panicLrange1,"longpanic1") attachElements(panicSrange1,panicped1) attachElements( panicLrange1,panicped1) addEventHandler("onMarkerHit", getRootElement(), function(hitElement, matchingDimension) outputChatBox("hit" ) if getElementType( hitElement ) == "vehicle" then outputChatBox("veh" ) if getVehicleOccupant(hitElement) then outputChatBox("player" ) local markername = getElementID(source) local a,dontneded1 = string.find(markername, "longpanic") local b,dontneded2 = string.find(markername, "shotrpanic") if a then local panicped = getElementAttachedTo(source) if (getElementData(panicped, "pedTarget") == "non") and (getElementData(panicped, "pedStatus") == "live" ) then setElementData ( panicped, "pedTarget", "veh" ) dontWantBeDed(panicped, source, hitElement) end end if b then local panicped = getElementAttachedTo(source) if getElementData(panicped, "pedStatus") == "live" then setElementData ( aped, "pedStatus", "ded" ) dedAndBust(panicped, source, hitElement) end end end end end) function dontWantBeDed(thePed, theMarker, theVehicle) if (getElementData(thePed, "pedTarget") == "veh") and (getElementData(thePed, "pedStatus") == "live") and (isElementWithinMarker(theVehicle,theMarker)) then setPedAnimation ( thePed, "PED", "sprint_panic", -1, true, true, true) setTimer ( dontWantBeDed, 2000, 1, thePed ) elseif (getElementData(thePed, "pedTarget") == "veh") and (isElementWithinMarker(theVehicle,theMarker) == false) then setElementData ( thePed, "pedTarget", "non" ) doWotYouWant(thePed) end end function dedAndBust(thePed, theMarker, theVehicle) setPedAnimation ( thePed, "PED", "FALL_land", -1, false, true, true) setTimer (function() setElementHealth ( thePed, 100 ) setPedAnimation ( thePed, "PED", "getup_front", -1, false, true, true) setElementData ( aped, "pedStatus", "live" ) doWotYouWant(thePed) end, 5000, 1) end function doWotYouWant(thePed) if ( getElementData ( thePed, "pedStatus" ) == "live" ) and ( getElementData ( thePed, "pedTarget" ) == "non" ) then local rdmangle = math.random( 1, 359 ) setPedRotation( thePed, rdmangle ) setPedAnimation ( thePed, "PED", "WALK_gang1", -1, true, true, true) setTimer ( doWotYouWant, 8000, 1, thePed ) end end function startthisthing() local allpeds = getElementsByType ( "ped" ) for pedkey, aped in ipairs(allpeds) do setElementData ( aped, "pedTarget", "non" ) setElementData ( aped, "pedStatus", "live" ) setTimer(doWotYouWant, 1000, 1, aped) end end addEventHandler("onResourceStart", getRootElement(), startthisthing) Everything else works except: [edit] I’ve forgot passing the data at line 37 I hope that if someone will have the same problem, will use the search option
-
I’ve performed some more tests and my conclusions are: -Server can attach the graphical part of the marker to a mowing element -But it can not attach the markers colshape to that element (it stays in its original creation position) -You can not hit a marker, that is within a marker (not 100% sure) and that makes it useless for my purposes... You didn’t need it to answer my question…
-
I’ve performed some more tests and my conclusions are: -Server can attach the graphical part of the marker to a mowing element -But it can not attach the markers colshape to that element (it stays in its original creation position) -You can not hit a marker, that is within a marker (not 100% sure) and that makes it useless for my purposes... You didn’t need it to answer my question…
-
I wanted to use markers as sensors for peds, but when I hit the attached markers nothing happens (MTA dos not detect it) Hitting the markers that aren’t attached triggers the function… My question is: Is this normal? If MTA cant detect hitting attached markers, I will try to find a nether way (the script is server side )
-
I wanted to use markers as sensors for peds, but when I hit the attached markers nothing happens (MTA dos not detect it) Hitting the markers that aren’t attached triggers the function… My question is: Is this normal? If MTA cant detect hitting attached markers, I will try to find a nether way (the script is server side )
-
function Arrest(Spieler, Befehl, Mitspieler) local team = getPlayerTeam(Spieler) local name = getPlayerFromName(Mitspieler) if team == lspd then if PlayerToPoint(Spieler, 3, 268, 77, 1001) then -- this part is unnecessary: local element = getElementType(name) if name then --this should do local player = getPlayerName(name) -- 'element' to 'name' local level = getPlayerWantedLevel(name) --'element' to 'name' if level > 0 then setElementInterior(player, 6, 265, 77, 1002) else outputChatBox("Dieser Spieler ist nicht gesucht", Spieler) end else outputDebugString("Es befindet sich ein Fehler in der Abfrage Element") end else outputChatBox("Du befindest dich nicht im PD.", Spieler) end else outputChatBox("Du bst kein Polizist.", Spieler ) end end addCommandHandler("arrest", Arrest) hope it will work
-
to fix this problem your line 43 should look like this: if (source == theEndMarker) and (hitPlayer == getLocalPlayer() ) then
-
i know this is not perfect, but it should work function getwanted() setTimer(dely, 100, 1) local players = getElementsByType ( "player" ) for theKey,thePlayer in ipairs(players) do local level = getPlayerWantedLevel ( thePlayer ) setElementData ( thePlayer, "wanted", level ) end end function dely() getwanted() end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), getwanted )
-
you missing '=' at line 8 local px, py, pz = getElementPosition(thePlayer) he deleted a space But i agre: debugger is you friend
-
Hmm, in that case I had a strange bug: I created a marker, that create a different marker in a different place, when I hit it, and it was creating that marker over and over while I was in it… I had to add some conditions to fix it… anyway I think I can help with CallumD’s problem, although I did not seen his script local youmarker = createMarker ( youx, youy, youz, "youtype", yousize ) function youMarkerHit() if getElementType(hitPlayer)=="player" and source == youmarker then if isoYouObjectMoving == nil then isoYouObjectMoving = 1 YOU_ARE_MOVING_THE_OBIECT_HERE setTimer( function() isoYouObjectMoving = nil end, The_time_in_milliseconds_the_object_will_arrive_at_the_destination ,1) end end end addEventHandler("onMarkerHit", getRootElement (), youMarkerHit) if you use it, the marker will not work while the object is moving (I think there is your problem)
-
The problem with onMarkerHit is, that while you are in the marker, the event is triggered on every frame. If you stay in the marker 1 second the event may be triggered up to 50 times depending on the server frame limiter… The longer you stay in the marker, the bigger will be the rotation offset. It works on the local server, because there is no lag there (or the lag is minimal) But I may be wrong
-
Hmm… but if you have your mind (don’t enter the building) and go back for example to your car, it will teleport you to interior, when you will try to enter the car by pressing ‘f’
-
than remove all other maps for deathmatch
-
setting or starting? you do it the same way add: to deathmatch meta.xml file...
-
add to MTA:SA/server/mods/mtaserver.conf or, if you want to do it for yours map only, add to yours map meta.xml file
-
.lua files are not a map files, those are script files (probably a script that replaces some objects). Race resource needs a .map file (that at least contains one race spawn point) to lunch the map… of course you also need a meta.xml file…
-
It was possible in old map editor, but I cant find this potion in this editor… Currently I have to edit the map file manually to make the vehicle change checkpoint, and that sucks… Will there be such option in some next relies?
-
I want to disable collision only for first 30 seconds, after the map starts, the races with no collisions are boring, but the start in the race mode is a killer… edit: Ok. problems solved. DaK gave me an idea how to bypass the first problem Thanks DaK as for the second problem, I’ve add a triggerclientevent line to the race resource. Now everything works like I want to, but I’ll be 100% sure after the public test…
-
I have wrote this client side script: local ncPla = getLocalPlayer ( ) function dela() setTimer ( nocol, 5000, 1 ) outputConsole("1") end function nocol() local vehcol = getPedOccupiedVehicle ( ncPla ) outputConsole("2") setElementCollisionsEnabled(vehcol, false) setElementAlpha(vehcol, 125) outputConsole("3") setTimer ( colon, 30000, 1 ) outputConsole("4") end function colon() local vehcol = getPedOccupiedVehicle ( ncPla ) outputConsole("5") setElementCollisionsEnabled(vehcol, true) setElementAlpha(vehcol, 255) outputConsole("6") end addEventHandler ( "onClientPlayerSpawn", getRootElement(), dela ) The problem is: when the collision is turned off, the gravity is set to 0 (the vehicle is flying). How to fix this bug? When the collision and alpha are back to normal, the gravity is set to normal ass well… And the other thing: I want this script to be executed after the race countdown displays GO. Is there a way to do that without editing race resource?