Jump to content

dzek (varez)

Retired Staff
  • Posts

    4,144
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by dzek (varez)

  1. dzek (varez)

    time

    are you sure you are passing value to convert? i mean, for example: /test 1234235 it will be nil if you are put just /test
  2. dzek (varez)

    time

    i forgot to tell you to replace "str" with "tostring" .. but you could have done it by yourself with a little search.. btw: better dont use "time" as variable name.. it should work but i dont recommend it
  3. set very looong time, and reset time to desired value with setTimer
  4. ehhh.. debug.. watch line by line whats going on.. spot your error and fix it
  5. on 1.0.4 accounts are moved to internal.db file (its not a xml anymore)
  6. notice your files on client-side script will be created in MTA\mods\deathmatch\resources\res_name\ not in MTA\server\mods\deathmatch\resources\res_name\ when i was making xml i was looking it automatically in server files ;/
  7. i gave you all needed links.. maybe open them?
  8. this isn't all output, right?
  9. now you should know all, right? do you understand what your script is doing? lets check -- your getUserIndex returned nil = returned nothing function getUserIndex (username,root) for i,v in ipairs (xmlNodeGetChildren (root)) do local name = xmlNodeGetAttribute (v,"account") -- after this "if" we have return, after end of this if we have nothing -- so its easy to deduct that username IS NOT equal name -- so, in your XML theres no node for that username, -- and you have to create it if (username == name) then return i -1 end end end
  10. try little debugging function onquitdb () outputDebugString("player "..getPlayerName(source).." logged out/quit") local root = xmlLoadFile ("playerdb.xml") local index = getUserIndex (getAccountName(getPlayerAccount(source)),root) outputDebugString ("index: "..tostring(index)) if (index) then outputDebugString("if condition was true") local accountR2 = xmlFindChild (root,"user",index) outputDebugString(tostring(accountR2)) -- i think it will be something like "res: 0388782" (random number) if i remember correctly, or it can be false/nil (not sure) if child cant be found for _aux=0, #xmlNodeGetChildren(accountR2)-1 do outputDebugString("for iteration") local charname = getElementData(source,"charname") outputDebugString("charname=="..tostring(charname)) local accountR = xmlFindChild (accountR2,"character",_aux) outputDebugString(tostring(accountR)) -- as above if (tostring(xmlNodeGetAttribute(accountR,"name")) == charname) then outputDebugString("name was equal charname") getmoney = getPlayerMoney (source) outputDebugString("money: "..tostring(getmoney)) x, y, z = getElementPosition ( source ) outputDebugString("xyz: "..tostring(x).." "..tostring(y).." "..tostring(z)) outputDebugString(tostring(xmlNodeSetAttribute (accountR,"x",x))) -- should return true on success (not sure, check in wiki) -- i assume others will be true too if first one is true xmlNodeSetAttribute (accountR,"y",y) xmlNodeSetAttribute (accountR,"z",z) xmlNodeSetAttribute (accountR,"cash",getmoney) xmlNodeSetAttribute (accountR, "w0", getPedWeapon ( source, 0 )) xmlNodeSetAttribute (accountR, "w1", getPedWeapon ( source, 1 )) xmlNodeSetAttribute (accountR, "w2", getPedWeapon ( source, 2 )) xmlNodeSetAttribute (accountR, "a2", getPedTotalAmmo ( source, 2 )) xmlNodeSetAttribute (accountR, "w3", getPedWeapon ( source, 3 )) xmlNodeSetAttribute (accountR, "a3", getPedTotalAmmo ( source, 3 )) xmlNodeSetAttribute (accountR, "w4", getPedWeapon ( source, 4 )) xmlNodeSetAttribute (accountR, "a4", getPedTotalAmmo ( source, 4 )) xmlNodeSetAttribute (accountR, "w5", getPedWeapon ( source, 5 )) xmlNodeSetAttribute (accountR, "a5", getPedTotalAmmo ( source, 5 )) xmlNodeSetAttribute (accountR, "w6", getPedWeapon ( source, 6 )) xmlNodeSetAttribute (accountR, "a6", getPedTotalAmmo ( source, 6 )) xmlNodeSetAttribute (accountR, "w7", getPedWeapon ( source, 7 )) xmlNodeSetAttribute (accountR, "a7", getPedTotalAmmo ( source, 7 )) xmlNodeSetAttribute (accountR, "w8", getPedWeapon ( source, 8 )) xmlNodeSetAttribute (accountR, "a8", getPedTotalAmmo ( source, 8 )) xmlNodeSetAttribute (accountR, "w9", getPedWeapon ( source, 9 )) xmlNodeSetAttribute (accountR, "a9", getPedTotalAmmo ( source, 9 )) xmlNodeSetAttribute (accountR, "w10", getPedWeapon ( source, 10 )) xmlNodeSetAttribute (accountR, "w11", getPedWeapon ( source, 11 )) xmlNodeSetAttribute (accountR, "w12", getPedWeapon ( source, 12 )) end end end end addEventHandler ( "onPlayerQuit", getRootElement(), onquitdb ) addEventHandler ( "onPlayerLogout", getRootElement(), onquitdb ) try this
  11. ah, sorry, i didnt sleep well tonight and got confused ;|
  12. dzek (varez)

    time

    think take pen and paper and try the thing you have to know the most when programming is how to think if you dont want to think - dont try to write scripts example of time converting: take any seconds count divite it by 3600 (60*60 - minutes * seconds) to get how many hours is in that seconds count round down (floor) this value ---- THIS IS HOUR COUNT then multiple this value by 3600 now subtract from 12430 your multiplied value --- lets say its "X" now now divide it by 60 to get minutes round down (floor) this value ---- THIS IS YOUR MINUTES COUNT multiple floored value by 60 from "X" subtract your last value --- THIS IS YOUR SECONDS COUNT simple math looks complcated on forums, easy on script.. and addional help: function doing what you need but written in PYTHON not lua. but its EXTREMLY EASY to convert it.. just 1 minute of thinking.. rly def convert_to_human_time(dana): dana=int(dana) hours = math.floor(dana/3600) minutes = math.floor((dana-hours*3600)/60) seconds = math.floor(dana-hours*3600-minutes*60) retStr = str(int(hours))+"h "+str(int(minutes))+"min "+str(int(seconds))+"s" return retStr - def is the function definition, rest is the function body.. - use tonumber instead of int - in lua you are joining strings not with + but with ".." (two dots) - you dont need that int/tonumber in retStr line in lua
  13. but the problem is i dont really know what do you want.. you said something about mysql, but in your example i cant find anything that looks like fetching data from mysql. these links could be helpful, if you need further help - try to better explain your problem and ask: https://wiki.multitheftauto.com/ https://wiki.multitheftauto.com/wiki/Mysql https://wiki.multitheftauto.com/wiki/Modules/MTA- ... etch_assoc for storing data you can also use SQLite, which is almost like MySQL but doesnt require any addional install https://wiki.multitheftauto.com/wiki/ExecuteSQLSelect (check "See also")
  14. learn and try. this is not forum for REQUEST. 50p = i bet he want to disable all upgrades except nitro and hydralics, becouse hes using custom cars mods, and on custom cars adding upgrades like rooftops/spoilers causing game to crash
  15. dzek (varez)

    time

    do some maths to convert it to hours/minutes/seconds
  16. dzek (varez)

    help

    remember to use: - [lua][/lua] - code indentation that will be much better for us to stop and think about your problem
  17. https://forum.multitheftauto.com/viewtop ... 91&t=27027
  18. dark: 01110111 01100101 01101100 01101100 00101100 00100000 01101010 01110101 01110011 01110100 00100000 01100100 01101111 01101110 00100111 01110100 00100000 01110010 01100101 01100001 01100100 00100000 01100001 01101110 01100100 00100000 01110010 01100101 01110000 01101100 01111001 00100000 00111011 00101001
  19. i edited it this is not an answer for question above o_O
  20. you can also download this: http://upload.dzek.metal.info/pliki/Lua.rar unrar it to C:\Lua (path is important!) then drag-and-drop uncompiled lua file to compile.bat file, and it will be compiled and stored in C:\Lua as luac.out maybe in future i'll prepare better tool for mass-compliing scripts
  21. hes asking about changing server name to include current map name (like: "My super server 25/8 blablabla, map: super_race") im not sure if it was added in 1.0.4 (probably not) to change server name from script
  22. 01001010 01100001 01110011 01110000 01100101 01110010 01001110 01001100 00111101 01000100 00100000 00101101 00100000 01100100 01101111 01101110 01110100 00100000 01110101 01110011 01100101 00100000 01100010 01100001 01100100 00100000 01110111 01101111 01110010 01100100 01110011 00101110 00101110 00100000 01101001 00100000 01101000 01100001 01110110 01100101 00100000 01110100 01101111 00100000 01101101 01100001 01101011 01100101 00100000 01100001 00100000 01110010 01100101 01110000 01101111 01110010 01110100 00100000 01110100 01101111 00100000 01100011 01100101 01101110 01110011 01101111 01110010 01100101 00100000 00100010 01100110 01110101 01100011 01101011 00100010 00100000 01101001 01101110 00100000 01100010 01101001 01101110 01100001 01110010 01111001 00100000 01101111 01101110 00100000 01100110 01101111 01110010 01110101 01101101 01110011 00100000 00111011 01000100 00100000 01100010 01110100 01110111 00111010 00100000 01001010 01100001 01110011 01110000 01100101 01110010 00100000 00101101 00100000 01110111 01101000 01100101 01110010 01100101 00100111 01110010 01100101 00100000 01110011 01110000 01100001 01100011 01100101 01110011 00111111 00100000 00111010 01010000 00001101 00001010 01100001 01101110 01100100 00100000 01110011 01101111 01101101 01100101 01110100 01101000 01101001 01101110 01100111 00100000 01101101 01101111 01110010 01100101 00111010 00001101 00001010 00110000 00110001 00110001 00110000 00110001 00110000 00110000 00110000 00100000 00110000 00110001 00110001 00110000 00110000 00110000 00110000 00110001 00100000 00110000 00110001 00110001 00110000 00110001 00110000 00110000 00110000 00100000 00110000 00110001 00110001 00110000 00110000 00110000 00110000 00110001 00100000 00110000 00110000 00110001 00110000 00110001 00110001 00110000 00110000 00100000 00110000 00110000 00110001 00110000 00110000 00110000 00110000 00110000 00100000 00110000 00110001 00110001 00110000 00110000 00110001 00110000 00110000 00100000 00110000 00110001 00110001 00110000 00110001 00110001 00110001 00110001 00100000 00110000 00110001 00110001 00110001 00110000 00110001 00110000 00110001 00100000 00110000 00110001 00110001 00110000 00110000 00110000 00110001 00110000 00100000 00110000 00110001 00110001 00110000 00110001 00110001 00110000 00110000 00100000 00110000 00110001 00110001 00110000 00110000 00110001 00110000 00110001 00100000 00110000 00110000 00110001 00110000 00110000 00110000 00110000 00110000 00100000 00110000 00110001 00110001 00110000 00110000 00110001 00110000 00110001 00100000 00110000 00110001 00110001 00110000 00110001 00110001 00110001 00110000 00100000 00110000 00110001 00110001 00110000 00110000 00110000 00110001 00110001 00100000 00110000 00110001 00110001 00110000 00110001 00110001 00110001 00110001 00100000 00110000 00110001 00110001 00110000 00110000 00110001 00110000 00110000 00100000 00110000 00110001 00110001 00110000 00110001 00110000 00110000 00110001 00100000 00110000 00110001 00110001 00110000 00110001 00110001 00110001 00110000 00100000 00110000 00110001 00110001 00110000 00110000 00110001 00110001 00110001 00100000 00110000 00110000 00110001 00110000 00110000 00110000 00110000 00110000 00100000 00110000 00110001 00110001 00110001 00110000 00110000 00110001 00110000 00100000 00110000 00110001 00110001 00110000 00110001 00110001 00110001 00110001 00100000 00110000 00110001 00110001 00110001 00110001 00110000 00110000 00110000 00100000 00110000 00110000 00110001 00110000 00110000 00110000 00110000 00110000 00100000 00110000 00110001 00110001 00110001 00110000 00110001 00110000 00110000 00100000 00110000 00110001 00110001 00110000 00110001 00110001 00110001 00110001 00100000 00110000 00110001 00110001 00110000 00110001 00110001 00110001 00110001 00100000 00110000 00110000 00110001 00110000 00110000 00110000 00110000 00110000 00100000 00110000 00110000 00110001 00110001 00110001 00110000 00110001 00110000 00100000 00110000 00110001 00110000 00110000 00110000 00110001 00110000 00110000
  23. interesting 2 months old topic is not interesting
×
×
  • Create New...