Jump to content

Help please thanks.


justn

Recommended Posts

So i have made a job, how do i make it, so if the player has gotten the job, and if the player reconnects, then he will still have th job ?

Example: When I click Get Job (A Quit job buttons appear) but if the player reconnects , then the quit button job will still be there.

Link to comment
You can use accounts data to save each account's job. onPlayerQuit save his job to his account, onPlayerLogin load the job.
setAccountData 
getAccountData 

Okay 1 more thing, if the player already has a job, and he goes in another job marker and click get job how to make it so a gui will pop-up and say 'Do you want to leave your current job first ?

Link to comment

You can check the element data (or whatever you set to the players job), and if they have a job, you can use this script that I made for personal use:

local confirm = {} 
local callback = nil 
local args = nil 
local sx, sy = guiGetScreenSize ( ) 
confirm.window = guiCreateWindow( ( sx / 2 - 324 / 2 ), ( sy / 2 - 143 /2 ), 324, 143, "Confirm", false) 
confirm.text = guiCreateLabel(10, 35, 304, 65, "", false, confirm.window) 
guiSetVisible ( confirm.window, false ) 
guiSetFont(confirm.text, "default-bold-small") 
guiLabelSetHorizontalAlign(confirm.text, "left", true) 
guiWindowSetSizable ( confirm.window, false ) 
confirm.yes = guiCreateButton(10, 100, 108, 25, "Confirm", false, confirm.window) 
confirm.no = guiCreateButton(128, 100, 108, 25, "Deny", false, confirm.window) 
  
function onConfirmClick( )  
    if ( source ~= confirm.yes and source ~= confirm.no ) then return end 
     
    removeEventHandler ( "onClientGUIClick", root, onConfirmClick ) 
    guiSetVisible ( confirm.window, false ) 
    local v = false 
    if ( source == confirm.yes ) then 
        v = true 
    end 
    callback ( v, unpack ( args ) ) 
    args = nil 
    callback = nil 
end 
  
function askConfirm ( question, callback_, ... ) 
    if ( not callback_ or type ( callback_ ) ~= "function" ) then 
        return false 
    end 
     
    guiSetVisible ( confirm.window, true ) 
    guiSetText ( confirm.text, tostring ( question ) ) 
    callback = callback_ 
    args = { ... } 
    addEventHandler ( "onClientGUIClick", root, onConfirmClick ) 
    guiBringToFront ( confirm.window ) 
    return true 
end 

e.x.

askConfirm ( "Would you like to quit your current job?", function ( bool ) 
   if not bool then return end 
   outputChatBox("You have quit your job!") 
end ) 

Link to comment
You can check the element data (or whatever you set to the players job), and if they have a job, you can use this script that I made for personal use:
local confirm = {} 
local callback = nil 
local args = nil 
local sx, sy = guiGetScreenSize ( ) 
confirm.window = guiCreateWindow( ( sx / 2 - 324 / 2 ), ( sy / 2 - 143 /2 ), 324, 143, "Confirm", false) 
confirm.text = guiCreateLabel(10, 35, 304, 65, "", false, confirm.window) 
guiSetVisible ( confirm.window, false ) 
guiSetFont(confirm.text, "default-bold-small") 
guiLabelSetHorizontalAlign(confirm.text, "left", true) 
guiWindowSetSizable ( confirm.window, false ) 
confirm.yes = guiCreateButton(10, 100, 108, 25, "Confirm", false, confirm.window) 
confirm.no = guiCreateButton(128, 100, 108, 25, "Deny", false, confirm.window) 
  
function onConfirmClick( )  
    if ( source ~= confirm.yes and source ~= confirm.no ) then return end 
     
    removeEventHandler ( "onClientGUIClick", root, onConfirmClick ) 
    guiSetVisible ( confirm.window, false ) 
    local v = false 
    if ( source == confirm.yes ) then 
        v = true 
    end 
    callback ( v, unpack ( args ) ) 
    args = nil 
    callback = nil 
end 
  
function askConfirm ( question, callback_, ... ) 
    if ( not callback_ or type ( callback_ ) ~= "function" ) then 
        return false 
    end 
     
    guiSetVisible ( confirm.window, true ) 
    guiSetText ( confirm.text, tostring ( question ) ) 
    callback = callback_ 
    args = { ... } 
    addEventHandler ( "onClientGUIClick", root, onConfirmClick ) 
    guiBringToFront ( confirm.window ) 
    return true 
end 

e.x.

askConfirm ( "Would you like to quit your current job?", function ( bool ) 
   if not bool then return end 
   outputChatBox("You have quit your job!") 
end ) 

Ty alot MADE :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...