Jump to content

AGENT_STEELMEAT

Members
  • Posts

    551
  • Joined

  • Last visited

Everything posted by AGENT_STEELMEAT

  1. Ehhm, the function works - as I stated above, I'm just looking for someone who is good with the MySQL aspect of it to tell me if I've left out something important. And "if client and source ~= client then return end" is a small form of anticheat.
  2. AGENT_STEELMEAT

    how ?

    no, its createColTube. The col tube should be the size of the marker. Then, attatch the colTube to the marker, and the marker to the ship.
  3. ... You removed local from 'username' and 'password' ...? Then you removed if 'client and source ~= client then return end'? Ohh, and then you changed the source of the event from RESOURCE_ROOT to source? None of those changes make sense...
  4. is onPlayerToptimeImprovment being triggered? Make the first thing in that function outputDebugString and see what happens.
  5. One - it was a shameless self bump, thats the whole point. Two - I was looking for someone with lots of mysql experience to look at this.
  6. AGENT_STEELMEAT

    how ?

    You need to use a colshape... createColTube
  7. *** Shameless self-bump *** Can anyone give any input on this?
  8. So, I was just wondering if someone with more experience with MySQL / MySQL-based gamemodes can tell me if I have any bugs / flaws left in this system that I should fix. In other words, Did I Do It Right? addEvent("registerRequest", true) function processReqisterRequest(username, password) if client and source ~= client then return end local databaseNode = databaseConnection() if not databaseNode then return end local username = mysql_escape_string(databaseNode, username) local origPassword = password local password = mysql_escape_string(databaseNode, password) local accountQuery = mysql_query(databaseNode, "SELECT * FROM accounts WHERE username = \'"..string.lower(username).."\'") if accountQuery then if mysql_num_rows(accountQuery) == 0 then local serialCheck = mysql_query(databaseNode, "SELECT * FROM accounts WHERE firstSerial = \'"..getPlayerSerial(source).."\'") if serialCheck then if mysql_num_rows(serialCheck) < 3 then --local newAccount = mysql_query(databaseNode, "INSERT INTO accounts (username, password, registerDate, firstSerial) VALUES (\'"..string.lower(username).."\', \'"..password.."\', NOW(), \'"..getPlayerSerial(source).."\')") local newAccount = true if newAccount then triggerClientEvent(source, "registerSuccess", RESOURCE_ROOT, "You have successfully registered an account! You may now login.") mysql_free_result(newAccount) else --ERROR CODE REG1 triggerClientEvent(source, "registerFailure", RESOURCE_ROOT, "Unable to perform the registration query! Please contact an admin. [ERROR CODE: REG1]") end else triggerClientEvent(source, "registerFailure", RESOURCE_ROOT, "You may only register up to 3 accounts here! Contact [email protected] for account recovery instructions.") return end mysql_free_result(serialCheck) else --ERROR CODE REG2 triggerClientEvent(source, "registerFailure", RESOURCE_ROOT, "Unable to perform the registration query! Please contact an admin. [ERROR CODE: REG2]") return end else triggerClientEvent(source, "registerFailure", RESOURCE_ROOT, "An account with this name already exists!") end mysql_free_result(accountQuery) else --ERROR CODE REG3 triggerClientEvent(source, "registerFailure", RESOURCE_ROOT, "Unable to perform the registration query! Please contact an admin. [ERROR CODE: REG3]") return end end
  9. for i,v in ipairs(getElementsByType("vehicle")) do if getElementModel(v) == INFERNUSMODELNUMBERHERE then setVehicleHandling(v, handlingType, value) end end
  10. First, you should use getPedBonePosition to find the position of the players head, rather than the element position.
  11. This is a bit unneccesary, but I liked your solution so much that I went ahead and cleaned it up a bit. You can now provide your own arguments for the outline size and outline color. http://pyropaste.net/n7T30E114
  12. The latest 1.0.5 client is 261.
  13. AGENT_STEELMEAT

    or...

    The LUA users wiki states it pretty well: So as far as your first snippet of code goes, only the second one would work properly. Also, for your second snippet of code, only the second would work properly.
  14. Hi all - Just starting out with some code re-write on a project of mine, and was wondering if I have picked the right data types for my MySQL tables. Here is part of the onResourceStart stuff - it updates the accounts table. mysql_query(databaseNode, "CREATE TABLE IF NOT EXISTS accounts (ID INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY)") mysql_query(databaseNode, "ALTER TABLE accounts ADD username varchar(32) NOT NULL") mysql_query(databaseNode, "ALTER TABLE accounts ADD password varchar(32) NOT NULL"); mysql_query(databaseNode, "ALTER TABLE accounts ADD registerDate datetime NOT NULL DEFAULT 0"); mysql_query(databaseNode, "ALTER TABLE accounts ADD lastLoginDate datetime NOT NULL DEFAULT 0"); mysql_query(databaseNode, "ALTER TABLE accounts ADD accountCash BIGINT UNSIGNED NOT NULL DEFAULT 1000"); mysql_query(databaseNode, "ALTER TABLE accounts ADD accountBankCash BIGINT UNSIGNED NOT NULL DEFAULT 1000"); mysql_query(databaseNode, "ALTER TABLE accounts ADD spawnX SMALLINT NOT NULL DEFAULT 2019.142"); mysql_query(databaseNode, "ALTER TABLE accounts ADD spawnY SMALLINT NOT NULL DEFAULT 1545.708"); mysql_query(databaseNode, "ALTER TABLE accounts ADD spawnZ SMALLINT NOT NULL DEFAULT 10.827"); mysql_query(databaseNode, "ALTER TABLE accounts ADD spawnInt SMALLINT NOT NULL DEFAULT 0"); mysql_query(databaseNode, "ALTER TABLE accounts ADD spawnDim SMALLINT NOT NULL DEFAULT 0"); mysql_query(databaseNode, "ALTER TABLE accounts ADD spawnRot SMALLINT NOT NULL DEFAULT 270"); mysql_query(databaseNode, "ALTER TABLE accounts ADD playerSkin TINYINT UNSIGNED NOT NULL DEFAULT 0"); mysql_query(databaseNode, "ALTER TABLE accounts ADD accountSerial VARCHAR NOT NULL DEFAULT 0"); Also note: -Usernames are limited to 32 characters. -Passwords are stored as MD5 hashes. Thanks for the advice!
  15. Kimmis it isn't all that hard. Just use createColTube to create a colshape the exact same size of the marker, and place it inside the marker.
  16. Ohh shit I didn't notice his post about it not working. If that's the problem then, using a colshape would be better then, and should work.
  17. Well, if you have a bunch of markers of the same function, it would be cleaner to do: local titsMarkerRoot = createElement("markerRoot", "titsMarkerRoot") --A parent element for all markers that output "TITS" when entered local assMarkerRoot = createElement("markerRoot", "assMarkerRoot") --A parent element for all markers that output "ASS" when entered local titsMarker1 = createMarker( 0, 0, 0, "corona", 3, 0, 255, 0, 255) local titsMarker2 = createMarker( 1, 1, 1, "corona", 3, 0, 255, 0, 255) setElementParent(titsMarker1, titsMarkerRoot) setElementParent(titsMarker2, titsMarkerRoot) local assMarker1 = createMarker( 2, 2, 2, "corona", 3, 0, 255, 0, 255) local assMarker2 = createMarker( 0, 0, 0, "corona", 3, 0, 255, 0, 255) setElementParent(assMarker1, assMarkerRoot) setElementParent(assMarker2, assMarkerRoot) function markerHit(hitElement, dimensionMatch) --Note the dimension match - which is true if the player and the marker are in the same dimension if not dimensionMatch then return false end local parent = getElementParent(source) if parent == titsMarkerRoot then outputChatBox("TITS") return true --Don't forget to RETURN, to end execution of the function elseif parent == assMarkerRoot then outputChatBox("ASS") return true else outputChatBoc("ASS AND TITTIES!") return true end end addEventHandler("onMarkerHit", root, markerHit) Also - you should be RETURNING some value (whether it be true, false, or nil (nothing)). Once you do what you want to do for that marker, there's no need to continue execution. Another thing: you should only bother to execute the function if the dimensions match (in most cases).
  18. Why would you attach the handler to the root element when you only care about the single marker? kimmis - post any error you are getting.
  19. "This noob"? Looks like your the noob here, as this is a very basic resource. There should be no need to explain how the module works as the only way you can use mysql with MTA is to install the module.
  20. How about this: Look at the LS nodes, and create blips at each node. Find too related nodes, and see how their definition in the script relates to their 3D representation. If you've already done this, I'd suggest trying to contact the scripts owner. Another thing is that maybe you should post the 'findNodeClosestToPoint' and 'calculatePathbyNodeIDs' functions here, as there *might* be some sort of small bug there.
  21. Ahh, I'm seeing it now. From what I can tell, you are correct for the most part. A node is placed at every road intersection or along key points on a curve. The real question is the ordering of the nodes - N then S, E then W, stuff like that. I'd say you should experiment with point close to 0, 0, 0 for simplicity's sake.
  22. Well, I'd tell you to post the whole script, but this actually looks like a nicer script than most. If you have a server I could join and see the problem for myself, or maybe if you could send me a bit more code than what you would post publicly, I can be of more help.
  23. no, heres an example of how variable scoping works: globalVariable = "global" --A global variable available across all scripts local localVariable1 = "local" --A local variable only available in this script (the SCOPE here is the entire script) function testFunction() --A global function local localVariable3 = "local" --A local variable only available in this function end local function testFunction2() --A local function only available in this script return end As for you, kimmis, try this: local arrowMarker function warptheplayer (hitElement, dimensionMatch) if dimensionMatch then --Straightfoward - if the dimensions match, then continue. setElementInterior(hitElement, 9, 315.48, 984.13, 1959.11 ) end end function androint ( playerSource, commandName, arg1 ) --arg1 is just the first argument, more can be passed on. arrowMarker = createMarker ( -1357.26953125, -76.0087890625, 14.146192550659, "arrow", .75, 255, 0, 0, 170 ) local andro = createVehicle ( 592, -1357.4599609375, -55.9248046875, 19.1484375) --Create a Andro. No need to perform arithmetic on constants.. attachElements ( arrowMarker, andro, 0, 0, 5 ) --Attach the marker to the adnro addEventHandler( "onMarkerHit", arrowMarker, warptheplayer ) end addCommandHandler ( "hat", androint )
×
×
  • Create New...