Estevam2d Posted September 30, 2014 Share Posted September 30, 2014 I need to use to have a working firefighter ? Link to comment
Mr_Moose Posted September 30, 2014 Share Posted September 30, 2014 Take a look at these functions: createFire -- To make a realistic client side fire getElementPosition -- Detect how far away you are from this fire getPedControlState -- Detect if the fireman is working givePlayerMoney -- Pay the fireman, after successful work? Link to comment
Einheit-101 Posted September 30, 2014 Share Posted September 30, 2014 Forget is, as long as "fire" is not an even element. You can retrieve nothing, not even whether the fire is existing or not. Link to comment
Estevam2d Posted September 30, 2014 Author Share Posted September 30, 2014 Has two problems. The first is fire created goes out with little time. The second problem is that when I use the fire extinguisher against the fire did not get anything onClientPlayerTarget should I use? I intend to put this scripture to download. without being compiled. there is nothing similar in mtasa community. will be a simple scripture. Link to comment
Estevam2d Posted September 30, 2014 Author Share Posted September 30, 2014 Galera, worked with object but not with fire. But all I backrest that is the object makes me earn money. sorry help addEventHandler ("onClientGUIClick", getRootElement(), function(hitElement, theSize) if (source == GUIEditor_Button[1]) then if guiRadioButtonGetSelected(radioButton1) == true then fireElem = createObject(2023, 2488.354, -1671.3, 12.336) end end end ) function targetingActivated ( fire ) if (fire) then if (getPedWeapon (localPlayer) ~= 42) then return end outputChatBox(tostring(getElementType(fire))) if (fire) then end givePlayerMoney ( 70 ) destroyElement (fireElem) end end addEventHandler ( "onClientPlayerTarget", getRootElement(), targetingActivated ) Link to comment
Tails Posted September 30, 2014 Share Posted September 30, 2014 Make the object invisible, and make a fire with createEffect near the object. Then destroy the effect when you hit the object. It could work but there are many ways to do this I'm sure Link to comment
Estevam2d Posted September 30, 2014 Author Share Posted September 30, 2014 50% solved, but now the problem that if I hold the right mouse button and I'm making money without stopping. I am immensely happy for the tip of the create Effect addEventHandler ("onClientGUIClick", getRootElement(), function(hitElement, theSize) if (source == GUIEditor_Button[1]) then if guiRadioButtonGetSelected(radioButton1) == true then fires = createFire(2493.792, -1667.981, 13.344) fire = createEffect("fire", 2493.792, -1667.981, 13.344) end end end ) function wastedMessagee (hitElement) if (fire) then if weapon == 42 then return end outputChatBox ( "test", hitElement ) destroyElement (fire) givePlayerMoney ( 70 ) end end addEventHandler ( "onClientPlayerWeaponFire", getLocalPlayer(), wastedMessagee ) Link to comment
Tails Posted September 30, 2014 Share Posted September 30, 2014 (edited) No probs. I'll look into creating a new function for extinguishable fires like that. I'll let you know about it if I can get it to work. Edited October 1, 2014 by Guest Link to comment
Moderators IIYAMA Posted September 30, 2014 Moderators Share Posted September 30, 2014 Galera, worked with object but not with fire. But all I backrest that is the object makes me earn money. sorry help Then use a replaced object. (and disabled the collision) or create effects. Possibility's enough, good luck. Link to comment
Estevam2d Posted October 1, 2014 Author Share Posted October 1, 2014 oh thanks Now the problem is that I do not know how that one is marked ensencial to earn money. I hope you understand me You can only make money if you stay for a while in the cylinder. Observation: -- Error: How to identify if the player really on this cylinder to get the money? local markerer = createMarker ( 2024.114, -1702.907, 17.369, "cylinder", 3.0, 255, 255, 255,50.1 ) function Lixeirojob(hitElement) if getElementType(hitElement) == "player" and (hitElement == localPlayer) then destroyElement (markerer) triggerServerEvent ( "receber", localPlayer ) exports.killmessages:outputMessage("*Bombeiro acaba de salvar uma casa.", root, 10, 118, 240, true) end end addEventHandler("onClientMarkerLeave", markerer, Lixeirojob) function detonatorAction (key, attacker) if (fire) then if (getPedWeapon (localPlayer) ~= 42) then return end if ( getElementType ( target ) == "fire" ) then blowVehicle ( target ) end if isElement ( hitElement ) and getElementType(hitElement) == "Marker" then -- Error: How to identify if the player really on this cylinder to get the money? setTimer ( function() outputChatBox ("**Agora afaste-se do lugar do acidente para receber sua grana.", 255, 255, 0) destroyElement (fire) destroyElement (blipsbombeiro) end, 2000, 1 ) if (fire) then for control in pairs (getBoundControls(key)) do setControlState (control, true) end end end end bindKey ("lctrl", "down", detonatorAction) I want to use something like this "markerer" if isElement ( hitElement ) and getElementType(hitElement) == "Marker" then Link to comment
Mr_Moose Posted October 1, 2014 Share Posted October 1, 2014 You can check that an element still is inside the marker with this function, the "source" of your "onMarkerHit" event is the marker element you pass as argument into this function. bool isElementWithinMarker ( element theElement, marker theMarker ) Link to comment
h7gus Posted January 24, 2015 Share Posted January 24, 2015 (edited) ... Edited February 22, 2015 by Guest Link to comment
Einheit-101 Posted January 28, 2015 Share Posted January 28, 2015 How do you want to create this as long as it is impossible to retrieve if you hit the fire with water or not? Link to comment
Tails Posted January 30, 2015 Share Posted January 30, 2015 How do you want to create this as long as it is impossible to retrieve if you hit the fire with water or not? You can do it with colshapes, effects and onVehicleWeaponFire or OnClientWeaponFire. I'm sure any experienced lua programmer can pull this off easily. I've tried it before but I couldn't do it, but that's only because I have a very limited knowledge of lua. H7gus, try asking Solidsnake, one of the mods of this forum. I'm sure he can do it for you for a small price. Link to comment
Einheit-101 Posted January 30, 2015 Share Posted January 30, 2015 No matter how you do it, it won't be precise. Ofc you could calculate the angle between the cannon and the fire but you don't know if you really hit the fire. You WILL see weird issues. Link to comment
Tails Posted February 7, 2015 Share Posted February 7, 2015 They got this working in SA-MP and it's pretty dang accurate. Not sure how they did it though, but it looked like just regular fire. Link to comment
Moderators IIYAMA Posted February 8, 2015 Moderators Share Posted February 8, 2015 You may not be able to check it 100%, but you can always create an overwrite to solve the problem. Link to comment
Einheit-101 Posted February 17, 2015 Share Posted February 17, 2015 You should keep in mind that SAMP still offers some functions that don't exist in MTA so they probably can do this without any problem. But MTA lacks some fire functions and events. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now