-
Posts
667 -
Joined
-
Last visited
-
Days Won
4
Everything posted by Mr.Loki
-
Instead of using col shapes you can use getElementsWithinRange just sayin.
-
Client version -- Create a var to hold a timer. local pTimer addCommandHandler( "yo", function( plr, cmd, ... ) -- Check if there is no timer. if not isTimer( pTimer ) then -- Create a timer of 5 seconds for the player and assign it to the var. pTimer = setTimer(function()end,5000,1) -- Execute code outputChatBox( "All good bro B)") else outputChatBox( "Pls chill. You used this less than 5 seconds ago.") end end ) Server version -- Create a table to hold a timer for each player. local pTimer = {} addCommandHandler( "yo", function( plr, cmd, ... ) -- Check if there is no timer for the player. if not isTimer( pTimer[plr] ) then -- Create a timer of 5 seconds for the player and put it int the table. pTimer[plr] = setTimer(function() pTimer[plr]=nil end,5000,1) -- Execute code outputChatBox( "All good bro B)") else outputChatBox( "Pls chill. You used this less than 5 seconds ago.") end end )
-
The problem is you only set the "text" variable if it falls within your ranges and if it does not then text does not exist. So either add another line to your if else statements: else text = text2 or rename "text2" to "text" which would also keep the variable contained within the function.
-
attachElements setElementAlpha (optional) setCameraTarget
-
You can just invert the function. Change 69 to 0 in the toggleSneak function. My bad.
-
local walkTable = {} function toggleSneak( player, _, state ) if state == "down" then -- if the player presses the walk key down. walkTable[player] = getPedWalkingStyle( player ) -- save the current player's walkstyle to the walkTable table. setPedWalkingStyle( player, 69 ) -- change the walkstyle. else -- if the player releases the key. setPedWalkingStyle( player, walkTable[player] ) -- restore the walkstyle to the original on release. walkTable[player] = nil -- remove the player from the table. end end -- Bind the function to walk key for every player in the server when resource starts. addEventHandler( "onResourceStart", resourceRoot, function( ) for _,player in pairs(getElementsByType'player') do bindKey(player,"walk","both",toggleSneak) end end ) -- Bind the function to walk key when player joins. addEventHandler( "onPlayerJoin", root, function( ) bindKey(source,"walk","both",toggleSneak) end )
-
The os.date() func has been enabled in mta so you can use that instead. os.date() -- returns a string of the current date os.date("*t") -- returns a table of the current date http://lua-users.org/wiki/OsLibraryTutorial
-
Server Client
-
Something like this local lastSkinTable = {} addEventHandler( "onPlayerQuit", root, function( ) local serial = getPlayerSerial( source ) lastSkinTable[serial] = getElementModel( source ) end ) local filePath = "skinDB.json" addEventHandler( "onResourceStart", resourceRoot, function( ) local db = fileExists( filePath ) and fileOpen( filePath ) if not db then return end lastSkinTable = fromJSON( fileRead( db, fileGetSize( db ) ) ) fileClose( db ) end ) addEventHandler( "onResourceStop", resourceRoot, function( ) local db = fileExists( filePath ) and fileOpen( filePath ) or fileCreate( filePath ) fileWrite( db, toJSON( lastSkinTable ) ) fileClose( db ) end ) Then use triggers to pass the data to the client when you need it.
-
Server because the player would be able to edit the file if it were on the client.
-
You can create a database dbConnect, fileCreate, xmlCreateFile to store their skin when they disconnect using their serial. The simplest of the 3 is using fileCreate with the toJSON and fromJSON functions to save the tables.
-
a simple way is using setAccountData to save it when the player leaves the server onPlayerQuit then when the player logs in use getAccountData to get the skin model and add it to your spawnPlayer function in your login panel.
-
1 of your functions[ getElementCurrentSlots, getItemSlots, getElementMaxSlots ] is returning false so debug them use iprint to check the values they return so you can find the culprit
-
IF you're talking about 2 different vehicle mods on the same cars then nope you can't
-
Posted July 11, 2014 I think you're 5 years too late dude ?
-
Works for me tho. You're probably replacing an object and not the default weapon. Here I replaced the default ak ID 355.
-
change color at line 10 delete "-6908161" and use tocolor() to make objects glow just edit the code a bit dxDrawMaterialLine3D( x, y, z-size, x, y, z+size, rt, size*2, tocolor(150,150,255) ) and use the x,y,z of the object
-
No need for a shader local rt = dxCreateRenderTarget( 500, 500, true ) local x,y,z = -1981.938, 273.126, 34.2 local size = 2 dxSetRenderTarget( rt ) dxDrawCircle ( 250, 250, 250, 0.0, 360.0, tocolor(255,255,255,50), -1, 32 ) dxSetRenderTarget( ) addEventHandler( "onClientPreRender", root, function( ) dxDrawMaterialLine3D( x, y+size, z, x, y-size, z, rt, size*2, -6908161, x,y,z+1 ) end )