-
Posts
730 -
Joined
-
Last visited
-
Days Won
2
Everything posted by koragg
-
Replace the function with same name in your "mods\deathmatch\resources\[admin]\admin\server\admin_server.lua" file with this: function aAction ( type, action, admin, player, data, more ) if ( aLogMessages[type] ) then function aStripString ( string ) string = tostring ( string ) local adminguy if getElementType ( admin ) == "player" then adminguy = addTeamColor(admin) else adminguy = getPlayerName(admin) end string = string.gsub ( string, "$admin", adminguy ) string = string.gsub ( string, "$by_admin_4all", isAnonAdmin4All( admin ) and "" or "" .. adminguy ) string = string.gsub ( string, "$by_admin_4plr", isAnonAdmin4Victim( admin ) and "" or "" .. adminguy ) string = string.gsub ( string, "$data2", more or "" ) if ( player ) then string = string.gsub ( string, "$player", addTeamColor ( player ) ) end return tostring ( string.gsub ( string, "$data", data or "" ) ) end local node = aLogMessages[type][action] if ( node ) then local r, g, b = node["r"], node["g"], node["b"] if ( node["all"] ) then outputChatBox ( aStripString ( node["all"] ), _root, r, g, b, true ) end if ( node["admin"] ) and ( admin ~= player ) then outputChatBox ( aStripString ( node["admin"] ), admin, r, g, b, true ) end if ( node["player"] ) then outputChatBox ( aStripString ( node["player"] ), player, r, g, b, true ) end if ( node["log"] ) then outputServerLog ( aStripString ( node["log"] ) ) end end end end function addTeamColor(player) local playerTeam = getPlayerTeam(player) if ( playerTeam ) then local r,g,b = getTeamColor(playerTeam) local n1 = toHex(r) local n2 = toHex(g) local n3 = toHex(b) if r <= 16 then n1 = "0"..n1 end if g <= 16 then n2 = "0"..n2 end if b <= 16 then n3 = "0"..n3 end return "#"..n1..""..n2..""..n3..""..getPlayerNametagText(player) else return getPlayerNametagText(player) end end function toHex(n) local hexnums = {"0","1","2","3","4","5","6","7", "8","9","A","B","C","D","E","F"} local str,r = "",n%16 if n-r == 0 then str = hexnums[r+1] else str = toHex((n-r)/16)..hexnums[r+1] end return str end And replace everything in your "mods\deathmatch\resources\[admin]\admin\conf\messages.xml" file with this: <messages> <!-- Accepted subgroups: all - Output to chatbox for all log - Log file output player - Victim/Player chatbox output admin - Admin chatbox output Variables: $player - player $admin - admin $data - Additional information, not all the nodes use it. $data2 - Additional information, not all the nodes use it. --> <player> <group action="ban" r="255" g="0" b="0"> <all>#FFFFFF$player #FF0000was banned by #FFFFFF$by_admin_4all#FF0000. $data2</all> <log>ADMIN: $admin has banned $player $data $data2</log> </group> <group action="kick" r="255" g="0" b="0"> <all>#FFFFFF$player #FF0000was kicked by #FFFFFF$by_admin_4all#FF0000.</all> <log>ADMIN: $admin has kicked $player $data</log> </group> <group action="mute" r="255" g="0" b="0"> <all>#FFFFFF$player #FF0000was muted by #FFFFFF$by_admin_4all#FF0000.#FF0000 #00FF00$data2</all> <log>ADMIN: $admin has muted $player $data $data2</log> </group> <group action="setnick" r="255" g="0" b="0"> <log>ADMIN: $player name changed to $data2 $by_admin_4all.</log> </group> <group action="unmute" r="0" g="255" b="100"> <all>#FFFFFF$player #00FF00was unmuted by #FFFFFF$by_admin_4all#00FF00.</all> <log>ADMIN: $admin has unmuted $player</log> </group> <group action="freeze" r="255" g="0" b="0"> <admin>#FFFFFF$player #FF0000was frozen by #FFFFFF$by_admin_4all#FF0000.</admin> <player>#FF0000You were frozen by #FFFFFF$by_admin_4plr#FF0000.</player> <log>ADMIN: $admin has frozen $player</log> </group> <group action="unfreeze" r="0" g="255" b="100"> <admin>#FFFFFF$player #00FF00was unfrozen by #FFFFFF$by_admin_4all#00FF00.</admin> <player>#00FF00You were unfrozen by #FFFFFF$by_admin_4plr#00FF00.</player> <log>ADMIN: $admin has unfrozen $player</log> </group> <group action="slap" r="235" g="20" b="200"> <all>#FFFFFF$player #EB14C8was slapped by #FFFFFF$by_admin_4all#EB14C8. #00FF00($data HP)</all> <log>ADMIN: $admin has slapped $player ($data HP)</log> </group> <group action="shout" r="255" g="100" b="30"> <admin>#FF641EYou shouted at #FFFFFF$player#FF641E.</admin> </group> <group action="sethealth" r="0" g="170" b="170"> <admin>#FFFFFF$player#00AAAA's health was changed to #FFFFFF$data#00AAAA.</admin> <player>#00AAAAYour health was changed to #FFFFFF$data#00AAAA by #FFFFFF$by_admin_4plr#00AAAA.</player> <log>ADMIN: $admin has changed $player's health to $data</log> </group> <group action="setarmour" r="122" g="122" b="122"> <admin>#FFFFFF$player#7A7A7A's armour was changed to #FFFFFF$data#7A7A7A.</admin> <player>#7A7A7AYour armour was changed to #FFFFFF$data #7A7A7Aby #FFFFFF$by_admin_4plr#7A7A7A.</player> <log>ADMIN: $admin has changed $player's armour to $data</log> </group> <group action="setmoney" r="225" g="170" b="90"> <admin>#FFFFFF$player#FFAA5A's money was set to #FFFFFF$data#FFAA5A.</admin> <player>#FFAA5AYour money was set to #FFFFFF$data #FFAA5Aby #FFFFFF$by_admin_4plr#FFAA5A.</player> <log>ADMIN: $admin has set $player's money to $data</log> </group> <group action="setskin" r="255" g="122" b="0"> <admin>#FFFFFF$player#FF7A00's skin was changed to #FFFFFF$data#FF7A00.</admin> <player>#FF7A00Your skin was changed to #FFFFFF$data #FF7A00by #FFFFFF$by_admin_4plr#FF7A00.</player> <log>ADMIN: $admin has changed $player's skin to $data</log> </group> <group action="setteam" r="255" g="255" b="0"> <admin>#FFFFFF$player #FFFF00was moved to team #FFFFFF$data#FFFF00.</admin> <player>#FFFF00You were moved to team #FFFFFF$data #FFFF00by #FFFFFF$by_admin_4plr#FFFF00.</player> <log>ADMIN: $admin has moved $player to the $data team</log> </group> <group action="removefromteam" r="255" g="255" b="0"> <admin>#FFFFFF$player #FFFF00was removed from team #FFFFFF$data#FFFF00.</admin> <player>#FFFF00You were removed from team #FFFFFF$data #FFFF00by #FFFFFF$by_admin_4plr#FFFF00.</player> <log>ADMIN: $admin has removed $player from the $data team</log> </group> <group action="setinterior" r="0" g="255" b="0"> <admin>#FFFFFF$player #00FF00was moved to the #FFFFFF$data #00FF00interior.</admin> <player>#00FF00You were moved to the #FFFFFF$data #00FF00interior by #FFFFFF$by_admin_4plr#00FF00.</player> <log>ADMIN: $admin has moved $player to the $data interior</log> </group> <group action="setdimension" r="0" g="255" b="0"> <admin>#FFFFFF$player #00FF00was moved to the #FFFFFF$data #00FF00dimension.</admin> <player>#00FF00You were moved to the #FFFFFF$data #00FF00dimension by #FFFFFF$by_admin_4plr#00FF00.</player> <log>ADMIN: $admin has moved $player to the $data dimension</log> </group> <group action="setstat" r="255" g="122" b="0"> <admin>#FFFFFF$player#FF7A00's #FFFFFF$data #FF7A00was set to #FFFFFF$data2#FF7A00.</admin> <player>#FF7A00Your #FFFFFF$data #FF7A00was set to #FFFFFF$data2 #FF7A00by #FFFFFF$by_admin_4plr#FF7A00.</player> <log>ADMIN: $admin has changed $player's $data to $data2</log> </group> <group action="jetpackr" r="255" g="0" b="0"> <admin>#FFFFFF$player#FF0000's jetpack was removed.</admin> <player>#FF0000Your jetpack was removed by #FFFFFF$by_admin_4plr#FF0000.</player> <log>ADMIN: $admin has removed $player's jetpack</log> </group> <group action="jetpacka" r="255" g="122" b="0"> <admin>#FFFFFF$player #FF7A00was given a jetpack.</admin> <player>#FF7A00You were given a jetpack by #FFFFFF$by_admin_4plr#FF7A00.</player> <log>ADMIN: $admin has given a jetpack to $player</log> </group> <group action="adminr" r="255" g="0" b="0"> <admin>#FFFFFF$player#FF0000's admin rights were revoked.</admin> <player>#FF0000Your admin rights were revoked by #FFFFFF$by_admin_4plr#FF0000.</player> <log>ADMIN: $admin has revoked admin privilegies from $player</log> </group> <group action="admina" r="0" g="255" b="0"> <admin>#FFFFFF$player #00FF00was given admin rights.</admin> <player>#00FF00You were give admin rights by #FFFFFF$by_admin_4plr#00FF00.</player> <log>ADMIN: $admin has given admin privilegies to $player</log> </group> <group action="givevehicle" r="0" g="255" b="0"> <admin>#FFFFFF$player #00FF00was given a #FFFFFF$data#00FF00.</admin> <player>#00FF00You were given a #FFFFFF$data #00FF00by #FFFFFF$by_admin_4plr#00FF00.</player> <log>ADMIN: $admin has given $player a '$data'" </log> </group> <group action="giveweapon" r="0" g="0" b="255"> <admin>#FFFFFF$player #0000FFwas given a #FFFFFF$data #0000FF(#FFFFFF$data2#0000FF).</admin> <player>#0000FFYou were given a #FFFFFF$data #0000FF(#FFFFFF$data2#0000FF) by #FFFFFF$by_admin_4plr#0000FF.</player> <log>ADMIN: $admin has given $player '$data'</log> </group> <group action="warp" r="0" g="200" b="50"> <admin>#00C832You warped to #FFFFFF$player#00C832.</admin> <log>ADMIN: $admin has warped to $player</log> </group> <group action="warpto" r="0" g="200" b="50"> <admin>#FFFFFF$player #00C832was warped to #FFFFFF$data#00C832.</admin> <player>#00C832You were warped to #FFFFFF$data #00C832by #FFFFFF$by_admin_4plr#00C832.</player> <log>ADMIN: $admin has moved $player to $data</log> </group> </player> <team> <group action="createteam" r="225" g="170" b="90"> <admin>#E1AA5ASuccessfully created team $data#E1AA5A.</admin> <log>ADMIN: $admin has created a team '$data'</log> </group> <group action="destroyteam" r="225" g="170" b="90"> <admin>#E1AA5ASuccessfully destroyed team $data#E1AA5A.</admin> <log>ADMIN: $admin has destroyed a team '$data'</log> </group> </team> <vehicle> <group action="repair" r="0" g="255" b="0"> <admin>#FFFFFF$player#00FF00's vehicle was fixed.</admin> <player>#00FF00Your vehicle was fixed by #FFFFFF$by_admin_4plr#00FF00.</player> <log>ADMIN: $admin has fixed vehicle of $player</log> </group> <group action="blowvehicle" r="255" g="0" b="0"> <admin>#FFFFFF$player#FF0000's vehicle was blown.</admin> <player>#FF0000Your vehicle was blown by #FFFFFF$by_admin_4plr#FF0000.</player> <log>ADMIN: $admin has blown vehicle of $player</log> </group> <group action="destroyvehicle" r="255" g="0" b="0"> <admin>#FFFFFF$player#FF0000's vehicle was destroyed.</admin> <player>#FF0000Your vehicle was destroyed by #FFFFFF$by_admin_4plr#FF0000.</player> <log>ADMIN: $admin has destroyed vehicle of $player</log> </group> <group action="customize" r="225" g="170" b="90"> <admin>#FFFFFF$player#E1AA5A's vehicle was upgraded. (#FFFFFF$data#E1AA5A)</admin> <player>#E1AA5AYour vehicle was upgraded by #FFFFFF$by_admin_4plr#E1AA5A.</player> <log>ADMIN: $admin has upgraded vehicle of $player ($data)</log> </group> <group action="customizer" r="225" g="170" b="90"> <admin>#FFFFFF$player#E1AA5A's vehicle upgrades were removed.</admin> <player>#E1AA5AYour vehicle upgrades were removed by #FFFFFF$by_admin_4plr#E1AA5A.</player> <log>ADMIN: $admin has has removed vehicle upgrades of $player</log> </group> <group action="setpaintjob" r="225" g="170" b="90"> <admin>#FFFFFF$player#E1AA5A's vehicle paint job set to #FFFFFF$data#E1AA5A.</admin> <player>#E1AA5AYour vehicle paint job was changed to #FFFFFF$data#E1AA5A by #FFFFFF$by_admin_4plr#E1AA5A.</player> <log>ADMIN: $admin has changed paint job of $player's vehicle to $data</log> </group> <group action="setcolor" r="225" g="170" b="90"> <admin>#FFFFFF$player#E1AA5A's vehicle color changed.</admin> <player>#E1AA5AYour vehicle color was changed by #FFFFFF$by_admin_4plr#E1AA5A.</player> <log>ADMIN: $admin has changed color of $player's vehicle</log> </group> <group action="setlights" r="225" g="170" b="90"> <admin>#FFFFFF$player#E1AA5A's vehicle lights color changed.</admin> <player>#E1AA5AYour vehicle lights color was changed by #FFFFFF$by_admin_4plr#E1AA5A.</player> <log>ADMIN: $admin has changed lights color of $player's vehicle</log> </group> <group action="setplates" r="225" g="170" b="90"> <admin>#FFFFFF$player#E1AA5A's license plates were changed to #FFFFFF$data#E1AA5A.</admin> <player>#E1AA5AYour vehicle license plates were changed to #FFFFFF$data #E1AA5Aby #FFFFFF$by_admin_4plr#E1AA5A.</player> <log>ADMIN: $admin has changed license plates of $player's vehicle to '$data'</log> </group> </vehicle> <resource> </resource> <server> <group action="setgame" r="225" g="170" b="90"> <admin>#E1AA5AASE gamemode info was changed to #FFFFFF$data#E1AA5A.</admin> <log>ADMIN: $admin has changed ASE gamemode to '$data'</log> </group> <group action="setmap" r="225" g="170" b="90"> <admin>#E1AA5AASE map info was changed to #FFFFFF$data#E1AA5A.</admin> <log>ADMIN: $admin has changed ASE map info to '$data'</log> </group> <group action="setwelcome" r="225" g="170" b="90"> <admin>#E1AA5AWelcome message was set to #FFFFFF$data#E1AA5A.</admin> <log>ADMIN: $admin has set welcome message to '$data'</log> </group> <group action="resetwelcome" r="225" g="170" b="90"> <admin>#E1AA5AWelcome message was reset.</admin> <log>ADMIN: $admin has reset the welcome message</log> </group> <group action="setpassword" r="225" g="170" b="90"> <admin>#E1AA5AServer's password was set to #FFFFFF$data#E1AA5A.</admin> <log>ADMIN: $admin has set server password to '$data'</log> </group> <group action="resetpassword" r="225" g="170" b="90"> <admin>#E1AA5AServer's password was reset.</admin> <log>ADMIN: $admin has reset server password</log> </group> <group action="settime" r="225" g="170" b="90"> <all>#E1AA5ATime was set to #FFFFFF$data#E1AA5A by #FFFFFF$by_admin_4all#E1AA5A.</all> <log>ADMIN: $admin has changed time to $data</log> </group> <group action="setweather" r="225" g="170" b="90"> <all>#E1AA5AWeather was set to #FFFFFF$data#E1AA5A by #FFFFFF$by_admin_4all#E1AA5A.</all> <log>ADMIN: $admin has set weather to '$data'</log> </group> <group action="blendweather" r="225" g="170" b="90"> <admin>#E1AA5ABlending weather to #FFFFFF$data#E1AA5A.</admin> <log>ADMIN: $admin is blending weather to '$data'</log> </group> <group action="setgravity" r="225" g="170" b="90"> <all>#E1AA5AGravitation value was set to #FFFFFF$data#E1AA5A by #FFFFFF$by_admin_4all#E1AA5A.</all> <log>ADMIN: $admin has set gravitation to $data</log> </group> <group action="setgamespeed" r="225" g="170" b="90"> <all>#E1AA5AGame speed was set to #FFFFFF$data#E1AA5A by #FFFFFF$by_admin_4all#E1AA5A.</all> <log>ADMIN: $admin has set game speed to '$data'</log> </group> <group action="setwaveheight" r="225" g="170" b="90"> <all>#E1AA5AWaves height was set to #FFFFFF$data#E1AA5A by #FFFFFF$by_admin_4all#E1AA5A.</all> <log>ADMIN: $admin has set waves height to '$data'</log> </group> <group action="setblurlevel" r="225" g="170" b="90"> <all>#E1AA5ABlur level was set to #FFFFFF$data#E1AA5A by #FFFFFF$by_admin_4all#E1AA5A.</all> <log>ADMIN: $admin has set blur level to '$data'</log> </group> </server> <bans> <group action="unbanip" r="225" g="170" b="90"> <admin>#E1AA5AIP: $data was successfully removed from bans list.</admin> <log>ADMIN: $admin has unbanned IP $data</log> </group> <group action="unbanserial" r="225" g="170" b="90"> <admin>#E1AA5ASERIAL: $data was successfully removed from bans list.</admin> <log>ADMIN: $admin has unbanned Serial $data</log> </group> <group action="banip" r="225" g="170" b="90"> <admin>#E1AA5AIP: $data was successfully added to bans list.</admin> <log>ADMIN: $admin has banned IP $data</log> </group> <group action="banserial" r="225" g="170" b="90"> <admin>#E1AA5ASERIAL: $data was successfully added to bans list.</admin> <log>ADMIN: $admin has banned Serial $data</log> </group> </bans> <admin> <group action="create" r="225" g="170" b="90"> <admin>#FFFFFF$data #E1AA5Awas successfully created.</admin> <log>ADMIN: $data has been created by $admin</log> </group> <group action="destroy" r="225" g="170" b="90"> <admin>#FFFFFF$data #E1AA5Awas successfully destroyed.</admin> <log>ADMIN: $data has been destroyed by $admin</log> </group> <group action="password" r="50" g="255" b="50"> <admin>#32FF32Your password was successfully changed to #FFFFFF$data#32FF32.</admin> </group> <group action="settings" r="225" g="170" b="90"> <admin>#E1AA5A#FFFFFF$data #E1AA5Awas set to #FFFFFF$data2#E1AA5A.</admin> <log>ADMIN: Set '$data' to '$data2' by $admin</log> </group> </admin> </messages> Ofcourse make a backup before doing any of this Good luck, looks nice if you ask me (better than to just remove color codex imo).
-
I fixed my admin resource and made it show the actual color of the nickname (not the hex code). If you want i can give you my stuff. Answer here when you can.
-
Fixed, thanks! client: local sx,sy = guiGetScreenSize() local px,py = 1600,900 local x,y = (sx/px), (sy/py) ------------------------------------------------------------------------------------------------------------------------- ------------------- --- NFS NOS --- ------------------- local nostype = 'nfs' function toggleNitro(k, s) local v = getPedOccupiedVehicle(localPlayer) if v and getVehicleUpgradeOnSlot(v, 8) ~= 0 and not isElementFrozen(v) then if nostype == 'hybrid' then if s=='down' then setVehicleNitroActivated(v, not isVehicleNitroActivated(v)) setElementData(v, 'nitro', {s==not isVehicleNitroActivated(v), getVehicleNitroLevel(v)}) end elseif nostype == 'nfs' then setVehicleNitroActivated(v, s=='down') setElementData(v, 'nitro', {s==not isVehicleNitroActivated(v), getVehicleNitroLevel(v)}) end end end bindKey("vehicle_fire", 'both', toggleNitro) bindKey("vehicle_secondary_fire", 'both', toggleNitro) ------------------------------------------------------------------------------------------------------------------------- function callNosFix(k, s) if nostype == 'nfs' then if isEventHandlerAdded("onClientRender", root, nosFix) == false then addEventHandler("onClientRender", root, nosFix) end elseif nostype == 'hybrid' then local veh = getPedOccupiedVehicle(localPlayer) local noslvl = false if veh and getVehicleUpgradeOnSlot(veh, 8) ~= 0 and not isElementFrozen(veh) then local nosOn if isVehicleNitroActivated(veh) then nosOn = true else nosOn = false end noslvl = getVehicleNitroLevel(veh) setElementData(veh, 'nitro', {s==not isVehicleNitroActivated(veh), noslvl}) if isEventHandlerAdded("onClientRender", root, nosFix) == false and nosOn == false then addEventHandler("onClientRender", root, nosFix) end end end end bindKey("vehicle_fire", 'up', callNosFix) bindKey("vehicle_secondary_fire", 'up', callNosFix) ------------------------------------------------------------------------------------------------------------------------- function stopCallingNosFix() if nostype == 'nfs' or nostype == 'hybrid' then if isEventHandlerAdded("onClientRender", root, nosFix) == true then removeEventHandler("onClientRender", root, nosFix) end end end bindKey("vehicle_fire", 'down', stopCallingNosFix) bindKey("vehicle_secondary_fire", 'down', stopCallingNosFix) ------------------------------------------------------------------------------------------------------------------------- function delNos() local veh = getPedOccupiedVehicle(localPlayer) local nitrolvl = false if veh and getVehicleUpgradeOnSlot(veh, 8) ~= 0 and not isElementFrozen(veh) then nitrolvl = getVehicleNitroLevel(veh) end if nitrolvl and math.floor(nitrolvl/1*100) < 1 then removeVehicleUpgrade(veh, 1010) setTimer(addNos, 40000, 1) end end addEventHandler("onClientRender", root, delNos) ------------------------------------------------------------------------------------------------------------------------- local is100 = false function addNos() local veh = getPedOccupiedVehicle(localPlayer) if veh and getVehicleUpgradeOnSlot(veh, 8) == 0 then addVehicleUpgrade(veh, 1010) setVehicleNitroLevel(veh, 1.0) is100 = true end end ------------------------------------------------------------------------------------------------------------------------- function nosFix(k, s) local veh = getPedOccupiedVehicle(localPlayer) local nos = false if veh and getVehicleUpgradeOnSlot(veh, 8) ~= 0 and not isElementFrozen(veh) then if is100 == true then setElementData(veh, 'nitro', {s==not isVehicleNitroActivated(veh), 0}) is100 = false end nos = getElementData(veh, "nitro") end if nos and nos[2] ~= nil and nos[2] ~= false and nos[2] > 0 then setVehicleNitroLevel(veh, nos[2]) end end ------------------------------------------------------------------------------------------------------------------------- addEvent'setNitroType' addEventHandler('setNitroType', root, function(type) nostype = type end) addCommandHandler('nostype', function(c, type) nostype = type end) ------------------------------------------------------------------------------------------------------------------------- -- This syncs nitro states and levels from other clients addEventHandler('onClientElementDataChange', root, function(name) if name ~= 'nitro' or getVehicleOccupant(source) == localPlayer then return end local data = getElementData(source, 'nitro') setVehicleNitroActivated(source, data[1]) setVehicleNitroLevel(source, data[2]) end) ------------------------------------------------------------------------------------------------------------------------- -- Nitro Meter function nitroShow() if isPedInVehicle(localPlayer) then local car = getCameraTarget() local nitro = getVehicleNitroLevel(getPedOccupiedVehicle(localPlayer)) if car and getElementType(car) == "vehicle" then nitro = getVehicleNitroLevel(car) end if isPlayerMapVisible() then return end if nitro ~= false and nitro ~= nil and nitro > 0 then dxDrawText((math.floor(nitro/1*100)).."% Nitro", x*1463+1, y*134.5+1, x*1455+1, y*74+1, tocolor(0, 0, 0, 255), 1.30*y, "default-bold", "center", "center", false, false, false, false, false) dxDrawRectangle(x*1396, y*92, x*126, y*23, tocolor(44, 44, 44, 255), false) dxDrawRectangle(x*1396, y*92, x*126/10*10*nitro, y*23, tocolor(0, 70, 149, 255), false) dxDrawText((math.floor(nitro/1*100)).."% Nitro", x*1463, y*134.5, x*1455, y*74, tocolor(255, 255, 255, 255), 1.30*y, "default-bold", "center", "center", false, false, false, false, false) else dxDrawText("No Nitro", x*1463+1, y*134.5+1, x*1455+1, y*74+1, tocolor(0, 0, 0, 255), 1.30*y, "default-bold", "center", "center", false, false, false, false, false) dxDrawRectangle(x*1396, y*92, x*126, y*23, tocolor(44, 44, 44, 255), false) dxDrawRectangle(x*1396, y*92, x*126, y*23, tocolor(0, 70, 149, 255), false) dxDrawText("No Nitro", x*1463, y*134.5, x*1455, y*74, tocolor(255, 255, 255, 255), 1.30*y, "default-bold", "center", "center", false, false, false, false, false) end end end addEventHandler("onClientRender",getRootElement(),nitroShow) ------------------------------------------------------------------------------------------------------------------------- function isEventHandlerAdded(sEventName, pElementAttachedTo, func) if type(sEventName) == 'string' and isElement(pElementAttachedTo) and type(func) == 'function' then local aAttachedFunctions = getEventHandlers(sEventName, pElementAttachedTo) if type(aAttachedFunctions) == 'table' and #aAttachedFunctions > 0 then for i, v in ipairs(aAttachedFunctions) do if v == func then return true end end end end return false end --Edited by MegasXLR server: addEvent("onPlayerPickUpRacePickup", true) function onPickupHit(pickupID, pickupType, vehicleModel) if pickupType == "nitro" then local veh = getPedOccupiedVehicle(source) if veh and getVehicleUpgradeOnSlot(veh, 8) ~= 0 and not isElementFrozen(veh) then setElementData(veh, 'nitro', {0, 1.0}) end end end addEventHandler("onPlayerPickUpRacePickup", root, onPickupHit)
-
I'm from phone so sorry for not using code tag. It's a bit bugged from phone. ? local sx,sy = guiGetScreenSize() local px,py = 1600,900 local x,y = (sx/px), (sy/py) ------------------------------------------------------------------------------------------------------------------------- ------------------- --- NFS NOS --- ------------------- local nostype = 'nfs' function toggleNitro(k, s) local v = getPedOccupiedVehicle(localPlayer) if v and getVehicleUpgradeOnSlot(v, 8) ~= 0 and not isElementFrozen(v) then if nostype == 'hybrid' then removeEventHandler ("onClientRender",root,nosFix) if s=='down' then setVehicleNitroActivated(v, not isVehicleNitroActivated(v)) setElementData(v, 'nitro', {s==not isVehicleNitroActivated(v), getVehicleNitroLevel(v)}) addEventHandler("onClientRender",root,nosFix) end elseif nostype == 'nfs' then removeEventHandler("onClientRender",root,nosFix) setVehicleNitroActivated(v, s=='down') setElementData(v, 'nitro', {s==not isVehicleNitroActivated(v), getVehicleNitroLevel(v)}) addEventHandler("onClientRender",root,nosFix) end end end bindKey("vehicle_fire", 'both', toggleNitro) bindKey("vehicle_secondary_fire", 'both', toggleNitro) ---------------------------- function nosFix () local veh = getPedOccupiedVehicle (localPlayer) local nos = getElementData(localPlayer,"nitro") If veh and nos~= nil then setVehicleNitroLevel (veh,nos[2]) end end Something like this? I'm removing the event handler when key is pressed because i think that onClientRender will set the nitro level to the last known element data while I'm using it, again making it infinite.
-
I got this client-side script which adds 3 modes for the nitro system: -Old = Default MTA/GTA nitro, press to use, wait until it's empty. -Hybrid = Press key to use, press same key again to stop using nitro. -NFS = Hold key to use nitro, when you release the key, nitro stops. Now my problem's that in all those modes the nitro starts recharging itself automatically as soon as I stop using it. How to prevent that? I mean this: I'm using NFS mode, I hold the key to use nos and the moment I let go of the key my nitro starts recharging itself until it reaches 100% again. I want to disable this recharging so that if I m at 40% nos when I let go of the key, it would stay at 40% until I get another nos pickup. And after let's say 1 min the nos will go to 100% again ONLY IF it was empty before that. I know that there's a resource called 'race_nos2' and I want my script to do exactly the same like it, just without removing the nitro upgrade as that way the nitro meter will always show the correct amount left, unlike if the upgrade is removed/added each time (like the race_nos2 way). Really need help with this... local sx,sy = guiGetScreenSize() local px,py = 1600,900 local x,y = (sx/px), (sy/py) ------------------------------------------------------------------------------------------------------------------------- ------------------- --- NFS NOS --- ------------------- local nostype = 'nfs' function toggleNitro(k, s) local v = getPedOccupiedVehicle(localPlayer) if v and getVehicleUpgradeOnSlot(v, 8) ~= 0 and not isElementFrozen(v) then if nostype == 'hybrid' then if s=='down' then setVehicleNitroActivated(v, not isVehicleNitroActivated(v)) setElementData(v, 'nitro', {s==not isVehicleNitroActivated(v), getVehicleNitroLevel(v)}) end elseif nostype == 'nfs' then setVehicleNitroActivated(v, s=='down') setElementData(v, 'nitro', {s==not isVehicleNitroActivated(v), getVehicleNitroLevel(v)}) end end end bindKey("vehicle_fire", 'both', toggleNitro) bindKey("vehicle_secondary_fire", 'both', toggleNitro) ------------------------------------------------------------------------------------------------------------------------- addEvent'setNitroType' addEventHandler('setNitroType', root, function(type) nostype = type end) addCommandHandler('nostype', function(c, type) nostype = type end) ------------------------------------------------------------------------------------------------------------------------- -- This syncs nitro states and levels from other clients addEventHandler('onClientElementDataChange', root, function(name) if name ~= 'nitro' or getVehicleOccupant(source) == localPlayer then return end local data = getElementData(source, 'nitro') setVehicleNitroActivated(source, data[1]) setVehicleNitroLevel(source, data[2]) end) ------------------------------------------------------------------------------------------------------------------------- -- Nitro Meter function nitroShow() if isPedInVehicle(localPlayer) then local car = getCameraTarget() local nitro = getVehicleNitroLevel(getPedOccupiedVehicle(localPlayer)) if car and getElementType(car) == "vehicle" then nitro = getVehicleNitroLevel(car) end if isPlayerMapVisible() then return end if nitro ~= false and nitro ~= nil and nitro > 0 then dxDrawText((math.floor(nitro/1*100)).."% Nitro", x*1463+1, y*134.5+1, x*1455+1, y*74+1, tocolor(0, 0, 0, 255), 1.30*y, "default-bold", "center", "center", false, false, false, false, false) dxDrawRectangle(x*1396, y*92, x*126, y*23, tocolor(44, 44, 44, 255), false) dxDrawRectangle(x*1396, y*92, x*126/10*10*nitro, y*23, tocolor(0, 70, 149, 255), false) dxDrawText((math.floor(nitro/1*100)).."% Nitro", x*1463, y*134.5, x*1455, y*74, tocolor(255, 255, 255, 255), 1.30*y, "default-bold", "center", "center", false, false, false, false, false) else dxDrawText("No Nitro", x*1463+1, y*134.5+1, x*1455+1, y*74+1, tocolor(0, 0, 0, 255), 1.30*y, "default-bold", "center", "center", false, false, false, false, false) dxDrawRectangle(x*1396, y*92, x*126, y*23, tocolor(44, 44, 44, 255), false) dxDrawRectangle(x*1396, y*92, x*126, y*23, tocolor(0, 70, 149, 255), false) dxDrawText("No Nitro", x*1463, y*134.5, x*1455, y*74, tocolor(255, 255, 255, 255), 1.30*y, "default-bold", "center", "center", false, false, false, false, false) end end end addEventHandler("onClientRender",getRootElement(),nitroShow) --Edited by MegasXLR
-
Hey guys, I'm writing here with a request to whoever can do this or atleast give tips on how to do it myself. Here goes: By default mta shows only 3 checkpoints ahead of your current one as blips on the radar while playing a race map. Is it possible to increase the number of checkpoints shown to, let's say, 5 instead of the default 3? I need this as sometimes seeing only 3 cps ahead isn't enough to know where to go and you end up failing a map because you don't know where to turn etc. Would be glad if anybody makes something like this or tries to help me make it. Waiting for your replies.
-
Never been intro shooting and such stuff in mta but i guess it's possible with shaders. I know that that's used to change paintjob of cars and even if all players have an infernus, each one can set his own paintjob and others will see that as well. So yeah, shaders ... but idk how to use them so good luck!
-
I don't know which program you're using but try WinRAR. There when you open a .zip file you can open and edit any file that's inside of it. And if you edit a file WinRAR will ask you if you wish to update that file inside the .zip with the new changes. And about deleting files, select the file(s) you wish to delete and press the delete button which is found somewhere on top of WinRAR in the tools bar. And one tip : yes it's true that zip files save space but as you've noticed yourself they're a bit harder to edit than if it was just a normal folder. So if hard disc space isn't a problem for you i suggest you to unzip (right click on zip file and select extract option) all zip files into normal windows folders. Then you'll be able to edit the files like any other on your pc. Hope i helped, goodnight 3 am here ...
-
Write /start freeroam in chat. Maybe you're not in freeroam idk.
-
@MIKI785 when I put 'resourceRoot' there's no sound but 'root' works just fine. Tested and now it's heard. Combined everything and now works Thanks fellas! client addEvent("alarmOnSound", true) function alarmOnSound(car) local x, y, z = getElementPosition(car) local lockSound = playSound3D("lock.mp3", x, y, z) attachElements(lockSound, car) setSoundMaxDistance(lockSound, 50) end addEventHandler("alarmOnSound", root, alarmOnSound) --------------------------------------------------------------------------------------------------------------------------- addEvent("alarmOffSound", true) function alarmOffSound(car) local x,y,z = getElementPosition(car) local unlockSound = playSound3D("unlock.mp3", x, y, z) attachElements(unlockSound, car) setSoundMaxDistance(unlockSound, 50) end addEventHandler("alarmOffSound", root, alarmOffSound) server function alarmToggle(player) local state = getElementData(player, "player state") if state ~= "Alive" then return end local car = getPedOccupiedVehicle(player) if car then local x, y, z = getElementPosition(car) local soundSphere = createColSphere(x, y, z, 50) local playersWhichHear = getElementsWithinColShape(soundSphere, "player") if getElementData(player, "locked") == 1 then triggerClientEvent(playersWhichHear, "alarmOffSound", player, car) setVehicleOverrideLights(car, 2) setTimer(function(car) setVehicleOverrideLights(car, 1) setTimer(function(car) setVehicleOverrideLights(car, 2) setTimer(function(car) setVehicleOverrideLights(car, 1) end, 200, 1, car) end, 200, 1, car) end, 200, 1, car) setElementData(player, "locked", 0) return end if getElementData(player, "locked") == 0 then triggerClientEvent(playersWhichHear, "alarmOnSound", player, car) setVehicleOverrideLights(car, 2) setTimer(function(car) setVehicleOverrideLights(car, 1) end, 200, 1, car) setElementData(player, "locked", 1) return end end end --------------------------------------------------------------------------------------------------------------------------- function bindKeyOnJoin() bindKey(source, "J", "down", alarmToggle) setElementData(source, "locked", 0) end addEventHandler("onPlayerJoin", root, bindKeyOnJoin) --------------------------------------------------------------------------------------------------------------------------- function bindKeyOnResStart() for i, player in ipairs(getElementsByType("player")) do bindKey(player, "J", "down", alarmToggle) setElementData(player, "locked", 0) end end addEventHandler("onResourceStart", resourceRoot, bindKeyOnResStart) Would be good if it's heard while you're spectating the player who activated it but I guess that's not possible because of the colSphere.
-
Both client events get triggered only for the player who uses the command. I tried settings the range of the triggerClientEvent to 'root' and it still worked only on the player who uses the command. Others don't hear anything no matter what I try.
-
server function alarmToggle(player) local car = getPedOccupiedVehicle(player) local x, y, z = getElementPosition(player) local soundSphere = createColSphere(x, y, z, 50) local playersWhichHear = getElementsWithinColShape(soundSphere, "player") if car then if isVehicleLocked(car) then setVehicleLocked(car, false) triggerClientEvent(playersWhichHear, "alarmOffSound", player) setVehicleOverrideLights(car, 2) setTimer(function(car) setVehicleOverrideLights(car, 1) end, 300, 1, car) else setVehicleLocked(car, true) triggerClientEvent(playersWhichHear, "alarmOnSound", player) setVehicleOverrideLights(car, 2) setTimer(function(car) setVehicleOverrideLights(car, 1) end, 300, 1, car) end end end --------------------------------------------------------------------------------------------------------------------------- function bindKeyOnJoin() bindKey(source, "K", "down", alarmToggle) end addEventHandler("onPlayerJoin", root, bindKeyOnJoin) --------------------------------------------------------------------------------------------------------------------------- function bindKeyOnResStart() for i, player in ipairs(getElementsByType("player")) do bindKey(player, "K", "down", alarmToggle) end end addEventHandler("onResourceStart", root, bindKeyOnResStart) client addEvent("alarmOnSound", true) function alarmOnSound() local x,y,z = getElementPosition(source) playSound3D("lock.mp3",x,y,z) end addEventHandler("alarmOnSound", localPlayer, alarmOnSound) --------------------------------------------------------------------------------------------------------------------------- addEvent("alarmOffSound", true) function alarmOffSound() local x,y,z = getElementPosition(source) playSound3D("unlock.mp3",x,y,z) end addEventHandler("alarmOffSound", localPlayer, alarmOffSound) Lights flash but others don't hear the lock/unlock sound. No errors whatsoever, hmm...
-
@Mr.Loki I was just asking if the returned distance is the same from the two functions. But you just made a good point. If I use getDistanceBetweenPoints3D the sound volume will fade away if the player who activates the alarm goes far away from me but still within the radius. No idea if the way I made it it would do the same. Gotta try both codes soon.
-
Sure. Btw, is this distance same as the one returned from getDistanceBetweenPoints3D ? I mean I kinda know what 50 is in a script which uses getDistanceBetweenPoints3D, if I set 50 here as well, radius will be same?
-
Like this? function alarmToggle(player) local car = getPedOccupiedVehicle(player) local x, y, z = getElementPosition(player) local soundSphere = createColSphere(x, y, z, 100) local playersWhichHear = getElementsWithinColShape(soundSphere, "player") if car then if isVehicleLocked(car) then setVehicleLocked(car, false) triggerClientEvent(playersWhichHear, "alarmOffSound", player) setVehicleOverrideLights(car, 2) setTimer(function(car) setVehicleOverrideLights(car, 1) end, 300, 1, car) else setVehicleLocked(car, true) triggerClientEvent(playersWhichHear, "alarmOnSound", player) setVehicleOverrideLights(car, 2) setTimer(function(car) setVehicleOverrideLights(car, 1) end, 300, 1, car) end end end --------------------------------------------------------------------------------------------------------------------------- function bindKeyOnJoin() bindKey(source, "K", "down", alarmToggle) end addEventHandler("onPlayerJoin", root, bindKeyOnJoin) --------------------------------------------------------------------------------------------------------------------------- function bindKeyOnResStart() for i, player in ipairs(getElementsByType("player")) do bindKey(player, "K", "down", alarmToggle) end end addEventHandler("onResourceStart", root, bindKeyOnResStart)
-
I made a nice car lock system (with sounds) but got one question. How to make it so that only players near me would hear the sounds? Put in another way, how to trigger the client event which plays the lock/unlock sounds just to those players that are near me at the moment of activating the script? Client: addEvent("alarmOnSound", true) function alarmOnSound() playSound("lock.mp3") end addEventHandler("alarmOnSound", localPlayer, alarmOnSound) --------------------------------------------------------------------------------------------------------------------------- addEvent("alarmOffSound", true) function alarmOffSound() playSound("unlock.mp3") end addEventHandler("alarmOffSound", localPlayer, alarmOffSound) Server: function alarmToggle(player) local car = getPedOccupiedVehicle(player) if car then if isVehicleLocked(car) then setVehicleLocked(car, false) triggerClientEvent(root, "alarmOffSound", player) setVehicleOverrideLights(car, 2) setTimer(function(car) setVehicleOverrideLights(car, 1) end, 300, 1, car) else setVehicleLocked(car, true) triggerClientEvent(root, "alarmOnSound", player) setVehicleOverrideLights(car, 2) setTimer(function(car) setVehicleOverrideLights(car, 1) end, 300, 1, car) end end end --------------------------------------------------------------------------------------------------------------------------- function bindKeyOnJoin() bindKey(source, "K", "down", alarmToggle) end addEventHandler("onPlayerJoin", root, bindKeyOnJoin) --------------------------------------------------------------------------------------------------------------------------- function bindKeyOnResStart() for i, player in ipairs(getElementsByType("player")) do bindKey(player, "K", "down", alarmToggle) end end addEventHandler("onResourceStart", root, bindKeyOnResStart) Also if I'm not spawned I shouldn't be able to activate any sounds nor lock my vehicle.
-
Released, enjoy! https://community.multitheftauto.com/index.php?p=resources&s=details&id=14177
-
About your first question. Any directory surrounded with [ ] is not seen as a resource by mta. That means that you can create one folder in "deathmatch" and put all of your scripts in there. A quick example: I have a folder called "[scripts]" in my "deathmatch" folder. Inside the "[scripts]" folder all of the resources are in normal folders (without [ ]). So a help panel for example will be like this: ...mods/deathmatch/resources/[scripts]/helppanel And you can put as many resources in the "[scripts]" folder as long as they're in a normal folder (without the [ ]). -------------------------------------------------------- Now your second question. Difference between client and server side is this: All GUI elements and things which affect ONLY one player without others on the server noticing any changes belong in a client-side script. Everything that affects NOT JUST one player but a lot or all players belong in a server-side script. Also all functions connected to accounts work only server-side as the accounts database is located on the server itself, not on every player's computer. For more details you can see functions and event handlers on the wiki. In the upper right corner it's written weather it can be used only client-side, only server-side or on both sides. -------------------------------------------------------- And about your problem with the login panel you'll need to triggerServerEvent when a player presses on the register or login button in the gui. Now another thing: triggerServerEvent is only client-side and triggerClientEvent is only server-side. Events are a way for client and server side scripts to communicate with each other and exchange data if needed.
-
-- Remove /me chat addEventHandler ( "onPlayerChat", root, function ( _, tp ) if ( tp == 1 ) then outputChatBox("/me messages are disabled in this server", source, 255, 0, 0) cancelEvent ( ) end end )
-
I did exactly the same setTimer thing and it didn't work, but when I copy yours it works lol Anyway, thanks.
-
@nikitafloy I did it but for some reason when I set a timer to restore the handling to the car's default one after one second nothing happens, Here's the code: function wheelie(player) local car = getPedOccupiedVehicle(player) if car then --Sabre if getElementModel(car) == 475 then setVehicleHandling(car, "centerOfMass", { 0.0, -0.65, 0.1 }) setVehicleHandling(car, "tractionLoss", 5.90) setVehicleHandling(car, "engineAcceleration", 22.0) setVehicleHandling(car, "engineInertia", 1.0) setVehicleHandling(car, "suspensionAntiDiveMultiplier", 0.0000000000001) end end end function bindKeyOnJoin() bindKey(source, "M", "down", wheelie) end addEventHandler("onPlayerJoin", root, bindKeyOnJoin) function bindKeyOnResStart() for i, player in ipairs(getElementsByType('player')) do bindKey(player, "M", "down", wheelie) end end addEventHandler("onResourceStart", resourceRoot, bindKeyOnResStart) Can you make a timer which restores all changed handling lines to the car's default ones one second after the player has pressed the key?
-
Noone will write you a complete script without you even trying. If you try but get errors, have questions etc, then somebody will try to help you solve the problem but you'll have built at least half the script yourself.
-
I'll give it a try later but won't that kind of ruin the car's handling during a race? I mean it won't be default and since my server is a race one that's a big problem.
-
Can you explain some more? How did you do it?