Jump to content

Gate not working


Mann56

Recommended Posts

Hey guys im making a pizza job but am stuck.

I have made a gate and set such that when a player of team Pizza comes near it then only it opens but it does not claiming i am not in team pizza.

Here's my code ->

Server

-- check employment status of a player 
  
addEvent("acceptTheJob", true) 
function getTheSkin(thePlayer) 
end 
addEventHandler("acceptTheJob", root, 
function(var) 
    if var == "Enter" then 
        local team = getPlayerTeam(client) 
        if team and getTeamName(team) == "Pizza" then 
            outputChatBox("PIZZA JOB : You are already employed.", client, 255, 255, 0) 
        else 
            setPlayerTeam(client, getTeamFromName("Pizza")) 
            outputChatBox("PIZZA JOB : You are now employed as a Pizzaboy!", client, 255, 255, 0) 
            setElementModel(client,155) 
        end 
    elseif var == "Leave" then 
        setPlayerTeam(client, nil) 
        outputChatBox("PIZZA JOB : You left your job and are unemployed now!", client, 255, 255, 0) 
        setElementModel(client,0) 
    end 
end) 
gate = createObject(985,-1698.5302734375, 1392.7216796875, 7.1786022186279, 0,0,130.67932128906  ) 
colRect = createColCircle(-1697.7197265625, 1391.74609375, 6) 
addEventHandler("onColShapeHit",colRect, 
function(thePlayer,matchingDimension) 
        if getElementType(thePlayer) == "Player" or "Vehicle"then 
             d = getPlayerTeam(thePlayer) 
            if d == "Pizza" then 
                 movegate = moveObject(gate , 3000 ,-1704.947265625, 1398.6650390625, 7.1784038543701) 
            end 
        else 
            outputChatBox("You are not a pizzaboy!",getRootElement(),255,255,0) 
        end 
end 
) 
addEventHandler("onColShapeLeave",colRect, 
function(thePlayer,matchingDimension) 
if getElementType(thePlayer) == "Player" or "Vehicle"then 
setGateBack = moveObject (gate , 3000,-1698.5302734375, 1392.7216796875, 7.1786022186279 ) 
end 
end) 
  
addCommandHandler("pizzahelp", 
function() 
     outputChatBox("Pizza : In the pizza  you as a pizzaboy have to deliver pizzas to locations and you get money by delivering the package.") 
end) 
  

Client

GUIEditor = { 
    button = {}, 
    window = {}, 
    label = {} 
} 
  
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(308, 173, 399, 425, "Pizza ", false) 
        guiWindowSetMovable(GUIEditor.window[1], false) 
        guiWindowSetSizable(GUIEditor.window[1], false) 
        guiSetVisible(GUIEditor.window[1], false) --I seted as invisible * 
  
        GUIEditor.label[1] = guiCreateLabel(14, 31, 365, 63, "   Well Stacked Pizza Co.", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.label[1], "sa-header") 
        guiLabelSetColor(GUIEditor.label[1], 255, 255, 2) 
        GUIEditor.label[2] = guiCreateLabel(44, 111, 320, 124, "        Welcome to the Well Stacked Pizza Co.\n        You can employ now as a pizzaboy!\n        As a pizzaboy you have to deliver pizza's\n        throughout the town.\n        You will get money for that.\n\n        For help type /pizzahelp", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.label[2], "clear-normal") 
        GUIEditor.button[1] = guiCreateButton(96, 247, 215, 42, "Accept ", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.button[1], "sa-header") 
        guiSetProperty(GUIEditor.button[1], "NormalTextColour", "C8FFFF00") 
        GUIEditor.button[2] = guiCreateButton(118, 307, 164, 36, "Leave ", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.button[2], "sa-header") 
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "C8FD0802") 
        GUIEditor.button[3] = guiCreateButton(122, 368, 150, 32, "Close", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.button[3], "sa-header")   
    end 
) 
  
pizzaguy = createPed(155, -1720.0400390625, 1356.6455078125, 7.1875, 121.70565795898) 
pizzaMarker = createMarker(-1721.0263671875, 1355.9541015625, 6.1805019378662, "cylinder", 1.25, 0, 255, 0, 180) 
createBlip(-1723.74, 1359.68, 6.18, 29, 2, 0, 0, 0, 255, 0, 200) 
setElementFrozen(pizzaguy, true) 
addEventHandler("onClientPedDamage", pizzaguy, cancelEvent) 
  
addEventHandler("onClientMarkerHit", pizzaMarker, 
function(player) 
    if player == localPlayer and not isPedInVehicle(player) then 
        guiSetVisible(GUIEditor.window[1], true) 
        showCursor(true) 
    end 
end) 
  
addEventHandler("onClientGUIClick", root, 
function() 
    if source == GUIEditor.button[1] then 
        closeWind() 
        triggerServerEvent("acceptTheJob", localPlayer, "Enter") 
    elseif source == GUIEditor.button[2] then 
        closeWind() 
        triggerServerEvent("acceptTheJob", localPlayer, "Leave") 
    elseif source == GUIEditor.button[3] then 
        closeWind() 
    end 
end) 
  
function closeWind() 
    guiSetVisible(GUIEditor.window[1], false) 
    showCursor(false) 
end 

I would appreciate some help : D

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