Jump to content

Destroy Vehicle!


Recommended Posts

--giveVehicle 
addEvent("AdminPanel.giveVehicle", true) 
function giveVehicle(plr, getText) 
    outputChatBox("#FF0000" ..getPlayerName(source).."#00FF00 Te ha dado un Vehiculo #0B00FF("..getText..") ", plr, r, g, b, true) 
    outputChatBox("#00FF00Has dado a #FF0000" ..getPlayerName(plr).."#00FF00 Un Vehiculo #0B00FF(" ..getText..") ", source, r, g, b, true) 
    if (not isElement(plr)) then return end 
    if (isPedInVehicle(plr)) then 
        outputChatBox("#00FF00Ya en un vehiculo", source, 225, 0, 0) 
    else 
        local veh 
        local x, y, z = getElementPosition(plr) 
        local rx, ry, rz = getElementRotation(plr) 
        if (getVehicleModelFromName(getText)) then 
            veh = createVehicle(getVehicleModelFromName(getText), x, y, z + 3) 
        else 
            veh = createVehicle(getText, x, y, z + 3) 
                end 
        if (veh) then 
            warpPedIntoVehicle(plr, veh) 
            setElementRotation(veh, 0, 0, rz) 
        end 
       end 
end 
addEventHandler("AdminPanel.giveVehicle", root, giveVehicle)  

Edited by Guest
Link to comment
     --giveVehicle 
    addEvent("AdminPanel.giveVehicle", true) 
    function giveVehicle(plr, getText) 
        outputChatBox("#FF0000" ..getPlayerName(source).."#00FF00 Te ha dado un Vehiculo #0B00FF("..getText..") ", plr, r, g, b, true) 
        outputChatBox("#00FF00Has dado a #FF0000" ..getPlayerName(plr).."#00FF00 Un Vehiculo #0B00FF(" ..getText..") ", source, r, g, b, true) 
        if (not isElement(plr)) then return end 
        if (isPedInVehicle(plr)) then 
            outputChatBox("#00FF00Ya en un vehiculo", source, 225, 0, 0) 
        else 
            local veh 
            local x, y, z = getElementPosition(plr) 
            local rx, ry, rz = getElementRotation(plr) 
            if (getVehicleModelFromName(getText)) then 
                veh = createVehicle(getVehicleModelFromName(getText), x, y, z + 3) 
                setElementData(veh,"spawner",plr) 
            else 
                veh = createVehicle(getText, x, y, z + 3) 
                setElementData(veh,"spawner",plr) 
                    end 
            if (veh) then 
                warpPedIntoVehicle(plr, veh) 
                setElementRotation(veh, 0, 0, rz) 
            end 
           end 
    end 
    addEventHandler("AdminPanel.giveVehicle", root, giveVehicle)  
     
     
function removeVeh() 
for i,v in pairs(getElementsByType("vehicle",resourceRoot) do 
if getElementData(v,"spawner") == source then 
destroyElement(v) 
end 
end 
end 
  
addEventHandler ( "onPlayerWasted", getRootElement(), removeVeh ) 
addEventHandler ( "onPlayerQuit", getRootElement(), removeVeh ) 

Link to comment

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...