Jump to content

[Help] Pizza Job


Mann56

Recommended Posts

Hey guys !

I made a pizza job.

When i click button1 it doesn't work any suggestions of the error?

Server

pizzaguy = 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 ) 
  
function MarkerHit(hitPlayer) 
  if (getElementType(hitPlayer) == "player" ) and not isPedInVehicle(hitPlayer) then 
  triggerClientEvent (hitPlayer,"openWindow",getRootElement(),hitPlayer) 
end 
end 
  
addEventHandler("onMarkerHit", pizzaguy, MarkerHit) 
function startJobb(thePlayer) 
local team = getPlayerTeam(thePlayer) 
if team == "Pizza" then 
outputChatBox("You are already employed.",getRootElement(),255,255,0) 
else 
setPlayerTeam(thePlayer,"Pizza") 
outputChatBox("You are now employed as a Pizzaboy!",getRootElement(),255,255,0) 
end 
end 
addEvent("startTheJob",true) 
addEventHandler("startTheJob",getRootElement(),startJobb) 
  
  
  
  
  
function help () 
     outputChatBox("Pizza : In the pizza job you as a pizzaboy have to deliver pizzas to locations and you get money by delivering the package.") 
     end 
addCommandHandler("pizzahelp",help) 

Client :

  
  
thePed = createPed (155,-1720.0400390625, 1356.6455078125, 7.1875, 121.70565795898 ) 
GUIEditor = { 
    button = {}, 
    window = {}, 
    label = {} 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        GUIEditor.window[1] = guiCreateWindow(308, 173, 399, 425, "Pizza Job", 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") 
        button1 = guiCreateButton(96, 247, 215, 42, "Accept Job", false, GUIEditor.window[1]) 
        guiSetFont(button1, "sa-header") 
        guiSetProperty(button1, "NormalTextColour", "C8FFFF00") 
        GUIEditor.button[2] = guiCreateButton(118, 307, 164, 36, "Leave Job", false, GUIEditor.window[1]) 
        guiSetFont(GUIEditor.button[2], "sa-header") 
        guiSetProperty(GUIEditor.button[2], "NormalTextColour", "C8FD0802") 
        button3 = guiCreateButton(122, 368, 150, 32, "Close", false, GUIEditor.window[1]) 
        guiSetFont(button3, "sa-header")  
        addEventHandler("onClientGUIClick",button3,closeJob,false)   
        addEventHandler("onClientGUIClick",button3,startJob,false)       
    end 
) 
  
function Window() 
guiSetVisible(GUIEditor.window[1], true) 
showCursor(true) 
end 
addEvent("openWindow",true) 
addEventHandler("openWindow", getRootElement(), Window) 
function closeJob(button,state) 
  
if button=="left" and state=="up" then 
guiSetVisible(GUIEditor.window[1],false) 
showCursor(false) 
end 
end 
  
function startJob(button) 
  
local button = button1 
if source == button then 
triggerServerEvent("startTheJob",source) 
guiSetVisible(GUIEditor.Window[1],false) 
showCursir(false) 
end 
end 
  

Link to comment
addEvent("adjTheJob", true) 
addEventHandler("adjTheJob", root, 
function(var) 
    if var == "Enter" then 
        local team = getPlayerTeam(client) 
        if team and getTeamName(team) == "Pizza" then 
            outputChatBox("You are already employed.", client, 255, 255, 0) 
        else 
            setPlayerTeam(client, getTeamFromName("Pizza")) 
            outputChatBox("You are now employed as a Pizzaboy!", client, 255, 255, 0) 
        end 
    elseif var == "Leave" then 
        setPlayerTeam(client, nil) 
        outputChatBox("You are now employed as a nothing!", client, 255, 255, 0) 
    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) 

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("adjTheJob", localPlayer, "Enter") 
    elseif source == GUIEditor.button[2] then 
        closeWind() 
        triggerServerEvent("adjTheJob", localPlayer, "Leave") 
    elseif source == GUIEditor.button[3] then 
        closeWind() 
    end 
end) 
  
function closeWind() 
    guiSetVisible(GUIEditor.window[1], false) 
    showCursor(false) 
end 

Link to comment
addEvent("adjTheJob", true) 
addEventHandler("adjTheJob", root, 
function(var) 
    if var == "Enter" then 
        local team = getPlayerTeam(client) 
        if team and getTeamName(team) == "Pizza" then 
            outputChatBox("You are already employed.", client, 255, 255, 0) 
        else 
            setPlayerTeam(client, getTeamFromName("Pizza")) 
            outputChatBox("You are now employed as a Pizzaboy!", client, 255, 255, 0) 
        end 
    elseif var == "Leave" then 
        setPlayerTeam(client, nil) 
        outputChatBox("You are now employed as a nothing!", client, 255, 255, 0) 
    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) 

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("adjTheJob", localPlayer, "Enter") 
    elseif source == GUIEditor.button[2] then 
        closeWind() 
        triggerServerEvent("adjTheJob", localPlayer, "Leave") 
    elseif source == GUIEditor.button[3] then 
        closeWind() 
    end 
end) 
  
function closeWind() 
    guiSetVisible(GUIEditor.window[1], false) 
    showCursor(false) 
end 

Thanks mate :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...