qaisjp Posted July 8, 2011 Share Posted July 8, 2011 (edited) All my questions will be here, so scroll the last page or w/e to get the latest questions! can account data be saved as a table? Edited August 13, 2011 by Guest Link to comment
Aibo Posted July 8, 2011 Share Posted July 8, 2011 no https://wiki.multitheftauto.com/wiki/SetAccountData bool setAccountData ( account theAccount, string key, string value ) Link to comment
qaisjp Posted July 8, 2011 Author Share Posted July 8, 2011 can onPlayerLogout event be cancelled Link to comment
Aibo Posted July 8, 2011 Share Posted July 8, 2011 though you can concatenate your table into a string, and then split it back again into a table. but that is not a very efficient way of storing data, imo. PS: there's no need to create another topic. Link to comment
qaisjp Posted July 9, 2011 Author Share Posted July 9, 2011 (sos) can the onPlayerLogout event be cancelled tho? Link to comment
Jaysds1 Posted July 9, 2011 Share Posted July 9, 2011 Only inside the function. i.e. addEventHandler("onPlayerLogout", getRootElement(), function() local player = getAccount(client) if (player) then cancelEvent() end) Link to comment
qaisjp Posted July 9, 2011 Author Share Posted July 9, 2011 Why would you need an if statement! can't you just do addEventHandler("onPlayerLogout", root, cancelEvent) Link to comment
qaisjp Posted July 9, 2011 Author Share Posted July 9, 2011 Oh so it is possible, thanks Link to comment
Antibird Posted July 9, 2011 Share Posted July 9, 2011 can account data be saved as a table? The table can be converted into string using toJSON( ), which then can be saved as an account data. To recover table from the string saved so, fromJSON( ) function is to be used. Link to comment
qaisjp Posted July 12, 2011 Author Share Posted July 12, 2011 I have this script, and it works as desired: function showProgressHUDtwok(boolean) local currentprog = guiProgressBarGetProgress(progressHUD) guiSetAlpha(progressHUD, 255) guiProgressBarSetProgress(progressHUD, 0) setTimer(guiProgressBarSetProgress,100 , 1, progressHUD, 5 ) setTimer(guiProgressBarSetProgress,200 , 1, progressHUD, 10 ) setTimer(guiProgressBarSetProgress,300 , 1, progressHUD, 15 ) setTimer(guiProgressBarSetProgress,400 , 1, progressHUD, 20 ) setTimer(guiProgressBarSetProgress,500 , 1, progressHUD, 25 ) setTimer(guiProgressBarSetProgress,600 , 1, progressHUD, 30 ) setTimer(guiProgressBarSetProgress,700 , 1, progressHUD, 35 ) setTimer(guiProgressBarSetProgress,800 , 1, progressHUD, 40 ) setTimer(guiProgressBarSetProgress,900 , 1, progressHUD, 45 ) setTimer(guiProgressBarSetProgress,1000, 1, progressHUD, 50 ) setTimer(guiProgressBarSetProgress,1100, 1, progressHUD, 55 ) setTimer(guiProgressBarSetProgress,1200, 1, progressHUD, 60 ) setTimer(guiProgressBarSetProgress,1300, 1, progressHUD, 65 ) setTimer(guiProgressBarSetProgress,1400, 1, progressHUD, 70 ) setTimer(guiProgressBarSetProgress,1500, 1, progressHUD, 75 ) setTimer(guiProgressBarSetProgress,1600, 1, progressHUD, 80 ) setTimer(guiProgressBarSetProgress,1700, 1, progressHUD, 85 ) setTimer(guiProgressBarSetProgress,1800, 1, progressHUD, 90 ) setTimer(guiProgressBarSetProgress,100 , 1, progressHUD, 95 ) setTimer(guiProgressBarSetProgress,2000, 1, progressHUD, 100) setTimer(guiSetAlpha ,2200, 1, progressHUD, 0 ) --setTimer(guiProgressBarSetProgress, 100, 2000,progressHUD,guiProgressBarGetProgress(progressHUD)+0.5) --setTimer(guiSetAlpha, 1500, 1,progressHUD, 0) end Please provide a way I can minimise it Link to comment
DarkLink Posted July 12, 2011 Share Posted July 12, 2011 I have this script, and it works as desired: function showProgressHUDtwok(boolean) local currentprog = guiProgressBarGetProgress(progressHUD) guiSetAlpha(progressHUD, 255) guiProgressBarSetProgress(progressHUD, 0) setTimer(guiProgressBarSetProgress,100 , 1, progressHUD, 5 ) setTimer(guiProgressBarSetProgress,200 , 1, progressHUD, 10 ) setTimer(guiProgressBarSetProgress,300 , 1, progressHUD, 15 ) setTimer(guiProgressBarSetProgress,400 , 1, progressHUD, 20 ) setTimer(guiProgressBarSetProgress,500 , 1, progressHUD, 25 ) setTimer(guiProgressBarSetProgress,600 , 1, progressHUD, 30 ) setTimer(guiProgressBarSetProgress,700 , 1, progressHUD, 35 ) setTimer(guiProgressBarSetProgress,800 , 1, progressHUD, 40 ) setTimer(guiProgressBarSetProgress,900 , 1, progressHUD, 45 ) setTimer(guiProgressBarSetProgress,1000, 1, progressHUD, 50 ) setTimer(guiProgressBarSetProgress,1100, 1, progressHUD, 55 ) setTimer(guiProgressBarSetProgress,1200, 1, progressHUD, 60 ) setTimer(guiProgressBarSetProgress,1300, 1, progressHUD, 65 ) setTimer(guiProgressBarSetProgress,1400, 1, progressHUD, 70 ) setTimer(guiProgressBarSetProgress,1500, 1, progressHUD, 75 ) setTimer(guiProgressBarSetProgress,1600, 1, progressHUD, 80 ) setTimer(guiProgressBarSetProgress,1700, 1, progressHUD, 85 ) setTimer(guiProgressBarSetProgress,1800, 1, progressHUD, 90 ) setTimer(guiProgressBarSetProgress,100 , 1, progressHUD, 95 ) setTimer(guiProgressBarSetProgress,2000, 1, progressHUD, 100) setTimer(guiSetAlpha ,2200, 1, progressHUD, 0 ) --setTimer(guiProgressBarSetProgress, 100, 2000,progressHUD,guiProgressBarGetProgress(progressHUD)+0.5) --setTimer(guiSetAlpha, 1500, 1,progressHUD, 0) end Please provide a way I can minimise it setTimer(guiProgressBarSetProgress,100, 20, progressHUD, guiProgressBarGetProgress(progressHUD) + 5) Should work Link to comment
qaisjp Posted July 30, 2011 Author Share Posted July 30, 2011 **----------** (no it isn't a bump) **-----------------** I have scripted a headlight colour changer with scroll bars and stuff, but will it cause a massive lag if it updates the light every scroll (when all players do it and there are 100 players?) -- I want to store "accountname" and "namecolour" data into a mysql database, I got it working smooth, but I am not comfortable with it being a TEXT datatype (i dunno why ), I don't know what datatype to put, please assist me. -- wtf is this OnPlayerModInfo Link to comment
Castillo Posted July 30, 2011 Share Posted July 30, 2011 Seems like is a new function for 1.1. The wiki should explain what it does. Link to comment
qaisjp Posted August 13, 2011 Author Share Posted August 13, 2011 Why do: do local screenWidth, screenHeight = guiGetScreenSize() if screenHeight < 700 then g_MapSide = 450 else g_MapSide = 700 end end when you can do local screenWidth, screenHeight = guiGetScreenSize() if screenHeight < 700 then g_MapSide = 450 else g_MapSide = 700 end ? Isn't it the same thing, or wut? Link to comment
Jaysds1 Posted August 13, 2011 Share Posted August 13, 2011 when you do (do) your creating a table, unlike the other code, your just setting the mapSide. Link to comment
qaisjp Posted August 13, 2011 Author Share Posted August 13, 2011 Wth do you mean. I'm not saying for i=0,99 do or for i,v in ipairs({"what", "i ", "bla"}) do I'm saying PLAIN do. For example: do local screenWidth, screenHeight = guiGetScreenSize() if screenHeight < 700 then g_MapSide = 450 else g_MapSide = 700 end end outputChatBox(g_MapSide) If that is the full script, what is the differnce. Link to comment
SDK Posted August 13, 2011 Share Posted August 13, 2011 I think it's main feature is that it creates a new local scope, look at the examples here: http://lua-users.org/wiki/ScopeTutorial 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