Jump to content

promotion job....


Deepu

Recommended Posts

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?

Link to comment

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.

Link to comment

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 
  

Link to comment

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) 
  

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