Jump to content

Mr.Loki

Members
  • Posts

    667
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by Mr.Loki

  1. Use the code button when posting code: getElementData(thePlayer, "ID") is returning a bool(true/false) Most likely the element data for ID isn't set for the player so it returns false which gives you the error that it is trying to combine a string and a bool. You can output the bool as a string by changing it to this: tostring(getElementData(thePlayer, "ID"))
  2. You would need to import that house model to a 3D modeling software like blender/3ds max (with the plugins that support modifying dff objects) or zmodeler and remove the box and create a new custom collision for the house.
  3. addEventHandler( "onPlayerChat", root, function( msg, ch ) cancelEvent() -- disable default chat and run our code instead. if ch == 0 then local newMsg = string.gsub(msg, '#%x%x%x%x%x%x', '') -- remove color codes from message local newName = string.gsub(getPlayerName(source), '#%x%x%x%x%x%x', '')-- remove color codes from name outputChatBox( newName..': '..newMsg, root, 255, 255, 525) end end )
  4. client is only predefined when calling a custom event from the client. Change it to source. Also you are destroying the element before detaching it which will cause an error.
  5. requestBrowserDomains({"www.convertmp3.io"}) local browser = createBrowser( 1, 1, false ) local currentSound = {} addEvent( 'Play' , true ) addEventHandler( 'Play' , root , function( link ) local vehicle = getPedOccupiedVehicle ( source ) local x, y, z = getElementPosition(vehicle) currentSound[source] = playSound3D( link, x, y, z ) attachElements(currentSound[source],vehicle) setSoundMaxDistance(currentSound[source],30) setSoundVolume(currentSound[source],50) end ) function fetch(_,url) if url and url ~= "" then fetchRemote("http://www.convertmp3.io/fetch/?format=JSON&video="..url, callback) end end addCommandHandler("p",fetch) 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 triggerServerEvent( 'play' , localPlayer , link ) -- trigger the event when the script actially gets the playable link! end end )
  6. Post the changes you made using the triggers. you are probably using localPlayer and not source from the play event
  7. You can use a loop inside another loop. 1 loop for rows and the other for columns. local cols,rows = 4,6 local size = 45 local space = size + 5 addEventHandler( "onClientRender", root, function( ) for row=0,rows-1 do for col=0,cols-1 do dxDrawRectangle( 10+(space*row), 300+(space*col), size, size ) end end end ) Or instead of calculating the positions in real-time you can store it in a table then draw them.
  8. i suggest you just move it to the client and use some triggers
  9. @IIYAMA he did use the last args of those functions which sets the visibility to thePlayer
  10. Check if the player is in a zone Disable the spawning of zombies for the player ???? Profit
  11. Once you unbind it and relaunch the client it will be bound to the z key unfortunately. Maybe you can make an issue here and hope that the team can add it.
  12. You can't unbind it for everyone because it a default MTA bind you just have to tell them to use the unbind command.
  13. Either you didn't type the player's name correctly or your "getPlayerNameFromPart" function is bad. Add a check after the function to check if targetPlayer exists then continue the code.
  14. You don't need any special script to make it toggleable. the Z key has 2 binds on it when the key is "down" it calls "voiceptt 1" to enable voice and when it is "up" it calls "voiceptt 0" to disable voice using the voiceptt command without the 1 or 0 will make it toggle so you can simply bind voiceptt to any key and it will work as you want it. to remove voiceptt bind on z do this /unbind z down voiceptt /unbind z up voiceptt to bind to another key /bind your_key voiceptt The client must change the bind themselves. Also not everyone will like the same keys and shouldnt enforce everyone to use the same keys because not all keyboards are the same layout!
  15. Removing the check that checks if the attacker is an element before checking if the attacker is a player will cause errors because taking fall damage will call this event which does not have an attacker. Edit: It will work as intended but will leave your debug very messy.
  16. NeXTreme's Editor Tools perfect for the job, plus lots more features.
  17. addCommandHandler getPlayerFromPartialName -- custom code (must be added to your code for it to work) getPlayerMoney setPlayerMoney getPedStat -- 24 for the ped's max health setElementHealth
  18. It works fine for me tho Try adding the googleapis domain to your whitelist if you're fetching from client I honestly have no idea. I searched a lot before using the API ad couldn't find anything. Would probably need to enable debugging and check there.
  19. This function is deprecated. This means that its use is discouraged and that it might not exist in future versions. Please use setElementModel instead. local restrictedModels = { [11] = true } function skinCheck ( oldModel, newModel ) if getElementType( source ) == "player" then -- check if the new model is in the restricted table. if restrictedModels[newModel] then -- if not in the acl if not isObjectInACLGroup( "user."..getAccountName( getPlayerAccount( source ), aclGetGroup( "Admin" ))) then -- revert to the previous skin setElementModel( source, oldModel ) end end end end addEventHandler ( "onElementModelChange", root, skinCheck )
  20. After executing your "givadmin" command and getting the player from the "[id]" you then: getPlayerAccount => Get the player's account data. getAccountName => Get the account name from the account data. aclGetGroup => Get the ACL Group you want to add the account name to. aclGroupAddObject => Add the account name to the ACL Group.
  21. I think hacking together a way to get the video length would be far too troublesome than to just use the YouTube API: local apiKey - "yourKey" local videoID = "-6u8vrRM52g" fetchRemote("https://www.googleapis.com/youtube/v3/videos?id="..videoID.."&key="..apiKey.."&fields=items(contentDetails(duration))&part=snippet,contentDetails",fetchCompleted,"",true) function fetchCompleted(data,err) if err == 0 then local videoLengthData = fromJSON(data) if videoLengthData then iprint(videoLengthData) end else outputDebugString("API: Unable to connect to Google APIs") end end If you want to use multiple video ids in a table you can do this: local videoIDS = { "KiVBoh71yqU", "KiVBoh71yqU", "-6u8vrRM52g" } fetchRemote("https://www.googleapis.com/youtube/v3/videos?id="..table.concat(videoIDs,",").."&key="..apiKey.."&fields=items(contentDetails(duration))&part=snippet,contentDetails",fetchCompleted,"",true)
  22. Use a timer or getTickCount to create a delay if the damage is 51 or 19
×
×
  • Create New...