Jump to content

Deddalt

Members
  • Posts

    31
  • Joined

  • Last visited

Everything posted by Deddalt

  1. One more thing I want is if you'll make it so I can delete a .lua file that I've created. I right click it and hit "delete", but nothing happens. That's one thing that I'd really like to be fixed. EDIT: I tried to make a new resource and it's telling me "Object reference not set to an instance of an object." Any idea what's wrong?
  2. A few of things that I would love to see: Creating a new lua inside a resource Saving new lua files into resources Possibly when you create a new file, if you want it to be in an existing resource, it would automatically add it to the meta.xml Right-clicking on functions to add them to the meta.xml with But as soon as I can create a new lua file in a resource & save it, I'll start using this as my main method of editing / creating scripts in MTA. You've done a great job
  3. You just had to make me feel stupid, didn't you? Thanks for the help
  4. I have a command to check how much money you have in your wallet (/wallet) and I want to have it do: local wallet = getElementData( sourcePlayer, "wallet" ) outputChatBox( " * You have $"..wallet.." in your wallet.", sourcePlayer, 200, 200, 200 ) But it's giving me a weird string, something along the lines of I have a feeling that this is due to the data being an integer, but if that's the case, how do I make that data into a readable string?
  5. Well, I'm sure you've heard it before, but I think that the Woozie skin (used by Wu Zi Mu in SP) should be in MTA. It's my favorite skin to wear, so... yeah... Note: The skin looks like:
  6. I'm not planning on releasing the script to anyone, I just want to make this script work. It's unfortunate that the two things that I was hoping on using have to not work. setAccountData and SQL... Is there a MySQL plugin for MTA, then? I suppose I'll have to stop using SQLite and learn how to use MySQL instead... This is so annoying...
  7. /me is about to cry So do I need to get a MySQL server or something for this?
  8. Well I know that, but I need an example as to how to check if it's empty... like... local badtablevar = "{ { firstname=' ', lastname=' ' }, { username=' ', password=' ' }, }" if( check == badtablevar ) then triggerClientEvent( source, "register", getRootElement(), firstname, lastname ) else triggerClientEvent( source, "login", getRootElement(), firstname, lastname ) end Or something like that, I don't know what to do, so could someone please tell me how to check for an empty cell?
  9. I take that back. Now I need to know how to check if it doesn't give me anything, because it apparently isn't returning false. local check = executeSQLQuery( "SELECT lastname, firstname FROM player WHERE lastname='"..lastname.."' AND firstname='"..firstname.."'" ) if( check == false ) then username[source].firstname = firstname username[source].lastname = lastname triggerClientEvent( source, "2register", getRootElement(), firstname.."_"..lastname ) else triggerClientEvent( source, "2login", getRootElement() ) username[source].lastname = lastname username[source].firstname = firstname end end I need something to replace: if( check == false ) then
  10. Well I found out that my problem is that I have the tablecreate bug, now everything works since I'm using the SQLite Database Browser.
  11. I updated the first post with the most current code I'm using, but it's still returning the same error.
  12. resRoot = getResourceRootElement(getThisResource()) function createSQLTable( ) executeSQLCreateTable( "table", "username BLOB, password BLOB, lastname TEXT, firstname TEXT, wallet REAL, bank REAL, faction BLOB, admin INTEGER, phours INTEGER, skin INTEGER, pos_x INTEGER, pos_y INTEGER, pos_z INTEGER"..string1..", "..string2..", "..string3 ) end function Connect( ) username = { } username[source] = { } fadeCamera( source, true ) username[source].log = 0 setCameraPosition( source, -2642.8926, 1927.8561, 224.3582 ) setCameraLookAt( source, 1481.1476, -1750.8605, 15.4453 ) setCameraMode( source, "fixed" ) local name = getClientName( source ) local firstname = gettok( name, 1, string.byte( "_" ) ) local lastname = gettok( name, 2, string.byte( "_" ) ) local check = executeSQLQuery( "SELECT lastname, firstname FROM table WHERE lastname = '"..lastname.."'" ) if( not check == false ) then triggerClientEvent( source, "2login", getRootElement() ) username[source].lastname = lastname username[source].firstname = firstname else username[source].firstname = firstname username[source].lastname = lastname triggerClientEvent( source, "2register", getRootElement(), firstname.."_"..lastname ) end end addEventHandler( "onResourceStart", resRoot, createSQLTable ) It is returning the error: ERROR: Database query failed: near "table": syntax error (SELECT lastname, firstname FROM table WHERE lastname == 'Tokudaiji' )
  13. I want to make all of my vehicles in a .map, but I want to be able to handle them individually. Also, I want to have a /start and /stop command for turning vehicles on and off. What would be the shortest way to do this?
  14. You can use it, sure, but it doesn't work.
  15. I'm new to LUA so I can't really tell you if it's possible on MTA, but I know on SA-MP it's impossible.
  16. Deddalt

    Stumped

    Alright, now I've changed a LOT of things, mainly by changing the "AccountData" things to that player database that was released in the scripting forum. Now I get an error (mind you the fadeCamera error is probably still there) that won't let the script start anymore. Here is the script: http://pastebin.com/d23357fae The error is supposedly on line 352, it says:
  17. Deddalt

    Stumped

    Ooh, yeah, that was my desperate state. I didn't set it back, also, it was not working with "source", either.
  18. Deddalt

    Stumped

    I'm currently stumped with my script, I've written a lot for it, and it doesn't seem to have any errors. The only problem is: I tried to use fadeCamera(source, true) when they join the server, but when I join my test server, it doesn't fade the camera in. http://pastebin.com/f52b7dacf < There's the link to the script, if you could help, that would be great. This camera business is doing my head in.
  19. Thanks for the help, MrHankey. Could you tell me if there are any errors with the following things in conjunction with one another? I'm unsure of whether or not it will work. http://pastebin.com/f4aff4e08 http://pastebin.com/fdc648fd That's about all I have at the moment, but please tell me if it has errors. Thank you.
  20. Neither does setAccountData, so I'm going to wait for dp3 to start up this server, heh.
  21. local chatRadius = 20 --units function chat( message, messageType ) if messageType == 0 then local posX, posY, posZ = getElementPosition( source ) local chatSphere = createColSphere( posX, posY, posZ, chatRadius ) local nearbyPlayers = getElementsWithinColShape( chatSphere, "player" ) destroyElement( chatSphere ) for index, nearbyPlayer in ipairs( nearbyPlayers ) do outputChatBox( message, nearbyPlayer ) end if messageType == 1 then if message ~= "" and message ~= nil then local posX, posY, posZ = getElementPosition(source) local chatSphere = createColSphere(posX,posY,posZ, chatRadius) local nearbyPlayers = getElementsWithinColShape(chatSphere, "player") destroyElement(chatSphere) for index, nearbyPlayer in ipairs(nearbyPlayers) do outputChatBox("* "message, nearbyPlayer,255,0,255) end else outputChatBox("USE: /me [action]",source,255,255,0) end end end addEventHandler('onPlayerChat', getRootElement(), chat) I ended up with this when I was looking around on the wiki. However, thanks for the help!
  22. function slashMe(commandName, action) for key, value in ipairs(players) do if(action ~= "" and action ~= nil)then local x,y,z = getElementPos(source) local x2,y2,z2 = getElementPos(players) if(x2 <= x + 5 and y2 <= y + 5 and z2 <= z + 5)then local name = getClientName(source) outputChatBox("* "..name.." "..action,players,255,0,255) -- I HAVE A FEELING THIS WON'T WORK RIGHT outputChatBox("* "..name.." "..action,source,255,0,255) end else outputChatBox("USE: /me [action]",source,255,255,0) end end EDIT: Alright, I've figured it out and fixed all of the problems. I used createColSphere(x,y,z,rad) instead.
  23. Thank god, I was going to cry if I had to rewrite the script. Also, is it possible for the player to modify their account info? I have some understanding that the account data is saved on THEIR computer, which could mean that they can edit it. If that's true, I need to find a way to write their account data to my server.
  24. Alright, I was going to ask this question in IRC, but I can't manage to find GTAnet. But anyway: Again, this is a PAWN example, but on SA-MP you can use a loop to get information from all the players in the server. Something like: for(new i=0;i) So if you did: if(PlayerInfo[i][pStat] == value) doesthisstuff I'm trying to make a /me command, so it will check every player in the server: function slashMe(commandName, action) for(new i=0;i) -- I NEED TO REPLACE THIS WITH AN LUA EQUIVALENT local x,y,z = getElementPos(source) local name = getClientName(source) local x2,y2,z2 = getElementPos(i) if(x2 <= x + 5 and y2 <= y + 5 and z2 <= z + 5)then outputChatBox("* "name.." "..action,i,255,0,255) -- So it sends a message to anyone within a certain vicinity, for example "John_Appleseed makes cans." (in purple) outputChatBox("* "name.." "..action,source,255,0,255) -- Sends the same message to the player who wrote it so they can be sure of what they wrote. else outputChatBox("* "name.." "..action,source,255,0,255) -- Sends the message only to the player. end end So I really need to have an equivalent to the "player loop" from PAWN coding. Thanks for the help.
  25. I'm making one right now, with the help of the scripting forum.
×
×
  • Create New...