Jump to content

Job system


donis123

Recommended Posts

Ehh you dont need to have alot of knowledge to make something like that, you have to use these functions;

onMarkerHit / onClientMarkerHit 
createMarker 
createBlip 
destroyElement -- to destroy the marker and blip 
getPedOccupiedVehicle -- to see if they have a right vehicle 
getElementModel -- to see if they have the right skin (if you want to change the skin als use the -'s) 
- setElementModel 
getPlayerTeam -- to see if they actualy are in the team of the job 
givePlayerMoney 
triggerClientEvent 
triggerServerEvent 

that's quite it.

Link to comment
Ehh you dont need to have alot of knowledge to make something like that, you have to use these functions;
onMarkerHit / onClientMarkerHit 
createMarker 
createBlip 
destroyElement -- to destroy the marker and blip 
getPedOccupiedVehicle -- to see if they have a right vehicle 
getElementModel -- to see if they have the right skin (if you want to change the skin als use the -'s) 
- setElementModel 
getPlayerTeam -- to see if they actualy are in the team of the job 
givePlayerMoney 
triggerClientEvent 
triggerServerEvent 

that's quite it.

okay bro but can you fill in more stuff so i maby understand more of what to fill inn? :S im beginner ;(

Link to comment

oke, you have to understand this else you can better stop what you're doing and buy cookies, milk and read the entire wiki before scripting again! :P

Server script:

-- create a marker on the spot where you want the player to get the job 
  
addEventHandler("onMarkerHit", root -- add a eventhandler to trigger the event 'onMarkerHit' 
    function ( hitElement ) -- create a function with the parameter; hitElement 
        -- #trigger a client event to show a GUI if the player wants to get the job or not. 
        -- #use the function; triggerclientEvent 
    end 
); 
  
addEvent( "jobAccept", true ); -- add a new event; jobAccept 
addEventHandler( "jobAccept", root, -- create an eventHandler for the event 
    function ( thePlayer ) -- create a function with the parameter; thePlayer (you have to give this as an argument in your client side trigger (will place it there too) 
        local v = createVehicle(...) -- create a vehicle on your chosen location with the chosen vehicle 
        -- warp the player in the vehicle with the function; warpPedIntoVehicle. Give the function the parameters(thePlayer, v) 
        -- output a message that he started the job; outputChatBox 
    end 
); 
  
addEvent( "jobFinish", true ); -- add a new event; jobFinish 
addEventHandler( "jobFinish", root, -- create an eventHandler for the event 
    function ( thePlayer ) -- create a function with the parameter; thePlayer (you have to give this as an argument in your client side trigger (will place it there too) 
        -- give the player money with; givePlayerMoney 
    end 
); 

client script:

  
addEventHandler( "onClientResourceStart", getRootElement( getThisResource() ), -- add an eventHandler to handle the start of the source 
    function () 
        -- create the gui with the following functions 
        -- guiCreateWindow 
        -- guiCreateButton 
        -- guiSetVisible 
        -- addEventHandler("onGuiClientClick", ...) 
    end 
); 
  
function -- add a function to handle the accept button 
    -- set the gui hidden (guiSetVisible) 
    -- hide the cursor (showCursor) 
    -- create a new marker as finish marker 
    -- create a new blip as finish blip 
    -- trigger the server event; "jobAccept" with the function; triggerServerEvent 
end 
  
function -- add a function to handle the cancel button 
    -- set the gui hidden (guiSetVisible) 
    -- hide the cursor (showCursor) 
end 
  
addEventHandler("onClientMarkerHit", root, -- add a eventhandler for "onClientMarkerHit" 
    function ( hitElement ) -- add a function with the parameter hitElement 
        -- check if the source == the name of the marker and if hitElement equals the localPlayer (use localPlayer or getLocalPlayer()) 
            -- destroy the blip 
            -- destroy the marker 
            -- trigger the server event; "finishJob", (triggerServerEvent) 
        end 
    end 
); 

Link to comment
oke, you have to understand this else you can better stop what you're doing and buy cookies, milk and read the entire wiki before scripting again! :P

Server script:

-- create a marker on the spot where you want the player to get the job 
  
addEventHandler("onMarkerHit", root -- add a eventhandler to trigger the event 'onMarkerHit' 
    function ( hitElement ) -- create a function with the parameter; hitElement 
        -- #trigger a client event to show a GUI if the player wants to get the job or not. 
        -- #use the function; triggerclientEvent 
    end 
); 
  
addEvent( "jobAccept", true ); -- add a new event; jobAccept 
addEventHandler( "jobAccept", root, -- create an eventHandler for the event 
    function ( thePlayer ) -- create a function with the parameter; thePlayer (you have to give this as an argument in your client side trigger (will place it there too) 
        local v = createVehicle(...) -- create a vehicle on your chosen location with the chosen vehicle 
        -- warp the player in the vehicle with the function; warpPedIntoVehicle. Give the function the parameters(thePlayer, v) 
        -- output a message that he started the job; outputChatBox 
    end 
); 
  
addEvent( "jobFinish", true ); -- add a new event; jobFinish 
addEventHandler( "jobFinish", root, -- create an eventHandler for the event 
    function ( thePlayer ) -- create a function with the parameter; thePlayer (you have to give this as an argument in your client side trigger (will place it there too) 
        -- give the player money with; givePlayerMoney 
    end 
); 

client script:

  
addEventHandler( "onClientResourceStart", getRootElement( getThisResource() ), -- add an eventHandler to handle the start of the source 
    function () 
        -- create the gui with the following functions 
        -- guiCreateWindow 
        -- guiCreateButton 
        -- guiSetVisible 
        -- addEventHandler("onGuiClientClick", ...) 
    end 
); 
  
function -- add a function to handle the accept button 
    -- set the gui hidden (guiSetVisible) 
    -- hide the cursor (showCursor) 
    -- create a new marker as finish marker 
    -- create a new blip as finish blip 
    -- trigger the server event; "jobAccept" with the function; triggerServerEvent 
end 
  
function -- add a function to handle the cancel button 
    -- set the gui hidden (guiSetVisible) 
    -- hide the cursor (showCursor) 
end 
  
addEventHandler("onClientMarkerHit", root, -- add a eventhandler for "onClientMarkerHit" 
    function ( hitElement ) -- add a function with the parameter hitElement 
        -- check if the source == the name of the marker and if hitElement equals the localPlayer (use localPlayer or getLocalPlayer()) 
            -- destroy the blip 
            -- destroy the marker 
            -- trigger the server event; "finishJob", (triggerServerEvent) 
        end 
    end 
); 

okay man i can try! ty

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