SDK
Members-
Posts
635 -
Joined
-
Last visited
Everything posted by SDK
-
Show us the code you have made already
-
What do you mean doesnt work? Did you check the binds?
-
It does, right bottom corner. But it is local, so if you join later it will start from 0.
-
I think you're wrong about that https://wiki.multitheftauto.com/wiki/GetPedTotalAmmo int getPedTotalAmmo ( ped thePed, [ int weaponSlot = current ] )
-
Yeah, that's another way of doing it, but I think it's less accurate ( could be wrong tho )
-
Not sure what's wrong then, but if you look again at the spawnBot function, it allows to spawn with a weapon. https://wiki.multitheftauto.com/wiki/Slo ... t#spawnBot element spawnBot ( float x, float y, float z, int rotation = 0, [ int skinID = 0, int interior = 0, int dimension = 0, team theTeam = nil, int weapon = 0, string theMode = "hunting", element theModesubject = nil ] ) exports.Slothbot:spawnBot ( 2031.7695,1008.1705,10.5474+10, 10, 0, 0, 0, nil, 31)
-
Where did that bad argument error happen? Try this, not sure if it'll work: addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), function() handler = mysql_connect("localhost", "table", "pass", "user") cars = mysql_query(handler, "SELECT * FROM vehicles" ) if cars then pCars = mysql_fetch_row( cars ) while pCars do createVehicle( pCars.model, pCars.posx, pCars.posy, pCars.posz ) pCars = mysql_fetch_row( cars ) end mysql_free_result(cars) else outputDebugString("Error executing the query: (" .. mysql_errno(handler) .. ") " .. mysql_error(handler)) end end )
-
It seems like it should work tho, did you try putting it all in one lua file? Also, this is another way of calling functions: function test123() outputChatBox("test123 executed") end local functionName = "test123" _G[functionName] () -- test123 executed
-
That was confusing, the call returns the bot element. bot = call (getResourceFromName("Slothbot"), "spawnBot", 2031.7695,1008.1705,10.5474+10, 10) call (getResourceFromName("Slothbot"), "setBotWeapon", bot, 31)
-
Learn to read, I told you it needs the weapon ID there. https://wiki.multitheftauto.com/wiki/Slo ... tBotWeapon
-
I tried reading this 5 times but still didn't get it
-
https://wiki.multitheftauto.com/wiki/OnPickupHit this has an example, just replace the outputChatBox with your window code
-
The weapon id https://wiki.multitheftauto.com/wiki/Weapons M4 = 356
-
He means, where is the "theButton" variable. Cause you have the wrong variables defined in your function ( again ...): >> https://wiki.multitheftauto.com/wiki/OnClientClick <<
-
Seriously, you should learn LUA. Not random typing. Where's if-then-else -end? function Mouse ( player ) if not isCursorShowing ( player ) then showCursor ( player, true ) else showCursor ( player, false ) end end addCommandHandler ( "mouse", Mouse) This is wrong, check https://wiki.multitheftauto.com/wiki/OnClientClick function addObjectOnClick ( button, state, clickedElement ) ... addEventHandler ( "onClientClick", getRootElement(), addObjectOnClick ) Wtf is this? You're setting text on an object? guiSetText works ONLY on gui labels (guiCreateLabel) local myobject = createObject ( 1300, 2188.064453125, 40.50089263916, 25.705852508545, 0, 0, 0 ) ... guiSetText ( myobject, elementType ) How is this supposed to work? function addObjectOnClick ( button, state, clickedElement ) if ( clickedElement ) then ... guiSetVisible ( clickedElement, false ) else guiSetVisible ( clickedElement, true ) end end
-
... If you want to replace the old scoreboard with dxscoreboard then remove the old scoreboard resource, and rename 'dxscoreboard' to 'scoreboard'
-
It's created with textlib, so you'll have to add mapdisplay:color(r,g,b,a) to it mapdisplay = dxText:create('Map: none', 2, screenHeight - dxGetFontHeight(0.7, 'bankgothic')/2, false, 'bankgothic', 0.7, 'left') mapdisplay:color ( 255, 0, 255, 255 )
-
This is one way how you could do it: 1) Detect the click with onClientClick, it will give you the blockElement and the position clicked on (worldX, worldY, worldZ). 2) Calc the distances between the block's position and world position in x,y,z . 3) The biggest distance is the axis matching the face you clicked on 4) Now the direction is positive on the axis if that distance is +, it's negative on the axis if it's <0 addEventHandler('onClientClick', root, function(button, state, absoluteX, absoluteY, worldX, worldY, worldZ, clickedCube) -- get the position of the clicked cube (assuming this is the center of the cube) local cubeX, cubeY, cubeZ = getElementPosition(clickedCube) -- calc the differences between the two points local difX, difY, difZ = worldX - cubeX, worldY - cubeY, worldZ - cubeZ -- see which face was clicked by checking the longest distance if math.abs(difX) >= math.abs(difY) and math.abs(difX) >= math.abs(difZ) then -- the click was one the x-axis, now look what direction on the axis if difX > 0 then createCube ( worldX + 1, worldY, worldZ ) else createCube ( worldX - 1, worldY, worldZ ) end elseif math.abs(difY) >= math.abs(difX) and math.abs(difY) >= math.abs(difZ) -- the click was one the y-axis, now look what direction on the axis if difY > 0 then createCube ( worldX , worldY + 1, worldZ ) else createCube ( worldX , worldY - 1, worldZ ) end elseif math.abs(difZ) >= math.abs(difX) and math.abs(difZ) >= math.abs(difY) -- the click was one the z-axis, now look what direction on the axis if difZ > 0 then createCube ( worldX , worldY, worldZ + 1 ) else createCube ( worldX , worldY, worldZ - 1 ) end end end )
-
Move what to a higher position? The finish list? I don't understand you, maybe add a screenshot.
-
So what do you expect from us? You should add an editbox, and add the event onClientGUIChanged for it. Everytime when it's triggered, reload the gridlist but filter the maps using string.find
-
Your script is the same as mine, ignore that You'll have to calc the amount of days, hours, minutes and so on out the seconds counter yourself, shouldnt be that hard when you think about it.
-
Ah well, it wasn't really a script. I gave you the functions you needed ( like you asked ) This could be the uptime command: local uptime = 0 setTimer(function() uptime = uptime + 1 end, 1000, 0) addCommandHandler('uptime', function(player) outputChatBox ( "Current server uptime: " .. tostring (uptime) .. " seconds", player) end)
-
setTimer to count the uptime in a variable, viewable in-game depends on your needs. A command or a real counter on the screen? A command is easily done with outputChatBox. If a real counter is wanted, send the variable to the client using triggerClientEvent, and use another setTimer to update it there. Display it using dxDrawText in the onClientRender event. local uptime = 0 setTimer(function() uptime = uptime + 1 end, 1000, 0) -- command addCommandHandler outputChatBox -- on screen triggerServerEvent addEvent addEventHandler setTimer dxDrawText ( in "onClientRender" )
-
Does the /kill command still work (for both admins and normal players)? If not, you should check the ACL for it, could be that some admin screwed up in there. Also, the bindKey is in race_client.lua near the end of the file, line 1416. ( or check here)
