Lovinglife Posted April 3, 2010 Share Posted April 3, 2010 Hi i use this res in order to register and login https://community.multitheftauto.com/index.php?p= ... ils&id=617 And...i want use Deathmatch res...i want to "save" the score...how can i do ? i tried smth, faling...may i read whats ur idea... Regards Link to comment
Gamesnert Posted April 3, 2010 Share Posted April 3, 2010 Edit "logic.lua" in the deathmatch resource. Add a save function using setAccountData in onGamemodeStop (before the data is removed, at ~ line 34) and onPlayerQuit. Then, with onGamemodeMapStart and onPlayerJoin, insert loading code, with getAccountData. Link to comment
Lovinglife Posted April 4, 2010 Author Share Posted April 4, 2010 Edit "logic.lua" in the deathmatch resource. Add a save function using setAccountData in onGamemodeStop (before the data is removed, at ~ line 34) and onPlayerQuit. Then, with onGamemodeMapStart and onPlayerJoin, insert loading code, with getAccountData. i've done that on "login server" script...bcuz initally i wanted to test a thing....btw i changed "money" with "Score" n i get this @ warning -.- WARNING: login_serv.lua: Bad argument @ 'getElementData' - Line: 59 line is ... local playerScore = getElementData ( player, "Score" ) it was local playermoney = getPlayerMoney ( source ) edit, k done....ITS source, "Score" edit 2: i have this problem....score is saved...but sometimes...i modify resource and my "score.attuale" in acc.xml disappear and i lost my data!! Link to comment
Jason_Gregory Posted April 4, 2010 Share Posted April 4, 2010 Could you post your Acl.xml and the Function ? I cant download the Resource Link to comment
Lovinglife Posted April 4, 2010 Author Share Posted April 4, 2010 Could you post your Acl.xml and the Function ?I cant download the Resource ill do, right now i got bigger issue... ERROR: Client triggered serverside event on4XLogin, but event is not added serverside CLIENT triggerServerEvent ( "on4XLogin", getRootElement(), localPlayer, guiGetText(LoginUsername), guiGetText(LoginPassword) ) Server function on4XLogin ( player, user, pass ) local account = getAccount ( user, pass ) if ( account ~= false ) then if (logIn ( player, account, pass ) == true) then --local account = getPlayerAccount ( source ) --if ( account ) then local playerScore = getAccountData ( account, "score.attuale" ) -- local playerLevel = getAccountData ( account, "Level" ) -- make sure there was actually a value saved under this key (check if playermoney is not false). -- this will for example not be the case when a player plays the gametype for the first time if ( playerScore ) then --setPlayerMoney ( source, playermoney ) setElementData ( player, "Score", playerScore ) -- setElementData ( player, "Level.game", playerLevel )and ( playerLevel ) end --end triggerClientEvent ( "hideLoginWindow", getRootElement()) else outputChatBox ( "Login error!", player, 255, 255, 0 ) -- Output they got the details wrong. end else outputChatBox ( "Wrong username or password!", player, 255, 255, 0 ) -- Output they got the details wrong. end end this issue appeared now...weird...<.< Link to comment
Jason_Gregory Posted April 4, 2010 Share Posted April 4, 2010 addEvent("on4XLogin", true) addEventHandler("on4XLogin", getRootElement(), on4XLogin) Link to comment
Lovinglife Posted April 4, 2010 Author Share Posted April 4, 2010 addEvent("on4XLogin", true) addEventHandler("on4XLogin", getRootElement(), on4XLogin) i solved moving my script in logic.lua levelexp = 20 Level = 1 local expamount expamount = getElementData ( player, "Level" )*levelexp Well i need these values... may i put em on the top of the script? expamount = getElementData ( player, "Level" )*levelexp----------------attempt to do art on boolean value... Link to comment
Lovinglife Posted April 6, 2010 Author Share Posted April 6, 2010 playerScore = getElementData ( source, "Score" ) levelexp = 20 playerAsk = getElementData(source,"Level")*levelexp --playerAsk1 = playerAsk * levelexp if (playerScore >= playerAsk) then its simple u think....but WHY doesnt work? i kill and i get NO score, nothing...this thing ignores me... While...If i use 400(a normal value) =< playerAsk WORKS playerscore >= 400 WORKS playerscore>=playerask(witout the "levelexp") WORKS im becoming mad....ç_________________________________________________ç regards Link to comment
Lovinglife Posted April 12, 2010 Author Share Posted April 12, 2010 Anyone knows whats the way i risk to lose my account data? i mean server crashes for istance...or more example reported by u all If server crashes during last game session i lost my data...is there any fix? Link to comment
dzek (varez) Posted April 12, 2010 Share Posted April 12, 2010 Anyone knows whats the way i risk to lose my account data? i mean server crashes for istance...or more example reported by u allIf server crashes during last game session i lost my data...is there any fix? uhm.. if you do "setAccountData" its safe to crash the server after it.. Link to comment
Lovinglife Posted April 12, 2010 Author Share Posted April 12, 2010 Anyone knows whats the way i risk to lose my account data? i mean server crashes for istance...or more example reported by u allIf server crashes during last game session i lost my data...is there any fix? uhm.. if you do "setAccountData" its safe to crash the server after it.. There is a way to obtain that i save my stats every 5 min? Link to comment
dzek (varez) Posted April 12, 2010 Share Posted April 12, 2010 There is a way to obtain that i save my stats every 5 min? setTimer Link to comment
Lovinglife Posted April 14, 2010 Author Share Posted April 14, 2010 There is a way to obtain that i save my stats every 5 min? setTimer umm pls 1 more advice Link to comment
dzek (varez) Posted April 15, 2010 Share Posted April 15, 2010 function my_saving_function(arg, arg2, arg3) -- your saving stuff end setTimer(my_saving_function, 1000*60*5, 0, argument1, argument2, argument3) -- and so on 1000*60*5 ==> 1000ms = 1sec 1sec*60 = 1min 1min*5 = 5min 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