Jump to content

csiguusz

Members
  • Posts

    500
  • Joined

  • Last visited

Everything posted by csiguusz

  1. You cant get a value when doing INSERT (as far as I know), it's only possible with SELECT: function insertData_buyVehicle(vehiclecreated) local modelID = getElementModel(vehiclecreated) local accName = getAccountName ( getPlayerAccount ( source ) ) local color_1, color_2, color3, color4 = getVehicleColor(vehiclecreated) local owner = setElementData(vehiclecreated, "vehicle-owner", accName) local id = executeSQLQuery("SELECT COUNT(ID) as 'id_' FROM player_vehicle") insert = executeSQLQuery("INSERT INTO player_vehicle(ID, modelID,color1,color2,color3,color4,vehicleOwner, vehicleHealth, saveX, saveY, saveZ) VALUES(?,?,?,?,?,?,?,?,?,?,?)", id[1].id_ , modelID, color1, color2, color3,color4, accName, "1000", 2138.6918945313, -1120.3012695313, 26 ) if ( insert ) then outputChatBox("You're the new owner of this car!", source) else outputChatBox("Something went wrong!", source) end end
  2. try this: ........... tff = guiCreateMemo(10, 81, 489, 443, "", false, OutputFenster) ............ function newertext (index,xx, yy, zz) local text = string.format ("%s [%s]=\"%s, %s, %s\"", guiGetText ( tff ),index, xx, yy, zz ); guiSetText ( tff, text ); end addEvent ("guittf", true) addEventHandler ("guittf", getRootElement(), newertext)
  3. You are welcome! Just one advice: don't just copy my code and be happy because it's working. Try to understand it! So next time you will be able to do it alone.
  4. Yes it will save the new position in the interior. For example just check if the player is in interior 0 (in the 3rd line): if (getPlayerIdleTime(thePlayer) > 3000) and ( getElementInterior == 0 ) then --120000
  5. function onIdle (thePlayer) for index, thePlayer in ipairs(getElementsByType("player"))do if (getPlayerIdleTime(thePlayer) > 5000) then --120000 local oldX, oldY, oldZ = getElementPosition (thePlayer) setElementData(thePlayer,"away",{oldX, oldY, oldZ}) setElementInterior ( thePlayer, 1, 681.5, -455.46, -25.6 ) end end end setTimer(onIdle, 5000, 0) function onBack (thePlayer) if getElementData(thePlayer,"away") then local oldPos = getElementData(thePlayer,"away") setElementInterior ( thePlayer, 0, oldPos[1], oldPos[2], oldPos[3] ) end end addCommandHandler("back", onBack) setElementPosition returns 3 values not just one! And checking every player every second is not a good idea I think...
  6. It definitely seems to be possible... so, good luck!
  7. Then do you want a new line after every three cordinates? guiSetText (tff, xx..", "..yy..", "..zz.."\n")
  8. guiSetText (tff, xx.."\n"..yy.."\n"..zz)
  9. csiguusz

    tonumber?

    I don't understand. Do you askin why to store a number as string? Yes, that really has no sense. But for a command handler function it can be useful to make numbers from the strings that the player inputted.
  10. csiguusz

    tonumber?

    Of course it's not needed if something is already a number, just in case you want to convert a string to a number for some reason.
  11. Add resource to Admin group in the ACL.
  12. 50p* I also got some ideas how to do it, but can't try it now, just tomorrow...
  13. I don't think its easy (if not possible) to check if the forklift is trying to lift an object.
  14. For the "element" variable: i think your vehicle is not attached to any element, why do you want to get it? getAttachedElements returns a table.
  15. /me punches tosfera in the face And you are welcome
  16. csiguusz

    easy help

    Edit: It's maybe also possible with a shader instead of setVehicleColor, but sorry, I don't know shaders.
  17. That's not true. ipairs is for indexed tables, it means every item (value) in the table has it's own number: 1 is the index of the first value 2 is the index ot the second's and so on. Example: local indexedTable = { 2, "something", 8239713, "asd" } -- it's is equal to this: local indexedTable2 = { [1] = 2, [2] = "something", [3] = 8239713, [4] = "asd" } --both pairs and ipairs will work in those tables: for i, v in ipairs( indexedTable ) do -- i is the index and v is it's value -- this does the same as above: for i, v in pairs( indexedTable ) do pairs is for not-indexed tables, where instead of the index number can be anthing (numbers or strings) and they can be the same too. --both pairs and ipairs will work in those tables: for i, v in ipairs( indexedTable ) do -- i is the index and v is it's value -- this does the same as above: for i, v in pairs( indexedTable ) do local table = { ["string"] = 2, [7] = "something", ["lua"] = 8239713, [2231] = "asd", ["lua"] = "i have no idea what to write here...", } -- ipairs won't work in this case. for k, v in pairs( indexedTable ) do -- for pairs instead of "i" I usually use "k" wich means key (of the value). -- so, k will be the key( e.g. "string" at the first in this example ) -- and v will be it's value
  18. csiguusz

    easy help

    You are getting this error because of the timer, it doesn't give a player element to the function. If you really want to do it on server-side then do it so: function cham( thePlayer ) if isPedInVehicle( thePlayer ) then local vehicle = getPedOccupiedVehicle( thePlayer ) if vehicle then local r, g, b = math.random( 255 ), math.random( 255 ), math.random( 255 ) setVehicleColor(vehicle, r, g, b) end end end addCommandHandler("cham", cham) setTimer( function() for i, v in ipairs( getElementsByType( "player" ) ) do cham( v ) end end, 5000, 0 )
  19. Yes, I can read. Every single client gets the chat messages and can play a sound if it contains "wtf" for example.
  20. Also possible only on client-side (without triggerClientEvent) : onClientChatMessage playSound
  21. csiguusz

    Tables

    With table.remove you can remove elements from tabke by index: function markerLeave( leaveElement, matchingDimension ) if getElementType( leaveElement ) == "player" then for i, v in ipairs( robbing ) do if v == leaveElement then table.remove( robbing, i ) end end end end And what do you mean by getting players from the table? Use a for loop for example...
  22. Open the log file and check the list in it
  23. It's hard to completly explain how tables work, that's why i gave you a link. In the brackets is the index of the table 1 means the first entry in the table. In this case this first entry is the first (and in this case the only ) returned row from the database. This is also a table (yes a table inside of an another : ) ) and it contains all the data of this row, the names of the keys of the this table are equal to the colum names in the database, and the values are the values of the of those colums in the given row . After the dot comes a name of a key from the second table, wiches value you want to get.
×
×
  • Create New...