Deepu Posted February 14, 2014 Posted February 14, 2014 Can anyone who is experienced give me the functions for the promotions in the jobs scripts? like for ex:- I made pilot job I need 500 flights for next level == level 1 if I have 500 flights then I get level 1 rank and an increase in the pay is it getElementData?
manve1 Posted February 14, 2014 Posted February 14, 2014 For pilot job, you need to make your own system for counting how many flights the person has done; When they fly over lets say from LS to SF and they hit a marker, then you add a flight to a variable, but, when you want to save the data, don't use setElementData as that gets removed when an element is destroyed, or for players: when they disconnect/quit. I would recommend using a table, then when the person disconnects/quits, save the data which was in a table in a database like SQLite or MySql. For the increase of payment with new and higher levels, simply just get the data on how many flights the person has done and use an if statement.
Deepu Posted February 14, 2014 Author Posted February 14, 2014 can you make an example script for that? with something?
Anubhav Posted February 14, 2014 Posted February 14, 2014 You can use XML but its laggy. It is easy to learn. Use some of they functions listed below: xmlCopyFile xmlCreateFile xmlDestroyNode xmlLoadFile xmlNodeGetAttribute xmlNodeGetValue xmlNodeSetAttribute xmlNodeSetValue xmlSaveFile xmlUnloadFile xmlCreateChild xmlFindChild xmlNodeGetAttributes xmlNodeGetChildren xmlNodeGetName xmlNodeGetParent xmlNodeSetName
Smart. Posted February 14, 2014 Posted February 14, 2014 I'd do something like this when you enter the marker (when you finish the job/mission) local amount = tonumber(getAccountData(getPlayerAccount(player), "resource.flights")) or 0 local newAmount = amount + 1 setAccountData(getPlayerAccount(player), "resource.flights", newAmount) if (newAmount) >= 500 then outputChatBox("You've been promoted", player) elseif (newAmount >= 1000) then outputChatBox("Promoted once again", player) end And then for the increased payment you can do something like this: local amount = tonumber(getAccountData(getPlayerAccount(player), "resource.flights")) or 0 local payment = 25 * amount --if the player has 500 flights he will get 12500 givePlayerMoney(player, payment)
Smart. Posted February 14, 2014 Posted February 14, 2014 what is resource flight? It's easier to keep track of accountData if you specify what resource sets the data.
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