-
Posts
52 -
Joined
-
Last visited
Everything posted by [MTA]Weed
-
exports["scoreboard"]:addScoreboardColumn( "Country", getRootElement() , 5, 140, "Country") function showcountry() local flag = exports.admin:getPlayerCountry ( source ) local ip = getPlayerIP( source ) local serial = getPlayerSerial(source) local random = math.random(2,9) if flag then setElementData(source,"",":flags/"..flag..".png") else flag = "N/A" end end addEventHandler("onPlayerJoin",getRootElement(), showcountry) ------------CHECK COUNTRY ------------------ countryNames = { ['AD'] = 'Andorra', ['AE'] = 'United Arab Emirates', ['AF'] = 'Afghanistan', ['AG'] = 'Antigua & Barbuda', ['AI'] = 'Anguilla', ['AL'] = 'Albania', ['AM'] = 'Armenia', ['AN'] = 'Netherlands Antilles', ['AO'] = 'Angola', ['AQ'] = 'Antarctica', ['AR'] = 'Argentina', ['AS'] = 'American Samoa', ['AT'] = 'Austria', ['AU'] = 'Australia', ['AW'] = 'Aruba', ['AZ'] = 'Azerbaijan', ['BA'] = 'Bosnia and Herzegovina', ['BB'] = 'Barbados', ['BD'] = 'Bangladesh', ['BE'] = 'Belgium', ['BF'] = 'Burkina Faso', ['BG'] = 'Bulgaria', ['BH'] = 'Bahrain', ['BI'] = 'Burundi', ['BJ'] = 'Benin', ['BM'] = 'Bermuda', ['BN'] = 'Brunei Darussalam', ['BO'] = 'Bolivia', ['BR'] = 'Brazil', ['BS'] = 'Bahama', ['BT'] = 'Bhutan', ['BU'] = 'Burma', ['BV'] = 'Bouvet Island', ['BW'] = 'Botswana', ['BY'] = 'Belarus', ['BZ'] = 'Belize', ['CA'] = 'Canada', ['CC'] = 'Cocos (Keeling) Islands', ['CF'] = 'Central African Republic', ['CG'] = 'Congo', ['CH'] = 'Switzerland', ['CI'] = "C“te D'ivoire (Ivory Coast)", ['CK'] = 'Cook Iislands', ['CL'] = 'Chile', ['CM'] = 'Cameroon', ['CN'] = 'China', ['CO'] = 'Colombia', ['CR'] = 'Costa Rica', ['CS'] = 'Czechoslovakia', ['CU'] = 'Cuba', ['CV'] = 'Cape Verde', ['CX'] = 'Christmas Island', ['CY'] = 'Cyprus', ['CZ'] = 'Czech Republic', ['DD'] = 'German Democratic Republic', ['DE'] = 'Germany', ['DJ'] = 'Djibouti', ['DK'] = 'Denmark', ['DM'] = 'Dominica', ['DO'] = 'Dominican Republic', ['DZ'] = 'Algeria', ['EC'] = 'Ecuador', ['EE'] = 'Estonia', ['EG'] = 'Egypt', ['EH'] = 'Western Sahara', ['ER'] = 'Eritrea', ['ES'] = 'Spain', ['ET'] = 'Ethiopia', ['FI'] = 'Finland', ['FJ'] = 'Fiji', ['FK'] = 'Falkland Islands (Malvinas)', ['FM'] = 'Micronesia', ['FO'] = 'Faroe Islands', ['FR'] = 'France', ['FX'] = '"France, Metropolitan"', ['GA'] = 'Gabon', ['GB'] = 'United Kingdom', ['GD'] = 'Grenada', ['GE'] = 'Georgia', ['GF'] = 'French Guiana', ['GH'] = 'Ghana', ['GI'] = 'Gibraltar', ['GL'] = 'Greenland', ['GM'] = 'Gambia', ['GN'] = 'Guinea', ['GP'] = 'Guadeloupe', ['GQ'] = 'Equatorial Guinea', ['GR'] = 'Greece', ['GS'] = 'South Georgia and the South Sandwich Islands', ['GT'] = 'Guatemala', ['GU'] = 'Guam', ['GW'] = 'Guinea-Bissau', ['GY'] = 'Guyana', ['HK'] = 'Hong Kong', ['HM'] = 'Heard & McDonald Islands', ['HN'] = 'Honduras', ['HR'] = 'Croatia', ['HT'] = 'Haiti', ['HU'] = 'Hungary', ['ID'] = 'Indonesia', ['IE'] = 'Ireland', ['IL'] = 'Israel', ['IN'] = 'India', ['IO'] = 'British Indian Ocean Territory', ['IQ'] = 'Iraq', ['IR'] = 'Islamic Republic of Iran', ['IS'] = 'Iceland', ['IT'] = 'Italy', ['JM'] = 'Jamaica', ['JO'] = 'Jordan', ['JP'] = 'Japan', ['KE'] = 'Kenya', ['KG'] = 'Kyrgyzstan', ['KH'] = 'Cambodia', ['KI'] = 'Kiribati', ['KM'] = 'Comoros', ['KN'] = 'St. Kitts and Nevis', ['KP'] = "Korea, Democratic People's Republic of'", ['KR'] = '"Korea, Republic of"', ['KW'] = 'Kuwait', ['KY'] = 'Cayman Islands', ['KZ'] = 'Kazakhstan', ['LA'] = "Lao People's Democratic Republic", ['LB'] = 'Lebanon', ['LC'] = 'Saint Lucia', ['LI'] = 'Liechtenstein', ['LK'] = 'Sri Lanka', ['LR'] = 'Liberia', ['LS'] = 'Lesotho', ['LT'] = 'Lithuania', ['LU'] = 'Luxembourg', ['LV'] = 'Latvia', ['LY'] = 'Libyan Arab Jamahiriya', ['MA'] = 'Morocco', ['MC'] = 'Monaco', ['MD'] = '"Moldova, Republic of"', ['MG'] = 'Madagascar', ['MH'] = 'Marshall Islands', ['ML'] = 'Mali', ['MM'] = 'Myanmar', ['MN'] = 'Mongolia', ['MO'] = 'Macau', ['MP'] = 'Northern Mariana Islands', ['MQ'] = 'Martinique', ['MR'] = 'Mauritania', ['MS'] = 'Monserrat', ['MT'] = 'Malta', ['MU'] = 'Mauritius', ['MV'] = 'Maldives', ['MW'] = 'Malawi', ['MX'] = 'Mexico', ['MY'] = 'Malaysia', ['MZ'] = 'Mozambique', ['NA'] = 'Nambia', ['NC'] = 'New Caledonia', ['NE'] = 'Niger', ['NF'] = 'Norfolk Island', ['NG'] = 'Nigeria', ['NI'] = 'Nicaragua', ['NL'] = 'Netherlands', ['NO'] = 'Norway', ['NP'] = 'Nepal', ['NR'] = 'Nauru', ['NT'] = 'Neutral Zone', ['NU'] = 'Niue', ['NZ'] = 'New Zealand', ['OM'] = 'Oman', ['PA'] = 'Panama', ['PE'] = 'Peru', ['PF'] = 'French Polynesia', ['PG'] = 'Papua New Guinea', ['PH'] = 'Philippines', ['PK'] = 'Pakistan', ['PL'] = 'Poland', ['PM'] = 'St. Pierre & Miquelon', ['PN'] = 'Pitcairn', ['PR'] = 'Puerto Rico', ['PT'] = 'Portugal', ['PW'] = 'Palau', ['PY'] = 'Paraguay', ['QA'] = 'Qatar', ['RE'] = 'R‚union', ['RO'] = 'Romania', ['RU'] = 'Russian Federation', ['RW'] = 'Rwanda', ['SA'] = 'Saudi Arabia', ['SB'] = 'Solomon Islands', ['SC'] = 'Seychelles', ['SD'] = 'Sudan', ['SE'] = 'Sweden', ['SG'] = 'Singapore', ['SH'] = 'St. Helena', ['SI'] = 'Slovenia', ['SJ'] = 'Svalbard & Jan Mayen Islands', ['SK'] = 'Slovakia', ['SL'] = 'Sierra Leone', ['SM'] = 'San Marino', ['SN'] = 'Senegal', ['SO'] = 'Somalia', ['SR'] = 'Suriname', ['ST'] = 'Sao Tome & Principe', ['SU'] = 'Union of Soviet Socialist Republics (no longer exi', ['SV'] = 'El Salvador', ['SY'] = 'Syrian Arab Republic', ['SZ'] = 'Swaziland', ['TC'] = 'Turks & Caicos Islands', ['TD'] = 'Chad', ['TF'] = 'French Southern Territories', ['TG'] = 'Togo', ['TH'] = 'Thailand', ['TJ'] = 'Tajikistan', ['TK'] = 'Tokelau', ['TM'] = 'Turkmenistan', ['TN'] = 'Tunisia', ['TO'] = 'Tonga', ['TP'] = 'East Timor', ['TR'] = 'Turkey', ['TT'] = 'Trinidad & Tobago', ['TV'] = 'Tuvalu', ['TW'] = '"Taiwan, Province of China"', ['TZ'] = '"Tanzania, United Republic of"', ['UA'] = 'Ukraine', ['UG'] = 'Uganda', ['UM'] = 'United States Minor Outlying Islands', ['US'] = 'United States of America', ['UY'] = 'Uruguay', ['UZ'] = 'Uzbekistan', ['VA'] = 'Vatican City State (Holy See)', ['VC'] = 'St. Vincent & the Grenadines', ['VE'] = 'Venezuela', ['VG'] = 'British Virgin Islands', ['VI'] = 'United States Virgin Islands', ['VN'] = 'Viet Nam', ['VU'] = 'Vanuatu', ['WF'] = 'Wallis & Futuna Islands', ['WS'] = 'Samoa', ['YD'] = 'Democratic Yemen', ['YE'] = 'Yemen', ['YT'] = 'Mayotte', ['YU'] = 'Yugoslavia', ['ZA'] = 'South Africa', ['ZM'] = 'Zambia', ['ZR'] = 'Zaire', ['ZW'] = 'Zimbabwe', ['PS'] = 'Palestine', ['RS'] = 'Serbia', ['ME'] = 'Montenegro', ['MK'] = 'Macedonia', ['Unknown'] = 'Unknown' } addEventHandler("onPlayerJoin", getRootElement(), function() local country = exports['admin']:getPlayerCountry(source) local ip = getPlayerIP( source ) local serial = getPlayerSerial(source) if country then local thecountry = countryNames[country] setElementData(source, "Country", thecountry) else country = "Unknown"--setElementData(source, "Country", "UNKNW") end end
-
@IIYAMA the problem was in another resource which was not allowing the pickups to respawn, thanks. topic can be closed. thanks @IIYAMA for ur time. @Khadeer143 i really am not interested at your offtopic posts, nor ur self liking posts. but keep up.
-
doesnt get any reply from weapons.
-
there isnt any error on debug, the script should get info from the map, and respawn the pickups. its working perfectly, pickups are there, but the only pickups that respawn, are health and armor. i dont recieve any kind of response from https://wiki.multitheftauto.com/wiki/GetPickupRespawnInterval
-
Hello, anyone got any idea whats wrong with my pickup, everything working well and pickups should respawn by the time given in .map and its working very well for the armor and health pickup, they respawn at the interval they should, but not same as weapons, the dont respawn never, you pick once and they are gone. pickupTable[source] = {} for i, p in ipairs(tempMapTable[source].DMpickup) do local pickup if p.typ == "health" then pickup = createPickup ( p.posX, p.posY, p.posZ, 0, p.amount, p.respawn) elseif p.typ == "armor" then pickup = createPickup ( p.posX, p.posY, p.posZ, 1, p.amount, p.respawn) else pickup = createPickup ( p.posX, p.posY, p.posZ, 2, tonumber(p.typ), p.respawn, p.amount) end setElementInterior(pickup, p.interior) setElementDimension(pickup, getElementDimension(source)) table.insert(pickupTable[source], pickup) end end this should be for the weapon pickups: pickup = createPickup ( p.posX, p.posY, p.posZ, 2, tonumber(p.typ), p.respawn, p.amount)
-
the player only need the CLIENT file so all client files are HERE: /mods/deathmatch/resource-cache/http-client-files whatever you want, add it from there to your webhosting put the link in your MTA config, if you cant understand that, try other options. Even if the file dont exist on the HTTP, the client is still downloading the files from MTA server. https://wiki.multitheftauto.com/wiki/Server_Manual#Configuring_an_external_web_server
-
/mods/deathmatch/resource-cache/http-client-files there are the resources you need to upload on your website. add the link to your resources in mtaserver.conf in line 39
-
<httpdownloadurl>http://yourresources.com</httpdownloadurl> Line 39 in mtaserver.conf
-
strings = { { "_", " " }, { "-", " " }, { "^%[[%w@]+%]", " " }, { "^%a+|", " " }, { "|.+$", " " }, { "1", "" }, { "2", "" }, { "3", "" }, { "4", "" }, { "5", "" }, { "6", "" }, { "7", "" }, { "8", "" }, { "9", "" }, { "0", "" }, } myfont = dxCreateFont("DFHEIMDU_id.ttf",10) nametags_Root = getRootElement() nametags_ResRoot = getResourceRootElement(getThisResource()) nametags_Players = getElementsByType('player') nametags_Me = getLocalPlayer() nametag = {} local nametags = {} local sWidth,sHeight = guiGetScreenSize() local Nametags_Hide = false local Nametags_Scale = 0.4 local Nametags_Alpha_Distance = 30 local Nametags_Distance = 40 local Nametags_Alpha = 255 local Nametags_Text_Bar_Space = -2 local Nametags_Width = 50 local Nametags_Height = 40 local Nametags_Size = 0.4 local Nametags_Outline_Thickness = 10 local Nametags_Alpha_Diff = Nametags_Distance - Nametags_Alpha_Distance Nametags_Scale = 1/Nametags_Scale * 800 / sHeight local maxScaleCurve = { {0, 0}, {3, 3}, {13, 5} } local textScaleCurve = { {0, 0.8}, {0.8, 1.2}, {99, 99} } local textAlphaCurve = { {0, 0}, {25, 100}, {120, 190}, {255, 190} } function nametags.Create ( player ) nametags[player] = true end function nametags.Destroy ( player ) nametags[player] = nil end addEventHandler ( "onClientRender", nametags_Root, function() if getElementData(getLocalPlayer(), "state.hud") == "disabled" then return end for i,player in ipairs(nametags_Players) do if isElement(player) then setPlayerNametagShowing ( player, false ) if not nametags[player] then nametags.Create ( player ) end end end if Nametags_Hide then return end local x,y,z = getCameraMatrix() for player in pairs(nametags) do while true do if not isElement(player) then break end if getElementDimension(player) ~= getElementDimension(nametags_Me) then break end local px,py,pz = getElementPosition ( player ) local bx, by, bz = getPedBonePosition( player, 5 ) if processLineOfSight(x, y, z, px, py, pz, true, false, false, true, false, true) then break end local playerDistance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz ) if playerDistance <= Nametags_Distance then --Get screen position --local sx,sy = getScreenFromWorldPosition ( px, py, pz+0.95, 0.06 ) local sx,sy = getScreenFromWorldPosition( bx + 0, by, bz + 0.4 ) if not sx or not sy then break end --Calculate our components local scale = 1/(Nametags_Scale * (playerDistance / Nametags_Distance)) local alpha = ((playerDistance - Nametags_Alpha_Distance) / Nametags_Alpha_Diff) alpha = (alpha < 0) and Nametags_Alpha or Nametags_Alpha-(alpha*Nametags_Alpha) scale = math.evalCurve(maxScaleCurve,scale) local textScale = math.evalCurve(textScaleCurve,scale) local textAlpha = math.evalCurve(textAlphaCurve,alpha) local outlineThickness = Nametags_Outline_Thickness*(scale) --Requirements local team = getPlayerTeam(player) local level = getElementData(player, "LV") or 0 local class = getElementData(player, "class") local r,g,b = getPlayerNametagColor(player) local offset = (scale) * Nametags_Text_Bar_Space/2 local playerName = getPlayerName(player) for k,v in ipairs (strings) do if string.find( string.lower ( playerName ),v[1]) then playerName = playerName:gsub ( v[1], v[2] ) end end local imageSize = dxGetFontHeight ( textScale*Nametags_Size, myfont ) local lp = getElementData(player, "experience.rank") or "Newbie" --Draw our text --dxDrawText ( playerName, sx, sy - offset, sx, sy - offset, tocolor(0,0,0,255), textScale*Nametags_Size, myfont, "center", "bottom", false, false, false, true, true ) dxDrawText ( playerName.."", sx, sy - offset + 4*scale, sx, sy - offset + 4*scale, tocolor(0,0,0,255), textScale*Nametags_Size*0.75, myfont, "center", "bottom", false, false, false, true, true ) dxDrawText ( playerName.."", sx, sy - offset + 4*scale, sx, sy - offset + 4*scale, tocolor(r,g,b,255), textScale*Nametags_Size*0.75, myfont, "center", "bottom", false, false, false, true, true ) nameWidth = dxGetTextWidth ( playerName.."", textScale*Nametags_Size, myfont ) teamWidth = nameWidth if team then dxDrawText (" ["..getTeamName(team).."] ", sx, sy - offset + 8*scale, sx, sy - offset + 8*scale, tocolor(0,0,0,255), textScale*Nametags_Size*0.75, myfont, "center", "bottom", false, false, false, true, true ) dxDrawText (" ["..getTeamName(team).."] ", sx, sy - offset + 8*scale, sx, sy - offset + 8*scale, tocolor(r,g,b,255), textScale*Nametags_Size*0.75, myfont, "center", "bottom", false, false, false, true, true ) teamWidth = dxGetTextWidth (" ["..getTeamName(team).."] ", textScale*Nametags_Size*0.75, myfont ) end end end ) function nametagsCreate() for i,player in ipairs(getElementsByType"player") do nametags.Create ( player ) end end addEventHandler('onClientResourceStart', nametags_Root, nametagsCreate) function nametagsCreateOnJoin() if source == nametags_Me then return end setPlayerNametagShowing ( source, false ) nametags.Create ( source ) end addEventHandler('onClientPlayerJoin', nametags_Root, nametagsCreateOnJoin) function nametagsDestroy() nametags.Destroy ( source ) end addEventHandler('onClientPlayerQuit', nametags_Root, nametagsDestroy) function math.lerp(from,to,alpha) return from + (to-from) * alpha end function math.evalCurve( curve, input ) if input<curve[1][1] then return curve[1][2] end for idx=2,#curve do if input<curve[idx][1] then local x1 = curve[idx-1][1] local y1 = curve[idx-1][2] local x2 = curve[idx][1] local y2 = curve[idx][2] local alpha = (input - x1)/(x2 - x1); return math.lerp(y1,y2,alpha) end end return curve[#curve][2] end function fixSomeLoops() if (getElementData(source, "player.key") == "") or (getElementData(source, "player.key") == "") or (getElementData(source, "player.key") == "") then cancelEvent() end end addEventHandler("onClientPlayerDamage", getRootElement(), fixSomeLoops) addEventHandler("onPlayerStealthKill", getRootElement(), fixSomeLoops)
-
Client code: strings = { { "_", " " }, { "-", " " }, { "^%[[%w@]+%]", " " }, { "^%a+|", " " }, { "|.+$", " " }, { "1", "" }, { "2", "" }, { "3", "" }, { "4", "" }, { "5", "" }, { "6", "" }, { "7", "" }, { "8", "" }, { "9", "" }, { "0", "" }, } myfont = dxCreateFont("DFHEIMDU_id.ttf",10) nametags_Root = getRootElement() nametags_ResRoot = getResourceRootElement(getThisResource()) nametags_Players = getElementsByType('player') nametags_Me = getLocalPlayer() nametag = {} local nametags = {} local sWidth,sHeight = guiGetScreenSize() local Nametags_Hide = false local Nametags_Scale = 0.25 local Nametags_Alpha_Distance = 50 local Nametags_Distance = 80 local Nametags_Alpha = 255 local Nametags_Text_Bar_Space = 2 local Nametags_Width = 50 local Nametags_Height = 20 local Nametags_Size = 0.3 local Nametags_Outline_Thickness = 2.2 local Nametags_Alpha_Diff = Nametags_Distance - Nametags_Alpha_Distance Nametags_Scale = 1/Nametags_Scale * 800 / sHeight local maxScaleCurve = { {0, 0}, {3, 3}, {13, 5} } local textScaleCurve = { {0, 0.8}, {0.8, 1.2}, {99, 99} } local textAlphaCurve = { {0, 0}, {25, 100}, {120, 190}, {255, 190} } function nametags.Create ( player ) nametags[player] = true end function nametags.Destroy ( player ) nametags[player] = nil end addEventHandler ( "onClientRender", nametags_Root, function() if getElementData(getLocalPlayer(), "state.hud") == "disabled" then return end for i,player in ipairs(nametags_Players) do if isElement(player) then setPlayerNametagShowing ( player, false ) if not nametags[player] then nametags.Create ( player ) end end end if Nametags_Hide then return end local x,y,z = getCameraMatrix() for player in pairs(nametags) do while true do if not isElement(player) then break end if getElementDimension(player) ~= getElementDimension(nametags_Me) then break end local px,py,pz = getElementPosition ( player ) local bx, by, bz = getPedBonePosition( player, 5 ) if processLineOfSight(x, y, z, px, py, pz, true, false, false, true, false, true) then break end local playerDistance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz ) if playerDistance <= Nametags_Distance then --Get screen position --local sx,sy = getScreenFromWorldPosition ( px, py, pz+0.95, 0.06 ) local sx,sy = getScreenFromWorldPosition( bx + 0, by, bz + 0.4 ) if not sx or not sy then break end --Calculate our components local scale = 1/(Nametags_Scale * (playerDistance / Nametags_Distance)) local alpha = ((playerDistance - Nametags_Alpha_Distance) / Nametags_Alpha_Diff) alpha = (alpha < 0) and Nametags_Alpha or Nametags_Alpha-(alpha*Nametags_Alpha) scale = math.evalCurve(maxScaleCurve,scale) local textScale = math.evalCurve(textScaleCurve,scale) local textAlpha = math.evalCurve(textAlphaCurve,alpha) local outlineThickness = Nametags_Outline_Thickness*(scale) --Requirements local team = getPlayerTeam(player) local level = getElementData(player, "LV") or 0 local class = getElementData(player, "class") local r,g,b = getPlayerNametagColor(player) local offset = (scale) * Nametags_Text_Bar_Space/2 local playerName = getPlayerName(player) for k,v in ipairs (strings) do if string.find( string.lower ( playerName ),v[1]) then playerName = playerName:gsub ( v[1], v[2] ) end end local imageSize = dxGetFontHeight ( textScale*Nametags_Size, myfont ) local lp = getElementData(player, "experience.rank") or "Newbie" --Draw our text --dxDrawText ( playerName, sx, sy - offset, sx, sy - offset, tocolor(0,0,0,255), textScale*Nametags_Size, myfont, "center", "bottom", false, false, false, true, true ) dxDrawText ( playerName.."("..level..")", sx, sy - offset + 4*scale, sx, sy - offset + 4*scale, tocolor(0,0,0,255), textScale*Nametags_Size*0.75, myfont, "center", "bottom", false, false, false, true, true ) dxDrawText ( playerName.."("..level..")", sx, sy - offset + 4*scale, sx, sy - offset + 4*scale, tocolor(r,g,b,255), textScale*Nametags_Size*0.75, myfont, "center", "bottom", false, false, false, true, true ) nameWidth = dxGetTextWidth ( playerName.."("..level..")", textScale*Nametags_Size, myfont ) teamWidth = nameWidth if team then dxDrawText (" ["..getTeamName(team).."] ", sx, sy - offset + 8*scale, sx, sy - offset + 8*scale, tocolor(0,0,0,255), textScale*Nametags_Size*0.75, myfont, "center", "bottom", false, false, false, true, true ) dxDrawText (" ["..getTeamName(team).."] ", sx, sy - offset + 8*scale, sx, sy - offset + 8*scale, tocolor(r,g,b,255), textScale*Nametags_Size*0.75, myfont, "center", "bottom", false, false, false, true, true ) teamWidth = dxGetTextWidth (" ["..getTeamName(team).."] ", textScale*Nametags_Size*0.75, myfont ) end if getElementData(player, "class") then dxDrawText (tostring(class), sx, sy - offset - 0*scale, sx, sy - offset - 0*scale, tocolor(0,0,0,255), textScale*Nametags_Size*0.75, myfont, "center", "bottom", false, false, false, true, true ) dxDrawText (tostring(class), sx, sy - offset - 0*scale, sx, sy - offset - 0*scale, tocolor(r,g,b,255), textScale*Nametags_Size*0.75, myfont, "center", "bottom", false, false, false, true, true ) typingWidth = dxGetTextWidth (tostring(class), textScale*Nametags_Size*0.75, myfont ) end if class and team then dxDrawImage ( sx + math.max(nameWidth/2, teamWidth/2) + 1*scale, sy - math.max(teamWidth/6), imageSize, imageSize, ":Nametag/class/"..class..".png" ) elseif class and not team then dxDrawImage ( sx + math.max(nameWidth/2) + 1*scale, sy - math.max(nameWidth/10), imageSize, imageSize, ":Nametag/class/"..class..".png" ) end if getElementData(player, "play.nodm") == true then dxDrawImage ( sx - math.max(nameWidth/2, teamWidth/2) - 7*scale, sy - imageSize, imageSize, imageSize, ":Nametag/class/friendly.png" ) else dxDrawImage ( sx - math.max(nameWidth/2, teamWidth/2) - 7*scale, sy - imageSize, imageSize, imageSize, ":Experience/Emblems/"..lp..".png" ) end end break end end end ) function nametagsCreate() for i,player in ipairs(getElementsByType"player") do nametags.Create ( player ) end end addEventHandler('onClientResourceStart', nametags_Root, nametagsCreate) function nametagsCreateOnJoin() if source == nametags_Me then return end setPlayerNametagShowing ( source, false ) nametags.Create ( source ) end addEventHandler('onClientPlayerJoin', nametags_Root, nametagsCreateOnJoin) function nametagsDestroy() nametags.Destroy ( source ) end addEventHandler('onClientPlayerQuit', nametags_Root, nametagsDestroy) function math.lerp(from,to,alpha) return from + (to-from) * alpha end function math.evalCurve( curve, input ) if input<curve[1][1] then return curve[1][2] end for idx=2,#curve do if input<curve[idx][1] then local x1 = curve[idx-1][1] local y1 = curve[idx-1][2] local x2 = curve[idx][1] local y2 = curve[idx][2] local alpha = (input - x1)/(x2 - x1); return math.lerp(y1,y2,alpha) end end return curve[#curve][2] end function fixSomeLoops() if (getElementData(source, "player.key") == "") or (getElementData(source, "player.key") == "") or (getElementData(source, "player.key") == "") then cancelEvent() end end addEventHandler("onClientPlayerDamage", getRootElement(), fixSomeLoops) addEventHandler("onPlayerStealthKill", getRootElement(), fixSomeLoops) Server: addEventHandler( 'onPlayerLogout', root, function ( ) local class = getElementData(source, "class") if class then setElementData(source, "class", "player") else setElementData(source, "class", "player") end end ) addEventHandler( 'onPlayerLogin', root, function ( ) local account = getPlayerAccount( source ) if account and not isGuestAccount( account ) then local accountName = getAccountName( account ); if isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Marijuana" ) ) then setElementData(source, "class", "Marijuana") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Admin" ) ) then setElementData(source, "class", "Admin") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Moderator" ) ) then setElementData(source, "class", "Moderator") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "SuperModerator" ) ) then setElementData(source, "class", "SuperModerator") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Warden" ) ) then setElementData(source, "class", "Warden") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "EliteVIP" ) ) then setElementData(source, "class", "Elite VIP") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "VIP" ) ) then setElementData(source, "class", "VIP") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Commander" ) ) then setElementData(source, "class", "Commander") elseif isObjectInACLGroup ( "user." .. accountName, aclGetGroup ( "Everyone" ) ) then setElementData(source, "class", "Player") else setElementData(source, "class", "Player") end end end ); i tryed removing everything one by one direcly in server when players was active it didnt show no less/more result, it was same.
-
i removed the images, the ranks, team, player name, font i removed almost everything and its still same.
-
its causing player fps drop high cpu usage client side, from server side there is no problem processor working normaly. https://imgur.com/a/oe1oD
-
Can someone kinda help me im having little trouble, my nametags its edited version or runes of magic nametag, its making clientside cpu leak when more players are in server. i tryed removing almost everything, the emblems, the tags, the team, font everything and its still the same. Clientside code below: strings = { { "_", " " }, { "-", " " }, { "^%[[%w@]+%]", " " }, { "^%a+|", " " }, { "|.+$", " " }, { "1", "" }, { "2", "" }, { "3", "" }, { "4", "" }, { "5", "" }, { "6", "" }, { "7", "" }, { "8", "" }, { "9", "" }, { "0", "" }, } myfont = dxCreateFont("DFHEIMDU_id.ttf",10) nametags_Root = getRootElement() nametags_ResRoot = getResourceRootElement(getThisResource()) nametags_Players = getElementsByType('player') nametags_Me = getLocalPlayer() nametag = {} local nametags = {} local sWidth,sHeight = guiGetScreenSize() local Nametags_Hide = false local Nametags_Scale = 0.3 local Nametags_Alpha_Distance = 30 local Nametags_Distance = 40 local Nametags_Alpha = 255 local Nametags_Text_Bar_Space = 3 local Nametags_Width = 30 local Nametags_Height = 20 local Nametags_Size = 0.3 local Nametags_Outline_Thickness = 2.4 local Nametags_Alpha_Diff = Nametags_Distance - Nametags_Alpha_Distance Nametags_Scale = 1/Nametags_Scale * 800 / sHeight local maxScaleCurve = { {0, 0}, {3, 3}, {13, 5} } local textScaleCurve = { {0, 0.8}, {0.8, 1.2}, {99, 99} } local textAlphaCurve = { {0, 0}, {25, 100}, {120, 190}, {255, 190} } function nametags.Create ( player ) nametags[player] = true end function nametags.Destroy ( player ) nametags[player] = nil end addEventHandler ( "onClientRender", nametags_Root, function() if getElementData(getLocalPlayer(), "state.hud") == "disabled" then return end for i,player in ipairs(nametags_Players) do if isElement(player) then setPlayerNametagShowing ( player, false ) if not nametags[player] then nametags.Create ( player ) end end end if Nametags_Hide then return end local x,y,z = getCameraMatrix() for player in pairs(nametags) do while true do if not isElement(player) then break end if getElementDimension(player) ~= getElementDimension(nametags_Me) then break end local px,py,pz = getElementPosition ( player ) local bx, by, bz = getPedBonePosition( player, 5 ) if processLineOfSight(x, y, z, px, py, pz, true, false, false, true, false, true) then break end local playerDistance = getDistanceBetweenPoints3D ( x,y,z,px,py,pz ) if playerDistance <= Nametags_Distance then --Get screen position --local sx,sy = getScreenFromWorldPosition ( px, py, pz+0.95, 0.06 ) local sx,sy = getScreenFromWorldPosition( bx + 0, by, bz + 0.4 ) if not sx or not sy then break end --Calculate our components local scale = 1/(Nametags_Scale * (playerDistance / Nametags_Distance)) local alpha = ((playerDistance - Nametags_Alpha_Distance) / Nametags_Alpha_Diff) alpha = (alpha < 0) and Nametags_Alpha or Nametags_Alpha-(alpha*Nametags_Alpha) scale = math.evalCurve(maxScaleCurve,scale) local textScale = math.evalCurve(textScaleCurve,scale) local textAlpha = math.evalCurve(textAlphaCurve,alpha) local outlineThickness = Nametags_Outline_Thickness*(scale) --Requirements local team = getPlayerTeam(player) local level = getElementData(player, "LV") or 0 local class = getElementData(player, "class") local r,g,b = getPlayerNametagColor(player) local offset = (scale) * Nametags_Text_Bar_Space/2 local playerName = getPlayerName(player) for k,v in ipairs (strings) do if string.find( string.lower ( playerName ),v[1]) then playerName = playerName:gsub ( v[1], v[2] ) end end local imageSize = dxGetFontHeight ( textScale*Nametags_Size, myfont ) local lp = getElementData(player, "experience.rank") or "Newbie" --Draw our text --dxDrawText ( playerName, sx, sy - offset, sx, sy - offset, tocolor(0,0,0,255), textScale*Nametags_Size, myfont, "center", "bottom", false, false, false, true, true ) dxDrawText ( playerName.."("..level..")", sx, sy - offset + 4*scale, sx, sy - offset + 4*scale, tocolor(0,0,0,255), textScale*Nametags_Size*0.75, myfont, "center", "bottom", false, false, false, true, true ) dxDrawText ( playerName.."("..level..")", sx, sy - offset + 4*scale, sx, sy - offset + 4*scale, tocolor(r,g,b,255), textScale*Nametags_Size*0.75, myfont, "center", "bottom", false, false, false, true, true ) nameWidth = dxGetTextWidth ( playerName.."("..level..")", textScale*Nametags_Size, myfont ) teamWidth = nameWidth if team then dxDrawText (" ["..getTeamName(team).."] ", sx, sy - offset + 8*scale, sx, sy - offset + 8*scale, tocolor(0,0,0,255), textScale*Nametags_Size*0.75, myfont, "center", "bottom", false, false, false, true, true ) dxDrawText (" ["..getTeamName(team).."] ", sx, sy - offset + 8*scale, sx, sy - offset + 8*scale, tocolor(r,g,b,255), textScale*Nametags_Size*0.75, myfont, "center", "bottom", false, false, false, true, true ) teamWidth = dxGetTextWidth (" ["..getTeamName(team).."] ", textScale*Nametags_Size*0.75, myfont ) end if getElementData(player, "class") then dxDrawText (tostring(class), sx, sy - offset - 0*scale, sx, sy - offset - 0*scale, tocolor(0,0,0,255), textScale*Nametags_Size*0.75, myfont, "center", "bottom", false, false, false, true, true ) dxDrawText (tostring(class), sx, sy - offset - 0*scale, sx, sy - offset - 0*scale, tocolor(r,g,b,255), textScale*Nametags_Size*0.75, myfont, "center", "bottom", false, false, false, true, true ) typingWidth = dxGetTextWidth (tostring(class), textScale*Nametags_Size*0.75, myfont ) end if class and team then dxDrawImage ( sx + math.max(nameWidth/2, teamWidth/2) + 1*scale, sy - math.max(teamWidth/6), imageSize, imageSize, ":Nametag/class/"..class..".png" ) elseif class and not team then dxDrawImage ( sx + math.max(nameWidth/2) + 1*scale, sy - math.max(nameWidth/10), imageSize, imageSize, ":Nametag/class/"..class..".png" ) end if getElementData(player, "play.nodm") == true then dxDrawImage ( sx - math.max(nameWidth/2, teamWidth/2) - 7*scale, sy - imageSize, imageSize, imageSize, ":Nametag/class/friendly.png" ) else dxDrawImage ( sx - math.max(nameWidth/2, teamWidth/2) - 7*scale, sy - imageSize, imageSize, imageSize, ":Experience/Emblems/"..lp..".png" ) end end break end end end ) function nametagsCreate() for i,player in ipairs(getElementsByType"player") do nametags.Create ( player ) end end addEventHandler('onClientResourceStart', nametags_Root, nametagsCreate) function nametagsCreateOnJoin() if source == nametags_Me then return end setPlayerNametagShowing ( source, false ) nametags.Create ( source ) end addEventHandler('onClientPlayerJoin', nametags_Root, nametagsCreateOnJoin) function nametagsDestroy() nametags.Destroy ( source ) end addEventHandler('onClientPlayerQuit', nametags_Root, nametagsDestroy) function math.lerp(from,to,alpha) return from + (to-from) * alpha end function math.evalCurve( curve, input ) if input<curve[1][1] then return curve[1][2] end for idx=2,#curve do if input<curve[idx][1] then local x1 = curve[idx-1][1] local y1 = curve[idx-1][2] local x2 = curve[idx][1] local y2 = curve[idx][2] local alpha = (input - x1)/(x2 - x1); return math.lerp(y1,y2,alpha) end end return curve[#curve][2] end function fixSomeLoops() if (getElementData(source, "player.key") == "") or (getElementData(source, "player.key") == "") or (getElementData(source, "player.key") == "") then cancelEvent() end end addEventHandler("onClientPlayerDamage", getRootElement(), fixSomeLoops) addEventHandler("onPlayerStealthKill", getRootElement(), fixSomeLoops)
-
[REL] Delete all empty Vehicles on server or those at 1 location
[MTA]Weed replied to Dutchman101's topic in Resources
Very good, thank you! -
i tryed using server side, but its not opening the gui, not showing nothing on debug too...
-
its giving me a nil value here: local accountname = getAccountName (getPlayerAccount(player))
-
function toggleHatGUI() local accName = getAccountName(getPlayerAccount(player)) if isObjectInACLGroup ( "user." ..accName, aclGetGroup ( "VIP") ) then if vip==false then vip="No" end if guiGetVisible(VipHats) then guiSetVisible(VipHats, false) showCursor(false) elseif vip=="Yes" then guiSetVisible(VipHats, true) showCursor(true) end what is wrong here, anyone?
-
alrady a topic for this one:
-
https://community.multitheftauto.com/index.php?p=resources&s=details&id=8424 https://community.multitheftauto.com/index.php?p=resources&s=details&id=10605 its called backfire
-
im stuck at after respawning with the animation, it dont stop automattly unless you press F1 Freeroam panel then click stop animation.....
-
local spawns = { } spawns[1] = { } spawns[1].x = -2030.1610107422 spawns[1].y = 172.25221252441 spawns[1].z = 28.8359375 spawns[1].rot = 90.0 spawns[2] = { } spawns[2].x = 423.2495 spawns[2].y = 453.2564 spawns[2].z = 564.6321 spawns[2].rot = 120.6928 local rnd = math.random( #spawns ) spawnPlayer( player, spawns[rnd].x, spawns[rnd].y, spawns[rnd].z, spawns[rnd].rot )
-
spawn is working good, my problem is i cant add more spawn points
-
function FreeroamRespawn(player) if not isElement(player) then return end local element = getElementParent(player) if getElementData(player, "state") ~= "Waiting" then return end repeat until spawnPlayer ( player, -711+math.random(1,5), 957+math.random(5,9), 12.4, 90, math.random(312), 0, 0) fadeCamera(player, true) setCameraTarget(player, player) showChat(player, true) toggleAllControls(player, true, true, true) end the first works perfectly but has only 1 spawn locaion, but when i try adding more spawn points it dont work,my gamemode crashes what am i missing? the code below i used to adding more spawn locations. function spawn(player) local spawns = { } spawns[1] = { } spawns[1].x = -2030.1610107422 spawns[1].y = 172.25221252441 spawns[1].z = 28.8359375 spawns[1].rot = 90.0 spawns[2] = { } spawns[2].x = 423.2495 spawns[2].y = 453.2564 spawns[2].z = 564.6321 spawns[2].rot = 120.6928 local rnd = math.random( #spawns ) spawnPlayer( player, spawns[rnd].x, spawns[rnd].y, spawns[rnd].z, spawns[rnd].rot ) end
