Jump to content

firefighter


Estevam2d

Recommended Posts

Posted

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? 

Posted

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.

Posted

Galera, worked with object but not with fire.

But all I backrest that is the object makes me earn money.

sorry help :roll:

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 ) 

Posted

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

Posted

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 :P

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 ) 

Posted (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 by Guest
Posted

oh thanks :D

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 
  

Posted

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 ) 

  • 3 months later...
Posted
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.

Posted

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.

Posted

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.

  • Moderators
Posted

You may not be able to check it 100%, but you can always create an overwrite to solve the problem.

  • 2 weeks later...
Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...