Jump to content

Lock this


Error123

Recommended Posts

Well i made this script and i blowed every thing, i want to set the PilotVehMark visible only to Pilot team but i failed( and so many bugs in the command...

Help me to fix the bugs and to set PilotVehMark visible to only who is in "Pilot" team.

Private 

Edited by Guest
Link to comment
local pilotMark = createMarker(1711.1593017578, 1615.5653076172, 9, "cylinder", 2, 255, 255, 0, 255) 
local pilotBlip = createBlipAttachedTo(pilotMark, 56) 
local pilotped = createPed(61, 1711.1593017578, 1615.5653076172, 10, 252.005493) 
local teamPilot = createTeam("Pilot", 255, 255, 0) 
local pilotVehMark = createMarker(1719.3674316406, 1612.0157470703, 8.5, "cylinder", 1.75, 255, 255, 0, 255) 
setElementFrozen(pilotped, true) 
  
addEventHandler("onMarkerHit", root, 
    function(hitElement, matchingDimension) 
        if getElementType(hitElement) == "player" and matchingDimension then 
            if source == pilotMark then 
                if isPedInVehicle(hitElement) then return end 
                setElementModel(hitElement, 61) 
                setPlayerTeam(hitElement, teamPilot) 
            elseif source == pilotVehMark then 
                if getTeamName(getPlayerTeam(hitElement)) == "Pilot" then 
                    local x, y, z = getElementPosition(hitElement) 
                    local pilotVeh = createVehicle(583, x - 3, y + 2, z + 0.5) 
                    if isPedInVehicle(hitElement) then 
                        removePedFromVehicle(hitElement) 
                    end 
                    warpPedIntoVehicle(hitElement, pilotVeh) 
                    outputChatBox("Vehicle spawned.", hitElement, 0, 153, 0, false)    
                end 
            end 
        end 
    end 
) 

Link to comment

Are you serious...?

local pilotMark = createMarker(1711.1593017578, 1615.5653076172, 9, "cylinder", 2, 255, 255, 0, 255) 
local pilotBlip = createBlipAttachedTo(pilotMark, 56) 
local pilotped = createPed(61, 1711.1593017578, 1615.5653076172, 10, 252.005493) 
local teamPilot = createTeam("Pilot", 255, 255, 0) 
local pilotVehMark = createMarker(1719.3674316406, 1612.0157470703, 8.5, "cylinder", 1.75, 255, 255, 0, 255) 
setElementFrozen(pilotped, true) 
  
addEventHandler("onMarkerHit", root, 
    function(hitElement, matchingDimension) 
        if getElementType(hitElement) == "player" and matchingDimension then 
            if source == pilotMark then 
                if isPedInVehicle(hitElement) then return end 
                setElementModel(hitElement, 61) 
                setPlayerTeam(hitElement, teamPilot) 
            elseif source == pilotVehMark then 
                if getTeamName(getPlayerTeam(hitElement)) == "Pilot" then 
                    local x, y, z = getElementPosition(hitElement) 
                    local pilotVeh = createVehicle(583, x - 3, y + 2, z + 0.5) 
                    if isPedInVehicle(hitElement) then 
                        removePedFromVehicle(hitElement) 
                    end 
                    warpPedIntoVehicle(hitElement, pilotVeh) 
                    outputChatBox("Vehicle spawned.", hitElement, 0, 153, 0, false)   
                end 
            end 
        end 
    end 
) 
  
addEventHandler("onPlayerJoin", root, 
    function() 
        for _, player in ipairs(getElementsByType("player")) do 
            setElementVisibleTo(pilotMark, player, false) 
        end 
  
        for _, player in ipairs(getPlayersInTeam(teamPilot)) do 
            setElementVisibleTo(pilotMark, player, true) 
        end 
    end 
) 

Link to comment

Well perhaps you could change the code by yourself? We are not making scripts for you.

local pilotMark = createMarker(1711.1593017578, 1615.5653076172, 9, "cylinder", 2, 255, 255, 0, 255) 
local pilotBlip = createBlipAttachedTo(pilotMark, 56) 
local pilotped = createPed(61, 1711.1593017578, 1615.5653076172, 10, 252.005493) 
local teamPilot = createTeam("Pilot", 255, 255, 0) 
local pilotVehMark = createMarker(1719.3674316406, 1612.0157470703, 8.5, "cylinder", 1.75, 255, 255, 0, 255) 
setElementFrozen(pilotped, true) 
  
addEventHandler("onMarkerHit", root, 
    function(hitElement, matchingDimension) 
        if getElementType(hitElement) == "player" and matchingDimension then 
            if isPedInVehicle(hitElement) then return end 
            if not getElementData(hitElement, "pilot.on-duty") then 
                if source == pilotMark then 
                    setElementModel(hitElement, 61) 
                    setPlayerTeam(hitElement, teamPilot) 
                    setElementData(hitElement, "pilot.on-duty", true, true) 
                elseif source == pilotVehMark then 
                    if getTeamName(getPlayerTeam(hitElement)) == "Pilot" then 
                        local x, y, z = getElementPosition(hitElement) 
                        local pilotVeh = createVehicle(583, x - 3, y + 2, z + 0.5) 
                        warpPedIntoVehicle(hitElement, pilotVeh) 
                        outputChatBox("Vehicle spawned.", hitElement, 0, 153, 0, false)   
                        setElementData(hitElement, "pilot.on-duty", true, true) 
                    end 
                end 
            end 
        end 
    end 
) 
  
addEventHandler("onPlayerJoin", root, 
    function() 
        for _, player in ipairs(getElementsByType("player")) do 
            setElementVisibleTo(pilotMark, player, false) 
        end 
  
        for _, player in ipairs(getPlayersInTeam(teamPilot)) do 
            setElementVisibleTo(pilotMark, player, true) 
        end 
    end 
) 

Link to comment

whats exactly changed?

it's spawns two vehicles and more and more each time i enter the vehicle look , i editted it

Private 

now i thank you for helping me to script this, but something i want it fixed,i want the Marker that spawn Tug be invisible, visible only for who are in Pilot Team, well now it don't work if you are not in pilot team, but i want it invisible maybe setElementAlpha, well give me a suggest, and thanks for all.

Edited by Guest
Link to comment
  
function resetData() 
local account = getPlayerAccount(source) 
setAccountData(account, "spawned", "0") 
end 
  
addEventHandler("onPlayerLogin", root, resetData) 
  

  
local account = getPlayerAccount(source) 
if(tostring(getAccountData(account, "spawned"))=="0") then 
setAccountData(account, "spawned", "1") 
-- Spawn code here 
else 
outputChatBox("Sorry, you can't spawn more than 1 vehicle.", source, 255, 0, 0, true) 
end 
  

Pilot team marker

  
addEventHandler("onPlayerSpawn", getRootElement(), 
    function() 
        for _, player in ipairs(getElementsByType("player")) do 
            setElementVisibleTo(pilotMark, player, false) 
        end 
  
        for _, player in ipairs(getPlayersInTeam(teamPilot)) do 
            setElementVisibleTo(pilotMark, player, true) 
        end 
    end 
) 
  

Edited by Guest
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...