-Doc- Posted April 28, 2015 Share Posted April 28, 2015 Hey guys i wanna make new level system. Can someone help? I want that my level system when level up to be 0. For example when i level up 799/800 and then 0/1200 how i can do that ? and look like this http://imgur.com/t4yqYHz Can anyone help? Link to comment
Walid Posted April 28, 2015 Share Posted April 28, 2015 Hey guys i wanna make new level system. Can someone help? I want that my level system when level up to be 0. For example when i level up 799/800 and then 0/1200 how i can do that ? and look like this http://imgur.com/t4yqYHz Can anyone help? try to do it by yourself and post your code here and we will help you. Link to comment
-Doc- Posted June 7, 2015 Author Share Posted June 7, 2015 I need just a simple example Link to comment
jingzhi Posted June 9, 2015 Share Posted June 9, 2015 I need just a simple example use SQL database and some simple math.... Link to comment
-Doc- Posted June 9, 2015 Author Share Posted June 9, 2015 Just 1 example please with level 1,2 i know how to use sql Link to comment
John Smith Posted June 9, 2015 Share Posted June 9, 2015 I need just a simple example use SQL database and some simple math.... Why would you need sql to make a level system? Link to comment
-Doc- Posted June 9, 2015 Author Share Posted June 9, 2015 To save level and experience in account data Link to comment
Walid Posted June 9, 2015 Share Posted June 9, 2015 To save level and experience in account data MySQL (save level and experience into a database). setAccountData (save level and experience in account data). Link to comment
-Doc- Posted June 9, 2015 Author Share Posted June 9, 2015 I need a example how to make level system please just a example Link to comment
jingzhi Posted June 9, 2015 Share Posted June 9, 2015 I need a example how to make level system please just a example I am not familiar with the sql funcions, i think you just retrive the data from sql data base, the current level and exp, for example you are level 7, and you have 200 exp. lvl 7 to lvl 8 needs 500 exp, so your position is 200 / 500. Now everytime you get exp you save it in sql database, and before that you do a calculation, see if the ammount of exp you got exceed the ammount needed to lvl up. For example you got 200 exp 500 - 200 = 300 ( the ammount of exp needed to lvl up) 300 - 200 = 100 so this havnt exceed the ammount of exp needed to lvl up. If you get 500 exp 500 - 300 = 200, the ammount of exp you got exceed by 200 of the ammount of exp you need. So you make this player lvl up and save it in database, and after lvl up add 200 to his current exp progress, e.g. now he is lvl 8 and he needs 800 to lvl up, now his pos is 200 / 800. Link to comment
jingzhi Posted June 9, 2015 Share Posted June 9, 2015 A lua example Dude, you can totally make you own script based on this idea Link to comment
-Doc- Posted June 9, 2015 Author Share Posted June 9, 2015 I need a example just a simple example ~_~ Link to comment
Drakath Posted June 9, 2015 Share Posted June 9, 2015 I need a example just a simple example ~_~ What you call an "example" is pretty much asking for a whole script. I doubt anyone will make it for free. If you want basic Lua scripts, look around the wiki. Link to comment
John Smith Posted June 9, 2015 Share Posted June 9, 2015 Use setAccountData its easier than learning sql Link to comment
xeon17 Posted June 9, 2015 Share Posted June 9, 2015 You need a example? why don't you download some level system resources from the community and see how they work? Link to comment
Arnold-1 Posted June 9, 2015 Share Posted June 9, 2015 You need a example? why don't you download some level system resources from the community and see how they work? ^^^ this guy isn't looking for help, he is looking for scripts, please have this topic locked. Link to comment
TioTiago Posted June 9, 2015 Share Posted June 9, 2015 Server function givePlayerXP ( source, valve ) local finalXP = valve local currXP = getElementData ( source, "xp" ) or 0 local level = getElementData ( source, "level" ) local nextXP = 50*level setElementData ( source, "xp", currXP + finalXP ) if currXP+finalXP > nextXP then setElementData ( source, "xp", 0 ) setElementData ( source, "level", level + 1 ) outputChatBox ("Rank up"..tostring(level+1), source, 255, 25, 0, true)) end end give xp use: givePlayerXP (killer,10) Client: local level = getElementData ( localPlayer, "level" ) local xp = getElementData ( localPlayer, "xp" ) dxDrawText ("Level: "..level, 15, y-50, 200, y, tocolor ( 100, 255, 100, 200 ), 1.1, "default-bold" ) dxDrawText ("XP: "..xp.."/"..tostring(level*50), 15, y-25, 200, y, tocolor ( 100, 255, 100, 200 ), 1.02, "default-bold" ) I wore it once, do not remember the author's name only remember who posted on a Russian forum Link to comment
-Doc- Posted June 9, 2015 Author Share Posted June 9, 2015 But if i want change exp needed and max level? Link to comment
..:D&G:.. Posted June 9, 2015 Share Posted June 9, 2015 But if i want change exp needed and max level? local nextXP = 50*level This means 50 divided by the level you have. So increase the 50 if you want the player to require more xp for a level, or decrease it if you want to have less. Link to comment
-Doc- Posted June 10, 2015 Author Share Posted June 10, 2015 i wanna make it in tables and put in tables exp needed and make max level 100 Link to comment
Mr.unpredictable. Posted June 10, 2015 Share Posted June 10, 2015 i wanna make it in tables and put in tables exp needed and make max level 100 Why don't you do it by yourself? Just saying, you always ask people to do your work or you try to get help with scripts which you don't own, You will never learn if you keep doing like that. Link to comment
jingzhi Posted June 10, 2015 Share Posted June 10, 2015 But if i want change exp needed and max level? Dude, you really need to do it on yourself, you can't always rely on other people, specially when you are developing a server Link to comment
Anubhav Posted June 10, 2015 Share Posted June 10, 2015 But if i want change exp needed and max level? Dude, you really need to do it on yourself, you can't always rely on other people, specially when you are developing a server Why do you need to go to every single topic like this, and tell people this? No offense. Link to comment
DeVo Posted June 10, 2015 Share Posted June 10, 2015 But if i want change exp needed and max level? Dude, you really need to do it on yourself, you can't always rely on other people, specially when you are developing a server Why do you need to go to every single topic like this, and tell people this? No offense. That's a hobby of some MTA forum members. OT: levels = { {exp=100}, {exp=250}, {exp=500}, {exp=600} } maxlvl = 4 function givePlayerXP ( source, valve ) local finalXP = valve local currXP = getElementData ( source, "xp" ) or 0 local level = getElementData ( source, "level" ) or 1 local nextXP = levels[level].exp if currXP+finalXP >= nextXP and maxlvl > level then setElementData ( source, "xp", 0 ) setElementData ( source, "level", level + 1 ) outputChatBox ("Rank up"..tostring(level+1), source, 255, 25, 0, true)) else setElementData ( source, "xp", currXP + finalXP ) end end I used tables then I edited #Thug's function. Change maxlvl, and don't forget to add levels into the table like what I did. Link to comment
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