Jump to content

tosfera

Members
  • Posts

    1,193
  • Joined

  • Last visited

Everything posted by tosfera

  1. You can replace objects with your models ( which is an good option, if you replace boxes etc. They aren't getting used alot ). Another thing you can do, which even might be better, replace the ped clothings. You can just equip and unequip them with a single line of code. Check out this functions; addPedClothes
  2. If you got the scripts, than you should be able to script. If you're able to script yourself, you should also be able to open a few ports. Did you create the scripts yourself buddy? ~~~No~~~Problem~~~For~~~The~~~Answer~~~
  3. tosfera

    mysql help

    The best thing to do ( in my eyes ) is to create a database connection whenever your database platform ( if you want to go that deep into the base ofc ) starts. Then create a function for mysql_escape_string, mysql_query, mysql_num_rows etc. In the same resource. Export these functions to some good looking functions. Like; query ( mysql_query ), escape ( mysql_escape_string ). In the database platform, you should use the full function with your db connection. Like this; local db; addEventHandler ( "onResourceStart", getResourceRootElement ( getThisResource() ), function () db = mysql_connect ( "localhost", "username", "password", "database" ); if ( db ) then outputDebugString ( "MySQL connection started succesfully" ); else outputDebugString ( mysql_error( db ) ); end end ); function escape ( str ) return mysql_escape_string ( db, str ); end function insert ( str ) local query = mysql_insert ( db, str ); if ( query ) then outputDebugString ( "MySQL query executed succesfully" ); else outputDebugString ( mysql_error( db ) ); end mysql_free_result ( query ); end Don't forget to export the functions; function="escape" /> function="insert" /> To call an exported function, there are a few ways. The easiest way is; local mysql = exports[""]; After that you can just call an function; addCommandHandler ( "escape", function ( thePlayer, theCommand, str ) outputChatBox ( "Escaped string is: ".. mysql:escape ( str ) ); end );
  4. Keep in mind; this is a dirty way of fixing it. There are other ways, like binding your buttons or restarting the timer whenever a button has been pressed / moved with the JoyPad.
  5. If it does, why don't you fix it. Just create a command that disables the superman and bind it to a button or just solve the bug the right way. Not the dirty way.
  6. You know, the timer should be inside your function... try this; addEventHandler ( "onClientMarkerHit", marker, function ( hitElement ) if ( hitElement == getLocalPlayer() ) then local vehicle = getPedOccupiedVehicle ( hitElement ) if ( vehicle ) then setElementFrozen ( vehicle, true ); setTimer ( function() setElementFrozen ( vehicle, false ); end, 5000, 1 ); end end end );
  7. Maybe it is a good idea to search for the right way to write an addEventHandler. You forgot to return the function name or the marker name. addEventHandler("onClientMarkerHit", , setFrozen); Also add a check to see if thePlayer equals localPlayer.
  8. Everyone started somewhere, so I would say; give it a go? Just go and start to read the wiki and try out some things, if you have any errors we could help you.
  9. If it is full of bugs, why don't you just rewrite it? It would be easier of you ask me.
  10. onVehicleExit gets triggered after you left the vehicle. What you want to do is, whenever the players starts to leave the vehicle. Which is onVehicleStartExit
  11. You should use these functions; bindKey onClientRender dxDrawRectangle / dxDrawImage dxDrawText getPlayerName getElementData getPlayerTeam
  12. MTA doesn't support css. CSS is for HTML, not Lua. However, you can just put that dx resource on your server and export the dx functions. MTA Does support css. You can just call the elements, you just can't give special tags to them. You can just call some of the gui functions. Alot of big servers are using css files to create a nice and smooth looking GUI login screen ( yeah, a GUI. Not DxDraw ) and just use css to make them look awesome.
  13. Ya, it's sql sided. Didn't want to do it there, I should just see if SQL allows you to receive some more info about it. Might post it if I get it working. On a dark and drunk evening or so.
  14. The easiest way to do this, is create a guiCreateEdit and change the style from it with a style.css file. ( I can not be 100% sure, but 90% sure it is. ) I've seen it alot these days!
  15. This is your problem; local PDFrakcio = getPlayersInTeam(thePlayer("Rendorség")) If you want to take all the players out of the team, you've to say which team you want. Right now you've used thePlayer as a function or something like that. Try this; local PDFrakcio = getPlayersInTeam ( getPlayerTeam ( thePlayer ) );
  16. You don't say? But I don't want to do it in the SQL. I want to do it in my db platform made in lua. @Renkon; its the sql side, I'd rather do it in lua. But I'll just leave it, seems impossible.
  17. Realy, I mean... no one knows what a cascade delete is? ._. Maybe if I explain it, people might get an idea if it is possible or not. PLEASE NOTE THAT, SQL KNOWLEDGE IS REQUIRED TO UNDERSTAND THIS! Whenever you got a database containing tables with PK it is no problem. When you're starting to use FK's for relations it will be a little more tricky. I got a database which is build out of relations. I can manualy remove a few rows if someone deletes his character, but if the character has 5 vehicle's, 10 buildings, 35 friends, and like 100 extra rows. I would have to do 4 queries ( 4 tables ) to get his information deleted. To write them all out, it's a pain. Cascade Delete has been made for problems like this, whenever you delete the table 'Characters', cascade will go and search for any tables which have a relationship with the table 'Characters'. If so, he will delete all the records which are bound to that one character. This will continue until all the information from that 1 character is gone. After the information is gone, he will delete the character row itself. Now, is there any possible way to create this in lua? Does the mysql module support a cascade delete..?
  18. This is a medic script. How do you expect to get this working for vehicles. This will never work, better start making a new script...
  19. If you want to display it for every user in the game, you should loop through it using the getElementsByType.
  20. To make TAPL's post complete; The relational operators in Lua are == ~= < > <= >= Qouted from http://www.lua.org/manual/5.1/manual.html#2.5.1
  21. Oke, that is a very ugly way of creating a table containing all the users, I won't create the code for you but take a look at the code I'm using to fill tables; local result = {} while true do local row = mysql_fetch_assoc( iselect ) if (not row) then break end table.insert(result, row) end this will actualy create a table and fill in all the users. All you have to do left is send the table 'result' as a parameter to the client side; triggerClientEvent ( "fillGrid", getRootElement(), result ) by the way, I wouldn't prefer using getRootElement() as a player element. Also, change the client function to; function fillGrid( playerTable) for i, player in ipairs ( playerTable ) do outputChatBox ( playerTable[i]["Name"] ); end end addEvent ( "fillGrid", true ); addEventHandler ( "fillGrid", getRootElement(), fillGrid )
  22. tosfera

    Mysql login

    Done, talk to me when you're there.
  23. tosfera

    Mysql login

    Ya, that's what I told you. You should pick one of them. You can use the dbConnect ( db* functions ) with the mysql_query ( mysql_* functions ).
  24. Hey guys, Not everyone will know what a cascade delete is, if you don't then please don't continue reading. So, since I'm working with a mysql service, I was wondering if it was possible to create a cascade delete in LUA. In my eyes, it isn't possible. but I'd like to hear some reactions from you guys. Thanks
  25. tosfera

    Mysql login

    Hmm, you are using 2 different mysql types here. You are using the db* functions ( dbQuery, dbConnect, dbPoll) and the mysql_* functions ( mysql_query ). Since these are 2 different things, they wont work together. I'd say you can better choose one of them. I'd prefer mysql cause it has more options with error reporting, layout for queries etc. But it is less poof proof. If you know what I mean. The db* functions already uses the mysql_escape_string ( it's another function that escapes all the characters out of it ). but if you can secure your system in a right way, there is no need to worry. The error you are getting is because the 'connection' variable is a dbConnect. and not a mysql_connect. ( mysql_query need a mysql_connect )
×
×
  • Create New...