Jump to content

Problem


tim260

Recommended Posts

this was working before and now not anymore :S can someone please help me. and explain me what i did wrong not just post the solution and type try this :P

fixmarker = createMarker(-2053.4602050781, 170.26126098633, 29.102718353271, 'cylinder', 4.0, 255, 255, 0, 75) 
fixmarker2 = createMarker(-2053.4973144531, 178.64505004883, 29.102718353271, 'cylinder', 4.0, 255, 255, 0, 75) 
vehicles = getElementsByType ( "vehicle" ) 
setElementAlpha ( fixmarker, 0 ) 
setElementAlpha ( fixmarker2, 0 ) 
for vehicleKey, vehicleValue in ipairs">ipairs(vehicles) do 
  
function fix(thePlayer) 
local redteam = getTeamFromName ( "Sierra Towing Inc." ) 
 if isElementWithinMarker( thePlayer, fixmarker) or isElementWithinMarker( thePlayer, fixmarker2) and ( redteam ) then  
    fixVehicle ( vehicleValue ) 
    elseif not ( redteam ) then  
        outputChatBox("You are not in the sierra team !", thePlayer, 255, 0, 0) 
    elseif not isElementWithinMarker( thePlayer, fixmarker) or isElementWithinMarker( thePlayer, fixmarker2) then  
        outputChatBox("You are not withing a sierra workshop !", thePlayer, 255, 0, 0) 
        end 
    end 
end  
addCommandHandler("fix", fix) 
  

Link to comment

Can you specify the version in wich was working ?

1. vehicleValue isn't specified.

2. You can make like this :

  
local team = getPlayerTeam() 
if isElementWithinMarker( thePlayer, fixmarker) or isElementWithinMarker( thePlayer, fixmarker2) then 
if ( team == "Sierra Towing Inc.") then 
--code 
else -- Here is when we get the team 
--code 
else -- Here is when we get if the player is in marker 
--code 
  

Hope i helped :)

Link to comment

your code had some mess

  
fixmarker = createMarker(-2053.4602050781, 170.26126098633, 29.102718353271, 'cylinder', 4.0, 255, 255, 0, 75) 
fixmarker2 = createMarker(-2053.4973144531, 178.64505004883, 29.102718353271, 'cylinder', 4.0, 255, 255, 0, 75) 
if fixmarker and fixmarker2 then 
setElementAlpha ( fixmarker, 0 ) 
setElementAlpha ( fixmarker2, 0 ) 
end 
  
function fix ( player ) 
    local redteam = getTeamFromName ( "Sierra Towing Inc." ) ---- get the sierra team 
    local playerteam = getPlayerTeam( player ) -- get the player who wrote the command team 
 ---   local playercar = getPedOccupiedVehicle ( player ) -- get the player who wrote the command car 
    if redteam and redteam == playerteam then -- if got the sierra team and its the player who wrote the command team then 
        if isElementWithinMarker( player, fixmarker) or isElementWithinMarker( player, fixmarker2) then -- if the player inside the marker then 
            for _,playercar in ipairs ( getElementsByType("vehicle") ) do 
                fixVehicle ( playercar ) -- fix it 
             
            end 
        else -- else if he is not in the marker 
            outputChatBox("You are not withing a sierra workshop !", player, 255, 0, 0) 
        end 
    else -- else if he is not in the sierra team or it is not exsisted 
        outputChatBox("You are not in the sierra team !", player, 255, 0, 0) 
    end 
end 
addCommandHandler("fix", fix) 
  

* there is bug in lua tag

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