Jump to content

I need to correct codes


ahmed1010

Recommended Posts

correct this code and i want it to open without button

    Team = "ahmed1010" 
    local Object = createObject ( ID, x, y, z, rx, ry, rz ) 
    local Marker = createMarker ( -11.482395172119, 2071.0393066406, 17.4921875, "cylinder", size, 0, 0, 0, 80 ) 
      
    function OpenObject ( player ) 
        if isElementWithinMarker ( player, Marker ) then 
            if ( getTeamName( getPlayerTeam( player ) ) == Team ) then 
                if not Open then 
                    moveObject ( Object, 1500, moveX, moveY, moveZ ) 
                else 
                    moveObject ( Object, 1500, x, y, z ) 
                end 
                Open = not Open 
            else 
                outputChatBox ( "* You aren't in ["..Team.."] team !", player, 200, 0, 0, true ) 
            end 
        end 
    end 
      
    addEventHandler ( "onResourceStart", resourceRoot, 
        function ( ) 
            for _, v in ipairs ( getElementsByType ( "player" ) ) do 
                bindKey ( v, "tab", "down", OpenObject ) 
            end 
        end 
    ) 
      
    addEventHandler ( "onPlayerJoin", root, 
        function ( ) 
            bindKey ( source, "tab", "down", OpenObject ) 
        end 
    ) 

Link to comment

seems its not your code but here

   Team = "ahmed1010" 
    local Object = createObject ( ID, x, y, z, rx, ry, rz ) 
    local Marker = createMarker ( -11.482395172119, 2071.0393066406, 17.4921875, "cylinder", size, 0, 0, 0, 80 ) 
      
    function OpenObject ( player ) 
        if isElementWithinMarker ( player, Marker ) then 
            if ( getTeamName( getPlayerTeam( player ) ) == Team ) then 
                if not Open then 
                    moveObject ( Object, 1500, moveX, moveY, moveZ ) 
                else 
                    moveObject ( Object, 1500, x, y, z ) 
                end 
                Open = not Open 
            else 
                outputChatBox ( "* You aren't in ["..Team.."] team !", player, 200, 0, 0, true ) 
            end 
        end 
    end 
      
    addEventHandler ( "onResourceStart", getRootElement(), OpenObject ) 

What do you mean by "correct" this code? you have to say what you want to be edited or whats your errors?

Link to comment
seems its not your code but here
   Team = "ahmed1010" 
    local Object = createObject ( ID, x, y, z, rx, ry, rz ) 
    local Marker = createMarker ( -11.482395172119, 2071.0393066406, 17.4921875, "cylinder", size, 0, 0, 0, 80 ) 
      
    function OpenObject ( player ) 
        if isElementWithinMarker ( player, Marker ) then 
            if ( getTeamName( getPlayerTeam( player ) ) == Team ) then 
                if not Open then 
                    moveObject ( Object, 1500, moveX, moveY, moveZ ) 
                else 
                    moveObject ( Object, 1500, x, y, z ) 
                end 
                Open = not Open 
            else 
                outputChatBox ( "* You aren't in ["..Team.."] team !", player, 200, 0, 0, true ) 
            end 
        end 
    end 
      
    addEventHandler ( "onResourceStart", getRootElement(), OpenObject ) 

What do you mean by "correct" this code? you have to say what you want to be edited or whats your errors?

error do not open

Link to comment
Give me the correct code.

your code this messy start the right way good luck.

local Object = createObject ( 3344, -11.482395172119, 2071.0393066406, 17.4921875, -11.482395172119, 2071.0393066406, 17.4921875) 
local Marker = createMarker ( -11.482395172119, 2071.0393066406, 17.4921875, "cylinder", size, 0, 0, 0, 80 ) 
  
     Team = "..." 
  
OpenObjectEnter = function(player) 
             x, y, z = getElementPosition ( player ) --position x y z 
                 moveObject ( Object, 3000, x, y, z ) 
end  
addEventHandler ( "onMarkerHit", getRootElement(), OpenObjectEnter) 
  
OpenObjectExit = function(player) 
             x, y, z = getElementPosition ( player ) --positions x y z 
                 moveObject ( Object, -3000, x, y, z ) 
end  
addEventHandler ( "onMarkerHit", getRootElement(), OpenObjectExit) 

Link to comment
moveObject ( Object, 1500, moveX, moveY, moveZ ) 
      local Object = createObject ( ID, x, y, z, rx, ry, rz )              
 moveObject ( Object, 1500, x, y, z ) 
  

What the f.uck are you even trying to make this code is massively deformed.

  
       Team = "ahmed1010" 
        local Object = createObject ( ID, x, y, z, rx, ry, rz )--What the f.uck is this and where does x y z rx ry rz come from 
        local Marker = createMarker ( -11.482395172119, 2071.0393066406, 17.4921875, "cylinder", size, 0, 0, 0, 80 ) 
          
        function OpenObject ( player ) 
            if isElementWithinMarker ( player, Marker ) then --This could be done via addEventHandler 
                if ( getTeamName( getPlayerTeam( player ) ) == Team ) then 
                    if not Open then   -- What the f.uck is open it is not defined 
                        moveObject ( Object, 1500, moveX, moveY, moveZ ) --What the f.uck is moveX moveY and moveZ there is nothing to define them. 
                    else 
                        moveObject ( Object, 1500, x, y, z )  -- Again what the f.uck 
                    end 
                    Open = not Open    -- Do I need to keep saying this 
                else 
                    outputChatBox ( "* You aren't in ["..Team.."] team !", player, 200, 0, 0, true ) 
                end 
            end 
        end 
          
        addEventHandler ( "onResourceStart", getRootElement(), OpenObject ) --Why the f.uck do you want this to go when the resource starts that makes no sense. 
         

Try doing this again because it really sucks I can't even understand what this code does.

  
GATECcol = createColCircle(153.87090,-1772.38123,8) 
Cgate = createObject (987,148.69999694824,-1772.4000244141,2.7000000476837,0,0,0) 
  
function GC1 (thePlayer)  
         moveObject (Cgate,1200,148.69999694824,-1772.4000244141,-4) 
end 
    addEventHandler("onColShapeHit", GATECcol , GC1)        
  
function GC2 (thePlayer) 
         moveObject (Cgate,1200,148.69999694824,-1772.4000244141,2.7000000476837) 
end 
    addEventHandler ("onColShapeLeave", GATECcol ,GC2)  
  

Above is something that works redo your code.

Link to comment

try this

Marker = createMarker (x, y, z, "cylinder", 2,0, 0, 255,255) 
addEventHandler("onMarkerHit",Marker, 
function(thePlayer) 
if (getElementType(thePlayer) ==  'player' ) then 
local account = getPlayerAccount(thePlayer) 
    if (not account or isGuestAccount(account)) then return end 
    local accountName = getAccountName(account) 
    if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "Good" ) ) ) then 
  createVehicle ( ID, x+10, y, z  ) 
    end 
end 
end 
) 

Edited the code.

Now if you are in gorup "good" you will be able to create a car beside you, if you want to get him into car use

warpPedIntoVehicle 

Link to comment

here this is the full code, about that window make it yourself as TAPL said

Marker = createMarker (1811.0029296875, 1076.5595703125, 6.734375, "cylinder", 2.0, 0, 255,255) 
addEventHandler("onMarkerHit",Marker, 
function(thePlayer) 
if (getElementType(thePlayer) ==  'player' ) then 
local account = getPlayerAccount(thePlayer) 
    if (not account or isGuestAccount(account)) then return end 
    local accountName = getAccountName(account) 
    if ( isObjectInACLGroup ( "user.".. accountName, aclGetGroup ( "L5" ) ) ) then 
    local x,y,z = getElementPosition(thePlayer) 
    x = x+10 
  createVehicle (411, 1811.0029296875, 1076.5595703125, 6.734375) 
    end 
end 
end 
) 

Link to comment

You mean this?

  
-- CLIENT SIDE  
Object1 = createObject ( 153.87090,-1772.38123,8 ) 
Marker = createMarker (1811.0029296875, 1076.5595703125, 6.734375, "cylinder", 2.0, 0, 255,255) 
  
function MyMarker(hitPlayer) 
       if hitPlayer~=localPlayer then return end 
    local vehicle = getPedOccupiedVehicle(hitPlayer) 
       if vehicle and source==Marker then 
       if isObjectInACLGroup("user."..getAccountName(getPlayerAccount(hitPlayer)),aclGetGroup("Admin")) then 
           moveObject (Object1,1200,148.69999694824,-1772.4000244141,-4) 
    else 
           moveObject (Object1,1200,148.69999694824,-1772.4000244141,2.7000000476837) 
end 
end 
end 
end 
addEventHandler ("onClientMarkerHit", resourceRoot, MyMarker) 

change the coordinates and the group name with whatever you want.

Not tested but should work.

Link to comment

You know, back in the days people requested help. Some weird errors they couldn't understand. Now, they don't even put effort in learning english in a way that other people can understand them, and they are just requesting scripts? Oh, ya well good luck playing on one of these servers which are owned by people without any lua knowledge. Found a bug? Ya, sorry. It takes 2 weeks before the community fixes it for me!

Might sound rude but... we should follow the rest of the community and stop giving them away their requested scripts. Let them learn their selfs... Jees.

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