-
Posts
667 -
Joined
-
Last visited
-
Days Won
4
Everything posted by Mr.Loki
-
local ValidIDs = { -- Create a table with valid paintjob ids [1]=true, [2]=true, [3]=true, [4]=true, [5]=true, [6]=true, [7]=true, [8]=true, [9]=true } function addPaintjob(player,_,paintjobID) local acc = getAccountName( getPlayerAccount( player ) ) -- get player account name if not isObjectInACLGroup( "user."..acc, aclGetGroup( "VIP" ) ) then return end -- chekck if player is in ACL 'VIP' and if not then return if tonumber(paintjobID) and ValidIDs[paintjobID] then -- Check if the ID is Valid if isPedInVehicle ( player ) then -- Check if the player is in a vehicle triggerClientEvent( root, "addPJ", resourceRoot, paintjobID, player ) -- trigger the client event setting the player who used the command as the source else outputChatBox( "You are not in a vehicle.", player, 255,100,100 ) end else outputChatBox( "Invalid Paintjob ID.", player, 255,100,100 ) end end addCommandHandler ("addpaintjob",addPaintjob) This is serverside. Also you should store the shaders and textures within a table and delete them when they are no longer needed because i can drain your memory after constant use.
-
@xXGhostXx use Guieditor and addCommandHandler,
-
When you spawn the vehicle -> setVehicleDamageProof true onVehicleEnter -> setVehicleDamageProof false onVehicleExit -> setVehicleDamageProof true
-
He means that players can't enter the passenger seat pressing the G key.
-
Sure. Just ask the player if they have a mic. Problem solved No not at the moment.
-
OnPlayerJoin OutputChatBox
-
Are you using F to enter the interiors? If so then you are probably not enabling the F key after leaving the house pickup/marker/colshape.
-
You need to loop through all players and apply the animation to each player addEventHandler("onClientResourceStart", resourceRoot, function() tabelanimacao.ifp["block"] = "ped" tabelanimacao.ifp["ifp"] = engineLoadIFP("ped.ifp", tabelanimacao.ifp["block"]) for _,player in pairs(getElementsByType'player') do for _, v in ipairs(tabelanimacao.animacoes) do engineReplaceAnimation(player, "ped", v, tabelanimacao.ifp["block"], v) end end end )
-
-- Client function abrir () if painel == false then showCursor(true) addEventHandler("onClientRender", root, Pdx) painel = true else showCursor(false) removeEventHandler("onClientRender", root, Pdx) painel = false end end addEvent("abrir", true) addEventHandler("abrir", resourceRoot, abrir) -- Server function showPanellr(thePlayer) if getElementType( thePlayer ) == "player" then triggerClientEvent(thePlayer, "abrir", thePlayer) end end addEventHandler("onMarkerHit", mrkInicio, showPanellr)
-
You can use callRemote to access another server. The example shows you how. if you are passing the image from within the server to the database you you have to convert the texture to pixels of the format you want dxConvertPixels then save it as a string within the database. I've never tried this but i think it should work. GL
-
Adding local before a variable name turns the var(variable) to a local var which means everything under that local var can access it. function function_name1( ... ) print(message)-- error because the message var does not exist. end addCommandHandler( "test1", function_name1 ) local message = "hello world" function function_name2( ... ) print(message)-- prints "hello world" to the debug to /debugscript 3 end addCommandHandler( "test2", function_name2 ) If we were to make the message var a global var by removing local the first function would be able to access it. Also if you create a local var inside of a function then it will only be visible in that function to everything under it. function function_name1( ... ) local message = "hello world" print(message)-- prints "hello world" to the debug to /debugscript 3 end addCommandHandler( "test1", function_name1 ) function function_name2( ... ) print(message)-- error because the message var does not exist end addCommandHandler( "test2", function_name2 ) Another tip is using local variables allow lua to clean up unused vars better with will save memory so don't use global vars unless you have to.
-
I'm glad i saw this topic because i figured out a bypass to get the links to work. It was not working before because javascript redirects you to the download link after a few seconds to stop bots from using the site So here it is and i can finally fix a music player script i got I don't know how long this will last but there will be a possibility that this will break and this code needs some optimizations. requestBrowserDomains({"www.convertmp3.io"}) local browser = createBrowser( 0, 0, false ) local currentSound function start(_,link) fetch(link) end addCommandHandler("play",start) function fetch(url) if (url) then fetchRemote("http://www.convertmp3.io/fetch/?format=JSON&video="..url, callback) end end function callback(data, error) if (error ~= 0) then return outputChatBox(error) end if (data == "ERROR") then return outputChatBox("data error") end local data = fromJSON("["..data.."]") if (data) then outputChatBox("Title: "..data.title) outputChatBox("Length: "..data.length) outputChatBox("Link: "..data.link) loadBrowserURL( browser, data.link ) end end addEventHandler( "onClientBrowserNavigate", browser, function( link ) if not link:find("www.convertmp3.io") then currentSound = playSound( link ) end end ) This creates a dummy browser and waits for the redirect link to play the sound.
-
remove "http://"
-
I think that's because you didn't whitelist the domain properly. Go to settings > Web Browser > Custom Whitelist and see if there is " www.convertmp3.io" ls listed there.
-
onVehicleExplode destroyElement If you do not want to remove the vehicle as soon as it is destroyed use a timer then destroy the vehicle setTimer
- 3 replies
-
- 1
-
- car destroy
- explosed
-
(and 2 more)
Tagged with:
-
local playerWeapons = { [30]=true, [31]=true} -- Don't create tables in functions that are meant to be statc. addEventHandler ("onClientPlayerWeaponFire", root, function ( weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement ) if playerWeapons[weapon] and getElementType(hitElement)=="vehicle" then -- this checks if the player weapon is in the table and if the hitElement is a vehicle local weaponName = getWeaponNameFromID ( weapon ) -- get the weapon id from the weapon parameter. outputChatBox ( "You are now shooting a car with "..weaponName ) -- this is where you put the weapon name you weren't using it before. end end ) Not tested tell me if there are errors. Should work with weapon id 30 and 31
-
Your code is fine it;s just that you have "Vehicle" instead of "vehicle" and you are using a name with an anonymous function. function function_name( ... ) -- body end addEventHandler( "onClientPedWeaponFire", root, function_name ) -- event not attached to the function so we use a name addEventHandler( "onClientPedWeaponFire", root, -- event attached to the function so we do not use a name function( ... ) -- body end )
-
table.sort(table [, comp]) A comparison function can be provided to customise the element sorting. The comparison function must return a boolean value specifying whether the first argument should be before the second argument in the sequence. The default behaviour is for the < comparison to be made. For example, the following behaves the same as no function being supplied: > t = { 3,2,5,1,4 } > table.sort(t, function(a,b) return a<b end) > = table.concat(t, ", ") 1, 2, 3, 4, 5 We can see if we reverse the comparison the sequence order is reversed. > table.sort(t, function(a,b) return a>b end) > = table.concat(t, ", ") 5, 4, 3, 2, 1 table.insert(table, [pos,] value) Insert a given value into a table. If a position is given insert the value before the element currently at that position: > t = { 1,3,"four" } > table.insert(t, 2, "two") -- insert "two" at position before element 2 > = table.concat(t, ", ") 1, two, 3, four >>>lua-users.org/wiki/TableLibraryTutorial<<<
-
A simple color shader float4 tColor = float4(1,1,1,1); technique tec0 { pass P0 { MaterialDiffuse = tColor; MaterialEmissive = tColor; DiffuseMaterialSource = Material; EmissiveMaterialSource = Material; NormalizeNormals = TRUE; // FillMode = WIREFRAME; // AlphaBlendEnable = TRUE; ColorOp[0] = SELECTARG1; ColorArg1[0] = Diffuse; AlphaOp[0] = SELECTARG1; AlphaArg1[0] = Diffuse; Lighting = true; } } You might want to disable emissive
-
It's a little bit more complicated than this. You will need to use fetchRemote which means you need to whitelist the domain "www.convertmp3.io" with requestBrowserDomains to use their json/xml api to the bottom of the page. When you use the fetchRemote function your response data will be of the format specified and will need to extract the direct link and use that to play the sound with playSound. I've used this api before and some youtube links will not work unless they have special tags indicating that the video is a song.
-
createColSphere when the player starts broadcasting their voice. getElementsWithinColShape Then broadcast the voice to them