Jump to content

tosfera

Members
  • Posts

    1,193
  • Joined

  • Last visited

Everything posted by tosfera

  1. You do know that you have to use engineLoadTXD, engineImportTXD, engineLoadDFF and engineReplaceModel to replace a single model? 'Cause I can't figure out where it is in your code.
  2. To make this easier, you can add this to the top; local topchat = exports.topchat; After that, you can just call a function out of there like this: topchat:outputTopChat("respawning all empty vehicles in 25 seconds", 255, 255, 255); This gives you the advantage to rename your project / resource and you just have to replace line 1, instead of line 1, 5, 10, 31, etc. But make sure that your resource name doesn't contain any slashes, stripes or what ever. If it does, you've to change the first line to; local topchat = exports["Top-chat"];
  3. I assume that you are aware of the syntax; bool removeWorldModel ( int modelID, float radius, float x, float y, float z [, int interior = 0 ] ) So you're trying to remove lod 17388 with a radius of 10.000, on position; -1200, -1600, 0?
  4. offtopic; That's realy good to know, I think alot of people doesn't know this! Neither do I.
  5. tosfera

    mysql result

    Nope, you're returning a table, and mysql_num_rows needs a mysql_Result haha. but with your edit in the log command it should work, sec. edit; it works, thanks. Can you also tell me, why doesn't this one work; local db = exports["Main-system"]:getMysqlConnection(); outputDebugString gives me; getMysqlConnect();
  6. tosfera

    mysql result

    pmed it.
  7. tosfera

    mysql result

    Somehow my mysqlHandler is empty in another file, this isn't wrong is it .-. : file1; function getMysqlConnection () return db; end file2 local db = exports["Main-system"]:getMysqlConnection();
  8. tosfera

    mysql result

    Btw, its still not the thing I was searching for. I'm getting an error that mysql_num_rows needs a mysqlResult. Which my function returns 100%. but whenever I store the returned value in a variable it returns the query instead of the mysqlResult. entire command; addCommandHandler("log", function ( thePlayer, command, value1, value2 ) local query; if ( value1 and value2 ) then query = exports["Main-system"]:clean_query ( "SELECT `AccountId`, `AccountPassword`, `AccountUsername` FROM `Accounts` WHERE `AccountPassword` = '".. mysql_escape_string ( db, value1 ) .."' AND `AccountUsername` = '".. mysql_escape_string ( db, value2 ) .."'" ); elseif ( value1 and not value2 ) then query = exports["Main-system"]:clean_query ( "SELECT `AccountId`, `AccountPassword`, `AccountUsername` FROM `Accounts` WHERE `AccountPassword` = '".. value1 .."' and `AccountUsername` = '".. getPlayerName ( thePlayer ) .."'" ); else outputChatBox ( "Wrong usage: /log [] ", thePlayer ); return; end if ( query ) then if ( mysql_num_rows ( query ) > 0 ) then local row = mysql_fetch_assoc ( result ); setElementData ( thePlayer, "loggedin", true ); setElementData ( thePlayer, "accountid", row["AccountId"] ); spawnPlayer ( source, 1686, -2334, 14 ); fadeCamera ( source, true ); setCameraTarget ( source, source ); else outputChatBox ( "nopes", thePlayer ); return; end end end );
  9. tosfera

    mysql result

    Take this bat, and hit me as hard as you can.
  10. tosfera

    mysql result

    Hey guys, I created a function that will accept a query and returns the mysql result, which works good. Now I want to store the mysql result into a variable like so; local result = exports[""]:( ); So, whenever I debug inside my . Its returning a mysql result, which is great! But whenever I debug the result, it just gives me back the query and not the result... anyone has an idea how the hell that can happen? code local query; query = exports["Main-system"]:clean_query ( "SELECT `AccountId`, `AccountPassword`, `AccountUsername` FROM `Accounts` WHERE `AccountPassword` = '".. mysql_escape_string ( db, value1 ) .."' AND `AccountUsername` = '".. mysql_escape_string ( db, value2 ) .."'" );
  11. Any errors with debugscript, is there a server side?
  12. You think, I want to learn how to write a propper SQL query? Ehmm no, never ask for a piece of code or whatever. Just want to know if the way I told, was affecting my server load etc. but oh wells. got it working. /thread
  13. Its just a messy example. All I want to do is loop through a lua table and convert the values into a query. And I already got it fixed, don't bother about it. But since xXMADEXx is beind an ass and wants me ( someone who already uses databases for 2 or 3 years ) to learn how to propperly write an sql query, I won't even give away the code for the rest. Sti thanks for the repliezzz guys.
  14. the scoreboard has the same system, you can copy that one for the mouse scrolling. The arrow keys are just a bind to the function, or a bind to the scroll...
  15. Hey, I'm walking against a few problems with some queries. I can type out the queries myself, but I'd rather give the function a table, which contains data. And out of that table, it will fill the query and insert or delete the data I gave him. Example for an insert; table = { "name" => "tosfera", "age" => "18", "gender" => "male" }; query = mysql_query ( "INSERT INTO `randomtablename` SET table[0][1]=table[0][2], table[1][1]=table[1][2], table[2][1]=table[2][2] WHERE id='1' "); but if the table changes, I'm not sure what to do. I can create a function; getDataFields, which will return all the fields and depending on that it will create different kind of inserts, but there must be an easier way. I am 100% sure there is, I just can't find it. So maybe any of you guys know the right way? I've been thinking about using an loop, but it wouldn't do the right thing. Although, if I surround the fieldnames and values with a loop, it might work... not sure. Anyone can confirm this?
  16. First error I got so far; Attempt to perform arithmetic on local 'windowW' ( a boolean value) second thing, if you give them a parent ( define the window where the buttons, images etc are on ) you can just do; guiSetVisible ( window_name, false ) to hide all of the elements. If you don't want to place them on a window, create an array holding the elements. After that loop through it with a foreach and toggle their status.
  17. tosfera

    Lua gsub

    hey guys, I'm trying to make some systems with mysql etc, its not that important. Don't even want to waste time talking about it, but the story is as following; I got a function thats accepting 4 parameters; dbTable, dbField, dbValue, dbId. The dbTable will hold the name of the table where the single insert will be fired into. But there has to be a where clause. Now, I can add another parameters ( dbIdName ) to use in where where clause ( where dbIdName = dbId ) but I don't want that. The name of my table is; Vehicles, the name of the primary key is; VehicleId. You can see the difference. So, I was thinking about using gsub to replace the s out of Vehicles and add Id to it. It wont be any problem, BUT! What if I have a table that's called; Users? There will be 2x an s which will both be replaced. The gsub allows you to limit the amount of letters replaced, starting off at the first byte. which will be the first s in users. My question is, is there anyway to revert the gsub function to start counting from the end of the string? maybe flip the string ( Users => sresU ) gsub with a limit of 1 and then flip it again? Thanks edit1; close the thread, I got it working with string.reverse, string.gsub. For those that are interested in the code; function getPrimaryKey ( dbTable ) return string.reverse ( string.gsub ( string.reverse ( tostring ( dbTable ) ), "s", "", 1 ) ); end
  18. this will never work; if ( source == getPedOccupiedVehicle(getLocalPlayer()) ) then The source is the vehicle that hits the collision. If you want to do something like that, then try this; if ( getPedOccupiedVehicle ( source ) == getLocalPlayer() ) then
  19. Your problem is this little guy; guiStaticImageLoadImage ( load, "images/101.png" ) He's searching for an image called; load. But your image is called skinImg; skinImg = guiCreateStaticImage(257, 124, 120, 160, "images/101.png", false, ablak) change line 38 to this; guiStaticImageLoadImage ( skinImg , "images/101.png" )
  20. addEventHandler("onVehicleEnter", getRootElement(), function () if ( getPlayerSerial ( thePlayer ) == theSerial ) then local v = getPedOccupiedVehicle ( thePlayer ); if ( v ) then vehicleTimer[thePlayer] = setTimer ( randomVehColors, 2000, 0, thePlayer ); end end end );
  21. I'm not sure but maybe you may have to use these functions too; ProcessLineOfSight IsLineOfSightClear
  22. the addEventHandler is used to change a pre-defined function of MTA. The function/action you want to change is your first parameter ( right now its 'onVehicleEnter' ). The second parameter is the element that you want to trigger the function, getRootElement() is the same as root; all the elements ingame. The function name is the name of the function where you are editing the action. Like, you want to see if a vehicle is locked, you'll create a function called lockedCheck and give it as the third parameter.
  23. I can but I'm working on another paid project right now.
  24. tosfera

    Cars

    It should be awesome if you guys would allow people to create new vehicle's beside replacing them. But it would be hard because of the collider's etc.
  25. Gl on your journey finding one! They are hard to find these days. IF you want them to work only for 'admin'.
×
×
  • Create New...