justn Posted March 18, 2014 Posted March 18, 2014 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.
JR10 Posted March 18, 2014 Posted March 18, 2014 You can use accounts data to save each account's job. onPlayerQuit save his job to his account, onPlayerLogin load the job. setAccountData getAccountData
justn Posted March 18, 2014 Author Posted March 18, 2014 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 ?
cheez3d Posted March 19, 2014 Posted March 19, 2014 addEventHandler("onMarkerHit",--[[marker]],function(player) if getAccountData(player,"job") then -- player has a job else -- player doesn't have a job end end
xXMADEXx Posted March 19, 2014 Posted March 19, 2014 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 )
justn Posted March 19, 2014 Author Posted March 19, 2014 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now