Jump to content

rusztamas

Members
  • Posts

    145
  • Joined

  • Last visited

Everything posted by rusztamas

  1. not to annoy you, i really appreciate your helpfulness, but i am really new to this part of programming, and i don't really understand the problem. i picked this one from an other code, in that one it seems to work, here it is not, and i dont really understand the code you posted above. I'm trying to learn all of the functions of programming on a template, and i try to learn that template, but here every commenter posted different codes, and i don't know which one is the best to learn. for example yours is an anonymous function, and i found it interesting.
  2. what is wrong with this one? DB = dbConnect( "mysql", "dbname=teszt;host=127.0.0.1", "root", "mypassword", "share=1" ) local data = dbQuery(DB, "SELECT * FROM feltoltesek WHERE jatekosnev='"..jatekosnev.."'") if (data) then local x = tostring(data["x"]) outputChatBox (""..x.."", jatekos) end 2nd line: attempt to concatenate local 'jatekosnev' (a nil value)
  3. i made a script, that some of the player's data gets recorded into my database. i am very new to mysql, but i need it, and found it useful. i am thankful for the replies, and explanations but i dont really understand it yet. local table = "My Table"; local IsTomOnDatabase = dbExec(DB,"SELECT * FROM "..table.." WHERE jatekosnev=?",'cmdTommy' i've got these ones, but below it i dont. i dont know why i need # before isTomOnDatabase, and why not == instead of =~ and the meaning of 0.please help!
  4. thank you but, what does the # mean in the 6th line before IsTomOnDatabase? and this one:? ~= 0
  5. Hi! I know how to insert data to mysql, but i don't know how to get them, or find them. For example: I'd like to get cmdTommy's X Y and Z and set his position to them, when for example a type in a command. Could you please help me how to do it, and explain how does it work? I use the built-in mysql functions.
  6. Hi! As i log into my server, i recieve a lot of warnings, which are really annoying, due to a timer, who is spamming it, i don't even understand why is it spamming my debugscript, while i am not in a vehicle, just standing. function bekapcsoltOvEllenorzese(jatekos) --this is line 55 if isPedInVehicle (jatekos) == true and getElementData (jatekos, "bekapcsoltOv") == false then if isTimer(beeping) then killTimer (beeping) beeping = setTimer ( function() triggerClientEvent ("beltWarning", jatekos) bindKey (jatekos, "F5", "down", "öv") end, 1000, 0) else beeping = setTimer ( function() triggerClientEvent ("beltWarning", jatekos) bindKey (jatekos, "F5", "down", "öv") end, 1000, 0) end end end addEventHandler ("onVehicleEnter", getRootElement(), bekapcsoltOvEllenorzese) --this is line 71 I am not even in a vehicle, so i don't know why the function gets called, while it has "onVehicleEnter"...
  7. Thank you for your help! You made me understand what the problem was, did this in a few cases too, fixed the buggy script.
  8. now this error is gone, but there is an other, i will post it here as soon as i arrive home from school
  9. Hello! I have the following problem: It is really annoying, because i don't know why is this happening. Whether i am in the car or not, it is spamming the debugscript, and starts, after i sat in the vehicle. function getJarmuElet() local jatekosVehicle = getPedOccupiedVehicle ( localPlayer ) local jarmuHealth = getElementHealth ( jatekosVehicle ) / 10 if jatekosVehicle and jarmuHealth then return jarmuHealth else return nil end end if jarmuHealth > 80 then dxDrawText ("Jármű: #42f448OK!", 1480/devX*jatekosX, 802.5/devY*jatekosY, _, _, _, _, "default-bold", _, _, _, _, _, true) elseif jarmuHealth <= 79 and jarmuHealth >= 51 then dxDrawText ("Jármű: #f49141STOP!", 1475/devX*jatekosX, 802.5/devY*jatekosY, _, _, _, _, "default-bold", _, _, _, _, _, true) elseif jarmuHealth <= 50 then dxDrawText ("Jármű: #f45241SERV!", 1475/devX*jatekosX, 802.5/devY*jatekosY, _, _, _, _, "default-bold", _, _, _, _, _, true) end jarmuHealth's definition in the other function: local jatekosVehicle = getPedOccupiedVehicle (localPlayer) --this one is defined as well, because later there are some things that need the vehicle element local jarmuHealth = getJarmuElet() Line 23 is the 3d line of function getJarmuElet. Sorry for hungarian namings, i already got used to it, but trying to use mixed languages in production code, and trying to use full english next time. But please help, i really don't know what the problem is.
  10. I added a killTimer before setting an other timer. Now this one is solved. Thank you all!
  11. @pa3ck i dont really understand, the script is working, but the sounds are not working properly.
  12. Hi! I'm making as vehicle-realism system. And when i exit the vehicle with no seatbelt on, and re enter it, the beeping alarm of the seatbelt could be heared multiple times, while it should be heared once per a second. Clientside mains: function beltWarning() stopSound (beltAlarm) beltAlarm = playSound ("alarm.mp3", false) end addEvent ("beltWarning", true) addEventHandler ("beltWarning", getRootElement(), beltWarning) function belt() seatBeltOn = playSound ("belt.wav", false) end addEvent ("belt", true) addEventHandler ("belt", getRootElement(), belt) function unbelt() seatBeltOff = playSound ("unbelt.wav", false) end addEvent ("unbelt", true) addEventHandler ("unbelt", getRootElement(), unbelt) Serverside mains: (there might be some useless things, it is not finished jet, i did not take out the ones i will use in action.) function ovElmentDataAdas(jatekos) setElementData (jatekos, "bekapcsoltOv", false) end addEvent ("ovElmentDataAdas", true) addEventHandler ("ovElmentDataAdas", getRootElement(), ovElmentDataAdas) addEventHandler ("onVehicleEnter", getRootElement(), ovElmentDataAdas) function ovElementDataElvetel(jatekos) if getElementData (jatekos, "bekapcsoltOv") == true then setElementData (jatekos, "biztonsagiOv", false) exports.cl_core:localMeAction(jatekos, "kicsatolta a biztonsági övét!") triggerClientEvent ("unbelt", jatekos) end end addEvent ("ovElementDataElvetel", true) addEventHandler ("ovElementDataElvetel", getRootElement(), ovElementDataElvetel) addEventHandler ("onVehicleExit", getRootElement(), ovElementDataElvetel) function seatBelt(jatekos) if isPedInVehicle (jatekos) == true then if getElementData (jatekos, "bekapcsoltOv") == false then setElementData (jatekos, "bekapcsoltOv", true) exports.cl_core:localMeAction(jatekos, "becsatolta a biztonsági övét!") triggerClientEvent ("belt", jatekos) else setElementData (jatekos, "bekapcsoltOv", false) exports.cl_core:localMeAction(jatekos, "kicsatolta a biztonsági övét!") triggerClientEvent ("unbelt", jatekos) end end end addCommandHandler ("öv", seatBelt) addCommandHandler ("sb", seatBelt) addCommandHandler ("belt", seatBelt) addCommandHandler ("seatb", seatBelt) addCommandHandler ("seatbelt", seatBelt) function bekapcsoltOvEllenorzese(jatekos) beeping = setTimer ( function() if isPedInVehicle (jatekos) == true and getElementData (jatekos, "bekapcsoltOv") == false then triggerClientEvent ("beltWarning", jatekos) end bindKey (jatekos, "F5", "down", "öv") end, 1000, 0) end addEventHandler ("onVehicleEnter", getRootElement(), bekapcsoltOvEllenorzese)
  13. is it possible to bind a key to a command?
  14. Hi! I'd like to bind a key on serverside, for a command (/seatbelt), i wrote a pretty good and modern script for it, but its not working with bindKey, it has no errors, i have no clue why. Help please.
  15. Hi! I've been making a speedometer for two damn days now, i finished it yesterday, with all it's positioning and bugs, but i just cant fix one of them. It says: "attempt to perform arthimetic on a boolean value" for this line: local jarmuHealth = getElementHealth ( jatekosVehicle ) / 10 What the problem could be? Any fix for it? It only writes on enter, but the script is working fine, after that, even it's value is not nil. Can i forbid this resource, from outputting anything into debugscript?
  16. nevermind... i re-wrote it and not it's working i dont know what the problem was
  17. Hi! I'm making a hud script, and in my script when you leave the car, the rectangle shall hide, (removeEventHandler on onClientVehicleExit) but it only makes itself invisible, and when i re -enter the car, it becomes darker, an so on. It has a 150 alpha, and it looks very ugly when it is stronger than that. Any help?
  18. Hi! I installed my MTA:SA server on a Linux based machine. I start the mta:sa server, and resizing the putty client sometimes makes the serves's interface strange. Look at the green line, it should be at the bottom, where i can write the commands. It highligts 4 lines, and an empty line. I removed the ip adresses and serials, of the client that tried to join, and mine as well. Looks really strange. Any ideas?
  19. thank you! i will give it a try, after i solve some problems about it.
  20. Hi! I have got a Linux Server installed on my machine, and i will run an MTASA and TS3 server on it. As i remember, i had problems with the console, it was weird-controlable. I installed an application, called screen, but i dont really know how to use it. Is it possible, that i can leave the console, re-join in the console, write commands in the command line and the console, check other servers and etc. Please help me, with this screen and console stuff! Thanks, have a wonderful day! Tommy
  21. Hello! I don't really unserstand some things in this whole stuff. 1) If i have a GUI for example a login system, how to send the textbox's text property to server side, from client side, to attempt a mysql query??? 2) On triggering from client to server, or from client to server, how the arguments work? For example, if i trigger a dxDrawImage function, from serverside, and it's only visible for a given people? I mean this: [client] function drawStuff() function renderDrawStuff() local stuff = dxDrawImage (500, 500, 20, 20, "20px_stuff") end addEventHandler ("onClientRender", getRootElement(), renderDrawStuff) end addEvent ("drawStuff", true) addEventHandler ("drawStuff", getRootElement(), drawStuff) [server] For example, here, i'd like only the command triggerer, to see the icon. function drawAnIcon() triggerClientEvent ("drawStuff", --[[now what XD]]) end addCommandHandler ("drawAnIcon", drawAnIcon) I never understood this argument stuff, tried to find a correct description for it, but did not find, i read other people's scripts, so i could understand them a bit.
  22. I have no idea how to make it with set timer. I'd rather do it on serverside, so people could see each other's armor.
×
×
  • Create New...