Jump to content

Need Some Help :/


joao1234

Recommended Posts

Hey im trying to make an event system, but when i type /event (the command to create the event marker) it executes the else part..

  
function marker ( thePlayer, commandName ) 
    if ( getElementType(thePlayer) == "player" ) then 
        if ( getPlayerTeam (thePlayer) == "Staff" ) then 
            local x, y, z = getElementPosition ( thePlayer ) 
            markerevento = createMarker ( x + 2, y + 2, z - 1, "cylinder", 1.5, 255, 0, 0, 170 ) 
            blip = createBlipAttachedTo ( markerevento, 49, 1 ) 
            dim = getElementDimension ( thePlayer )          
            int = getElementInterior( thePlayer )  
            setElementDimension ( markerevento, dim ) 
            setElementInterior ( markerevento, int ) 
            outputChatBox ( "#00FF00An event has just been created use #FF0000/eventwarp #00FF00now!", getRootElement(), 255, 255, 255, true ) 
        else 
            outputChatBox ( "Event cannot be created :/", thePlayer )  
        end 
    end 
end 
addCommandHandler ( "event", marker ) 
  

Link to comment
function marker ( thePlayer, commandName ) 
    if ( getElementType(thePlayer) == "player" ) then 
        if ( getPlayerTeam (thePlayer) == getTeamFromName ( "Staff" ) ) then 
            local x, y, z = getElementPosition ( thePlayer ) 
            markerevento = createMarker ( x + 2, y + 2, z - 1, "cylinder", 1.5, 255, 0, 0, 170 ) 
            blip = createBlipAttachedTo ( markerevento, 49, 1 ) 
            dim = getElementDimension ( thePlayer )         
            int = getElementInterior( thePlayer ) 
            setElementDimension ( markerevento, dim ) 
            setElementInterior ( markerevento, int ) 
            outputChatBox ( "#00FF00An event has just been created use #FF0000/eventwarp #00FF00now!", getRootElement(), 255, 255, 255, true ) 
        else 
            outputChatBox ( "Event cannot be created :/", thePlayer ) 
        end 
    end 
end 
addCommandHandler ( "event", marker ) 

Link to comment

== Server Side ==

function marker ( thePlayer, commandName ) 
    if ( getElementType(thePlayer) == "player" ) then 
          local team = getPlayerTeam (thePlayer) 
      if ( team and getTeamName ( team ) == "Staff" ) then 
            local x, y, z = getElementPosition ( thePlayer ) 
            markerevento = createMarker ( x + 2, y + 2, z - 1, "cylinder", 1.5, 255, 0, 0, 170 ) 
            blip = createBlipAttachedTo ( markerevento, 49, 1 ) 
            dim = getElementDimension ( thePlayer )          
            int = getElementInterior( thePlayer )  
            setElementDimension ( markerevento, dim ) 
            setElementInterior ( markerevento, int ) 
            outputChatBox ( "#00FF00An event has just been created use #FF0000/eventwarp #00FF00now!", getRootElement(), 255, 255, 255, true ) 
        else 
            outputChatBox ( "Event cannot be created :/", thePlayer )  
        end 
    end 
end 
addCommandHandler ( "event", marker ) 
  
Link to comment
Both last answers are the same as Castro's code.

They'rlittle bit different

  
        if ( getPlayerTeam (thePlayer) == getTeamFromName ( "Staff" ) ) then 
  

  
          local team = getPlayerTeam (thePlayer) 
      if ( team and getTeamName ( team ) == "Staff" ) then 
  
Link to comment

Well after that i made more code..

but when i try to create the marker it executes the first 2 functions at the same time :/

  
function marker ( thePlayer, commandName ) 
    if ( getElementType(thePlayer) == "player" ) then 
          local team = getPlayerTeam (thePlayer) 
      if ( team and getTeamName ( team ) == "Staff" ) then 
            local x, y, z = getElementPosition ( thePlayer ) 
            markerevento = createMarker ( x + 2, y + 2, z - 1, "cylinder", 1.5, 255, 0, 0, 170 ) 
            blip = createBlipAttachedTo ( markerevento, 49, 1 ) 
            dim = getElementDimension ( thePlayer )          
            int = getElementInterior( thePlayer )  
            setElementDimension ( markerevento, dim ) 
            setElementInterior ( markerevento, int ) 
            outputChatBox ( "#00FF00An event has just been created use #FF0000/eventwarp #00FF00now!", getRootElement(), 255, 255, 255, true ) 
        else 
            outputChatBox ( "Event cannot be created  Maybe u aren't a Staff or is another error.", thePlayer )  
        end 
    end 
end 
addCommandHandler ( "event", marker ) 
  
function markerON () 
    if ( markerevento ) then 
        if isElement( markerevento ) then 
            outputChatBox ( "An event is created, you can't create another one..", thePlayer, 255, 255, 255, true ) 
        end 
    end 
end 
addCommandHandler ( "event", markerON ) 
  
function markerOFF () 
    if ( markerevento ) then 
        if isElement( markerevento ) then 
            destroyElement( markerevento ) markerevento = nil 
            end 
            if isElement(blip) then  
                destroyElement(blip) blip = nil  
            end          
        outputChatBox ( "Event is closed.", thePlayer, 255, 255, 255, true ) 
    end 
end 
addCommandHandler ( "eventclose", markerOFF ) 
  

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