-
Posts
2,947 -
Joined
-
Last visited
Everything posted by JR10
-
Well, it's incorrect. This way you are inserting a table inside the table, not inserting two items. The messages table will look like this: local messages = {'First message', {'Second message', 'Third message'}}
-
The point here is to explain what table.insert does, not keep the code short.
-
The image must be covering the menu. Make it smaller, output the code, and just use guiGetScreenSize to draw it full screen.
-
I don't really understand, can you explain a bit better? A screenshot maybe?
-
It's in the right click menu? Oh and, your avatar, really?
-
viewtopic.php?f=91&t=31891#p340283
-
The function's first argument is clearly 'player', yet you're using thePlayer. if getElementType ( player ) == "player" then Then the logic issue, this is a command handler, vehicles can't execute commands, or any other non-player element type for that matter. So, you don't need to check for the type because it will always be a player.
-
The "Rango" element data doesn't exist for the local player, that's why it returns nil and the script complains. Setting a fallback value like zero will prevent such errors: local rang = getElementData(getLocalPlayer(), "Rango") or 0
-
There's no such thing as "destroying" a function. Once it's bound to a command or a key, even nullifying the function's variable won't stop its execution.
-
Store the tick count in a table and check to see if the time is long enough: local anti_spam_tick = {} addCommandHandler('/cmdname', function(player) if (not anti_spam_tick[player] or (anti_spam_tick[player] and getTickCount() - anti_spam_tick[player] > 5000) --[[ 5 seconds ]]) then anti_spam_tick[player] = getTickCount() -- do something else outputChatBox('You must wait 5 seconds', player) end end)
-
Server: local img_data addEventHandler('onResourceStart', resourceRoot, function() fetchRemote('http://www.next-gamer.de/wp-content/uploads/2015/05/url17.jpg', function(data, err) if (err ~= 0) then return end img_data = data end) end) addEventHandler('onPlayerJoin', root, function() if (not img_data) then return end triggerClientEvent(source, 'drawImage', resourceRoot) end) Now image data is a string, you can trigger the string to the client and then use dxCreateTexture and dxDrawImage to draw it. local texture addEvent('drawImage', true) addEventHandler('drawImage', root, function(img_data) texture = dxCreateTexture(img_data) if (not texture) then return end addEventHandler('onClientRender', root, drawTexture) end) function drawTexture() dxDrawImage(0, 0, 320, 240, texture) end
-
You can't use executeSQLQuery (which only operates on registry.db) with dbConnect. On quit, you shouldn't be selecting data from the database since you only want to update. Also, use dbExec when you don't want to return any data. You should get the player's name to match it with the database row. addEventHandler ( "onPlayerQuit", root, function () local money = getPlayerMoney(thePlayer) executeSQLQuery("UPDATE players SET 'money' =? WHERE 'name'=?", money, getPlayerName(source)) end ) If this is all your code, then you're not inserting at all. You have to insert in order for update to update the rows. Perhaps on registering.
-
Remaining time of the timer's next execution, getTimerDetails? Please explain. The wiki page has an example already. setTimer(function() -- code end, 5000, 1) -- 5 seconds
-
You might need a delay between creating the vehicle and warping the ped into it. local limoJobVeh = createVehicle ( 409, x, y, z + 3 ) setTimer(warpPedIntoVehicle, 500, 1, localPlayer,limoJobVeh)
-
Yes, so the messages table will look like this: local messages = {'First message', 'Second message', 'Third message'}
-
onClientClick triggers for key down and up, so it triggers twice for pressing and releasing. Add: if (state ~= 'down') then return end
-
It inserts a new item in the table. local messages = {'First message'} table.insert(messages, 'Second message') table.insert(messages, 'Third message')
-
You already have absoluteX and absoluteY, use them.
-
Try 'refresh' in the console, you might have changed it without refreshing.
-
No, it's not. You're not hiding the window after it's created, which will result in it showing up as soon as the resource start. There's a useless, empty, dx text. Also, WINDOW is not defined, you need to replace it with GUIEditor.window[1]. Next time, don't post code and ask if it's "good", try it yourself and tell us if it outputs errors or warnings.
-
Replace the convertMinsToActualTime function with this: function convertMinsToActualTime ( m ) local hours = 0 while ( m >= 60 ) do m = m - 60 hours = hours + 1 end -- Minutes only if ( hours == 0 ) then return tostring(m).."m" -- Hours and minutes elseif ( hours > 0 ) then return tostring(hours).."h "..tostring(m).."m" end end
-
Because screenx and screeny are not defined here. Use absoluteX and absoluteY.
-
I'm not entirely sure but I guess you can use shaders to replace the headlights texture.