Jump to content

codeluaeveryday

Members
  • Posts

    575
  • Joined

Everything posted by codeluaeveryday

  1. Bugs: Resizing will not snapping to position. Loading GUI's which have had the pos modified using the formula option will not load, returns an error.
  2. I believe he wants his DX Text to work on every res.
  3. Needs more replies! This is freaking awesome, me and karthik are gonna go crazy over this! Great UI, love the combo-box addition and the resolution I got a few suggestions for you: Allow custom gui UI's DX Text Effects - Shadow, outline DX Rectangle Effects - Shadow and outline The effects I listed are time savers and will be pretty dang popular. Thank you for this update it has made a lot of people happy ^^.
  4. Stolen my version 1.0 of Admin Tag, he didnt use my newer versions, but he practically has the exact meta.xml and file names, all he did was reword it. I do not give any permission to people editing my code and republishing. You may edit it, you may not share it. Stolen: https://community.multitheftauto.com/ind ... ls&id=5864 My resource: https://community.multitheftauto.com/ind ... ls&id=2963 Cheers, Chris DONE
  5. No offence to most of MTA, but they are all freaking idiots... I understand what he means, he wishes to change the image and text position in race which shows the time left. Its usually located center on the horizontal axis and top on the vertical axis. I can't help right now, at school. I'd recommend the above posters take a look at the race gamemode or at least don't reply with idiotic messages. On the other note, yeah the file is encrypted, any chance you stole race_client from your mods/deathmatch folder? Download the original race then modify it.
  6. Fixed and thanks, Its just an example post, he could have easily found the error himself .
  7. Dude, you got a lot of useless coding here, I'd recommend you look at the function set(). It helps a lot. function changeMaxZombies(thePlayer, commandName, zombiemax) if not zombiemax then outputChatBox("SYNTAX: /" .. commandName .. " [max numbers of zombies to spawn]", thePlayer, 255, 194, 14) else set("zombies.MaxZombies", zombiemax) restartResource(getResourceFromName("zombies")) outputChatBox("Done.", thePlayer, 255, 194, 14) end end addCommandHandler("setzombienumber", changeMaxZombies) If it doesnt work, change set("zombies.MaxZombies", zombiemax) to set("zombies.MaxZombies", tonumber(zombiemax)) I've added restart resource to apply the effects, it will require admin rights.
  8. Slotman, try checking your mtaserver.conf file around line 183. Make sure you stop your server while doing this. At this line you might have: <voice>0</voice> If you do have this, change it to: <voice>1</voice> having voice set to 0 will not allow players to use voice, having it set to 1 will allow players to use voice.
  9. Tables are a very efficent way to store data , I use to them in many of my scripts found in K@N Zombies. This is a small example I cooked up for you. playerSkin = {} addEventHandler("onPlayerWasted", getRootElement(), function() playerSkin[source] = getElementModel(source) end ) addEventHandler("onPlayerSpawn", getRootElement(), function() setElementModel(source, playerSkin[source] or 0) end ) Its very simple, playerSkin[source] is adding a key to the table so and by using it like a variable its setting a value to the key. playerSkin[source] == getElementModel(source) is equivalent to playerSkin = { playerElement = skinID } I hope this helps you understand, if it doesnt please explain what you are planning to do and the community of MTASA will help you .
  10. I want this guy to burn: https://community.multitheftauto.com/index.php?p= ... ls&id=5421 He stole my script and reuploaded it... Its on my community account (csmit195). He changed it to turkish, never will i allow someone to do that without at least adding me in the owners... and a credit to me... DONE
  11. Please post your full function including the event. Make sure you have added the event ( addEvent () )
  12. All right all right, I am sorry, I havent been myself lately.
  13. Sorry, I just thought you wanted to know this is working as of the current server release. I am running it and my players see it good too. My code still will work.
  14. Heres were the Moderator is wrong. Heres where you fail to read: Min version: 1.3.0-9.03986. Works perfectly on my server and I know many other scripters which are also using this. . I was told you weren't as pro as they said.
  15. I made this work for vehicles and players. It shouldnt matter much anyway if your using race. Marker = createMarker(-1374.29, 1019.93, 10.8, 'arrow', 1.75, 255, 136, 255, 100) -- markers function MarkerHit(hitElem, matchingDimension ) if getElementType(hitElem) == "player" then outputChatBox("You hit the marker", hitElem, 255,0,0 ) givePlayerMoney(hitElem, 5000) else getElemntType(hitElem) == "vehicle" then outputChatBox("You hit the marker", getVehicleOccupant(hitElem), 255,0,0 ) givePlayerMoney(getVehicleOccupant(hitElem), 5000) end end addEventHandler( "onMarkerHit", Marker, MarkerHit ) -- blips function blips() createBlip(1713.02, 917.98, 10.80, 27) -- mechanic createBlip(1381.99, 1019.81, 10.82, 51) -- store end addEventHandler("onResourceStart", rootElement, blips)
  16. Luckily i made this last night for my K@N servers. Replace killmessages/utils/textlib.lua: dxText = {} dxText_mt = { __index = dxText } local idAssign,idPrefix = 0,"c" local g_screenX,g_screenY = guiGetScreenSize() local visibleText = {} ------ local defaults = { fX = 0.5, fY = 0.5, bRelativePosition = true, strText = "", bVerticalAlign = "center", bHorizontalAlign = "center", tColor = {255,255,255,255}, fScale = 1, strFont = "default", strType = "normal", tAttributes = {}, bPostGUI = false, bClip = false, bWordWrap = true, bVisible = true, tBoundingBox = false, --If a bounding box is not set, it will not be used. bRelativeBoundingBox = true, } local validFonts = { default = true, ["default-bold"] = true, clear = true, arial = true, pricedown = true, bankgothic = true, diploma = true, beckett = true, } local validTypes = { normal = true, shadow = true, border = true, stroke = true, --Clone of border } local validAlignTypes = { center = true, left = true, right = true, } function dxText:create( text, x, y, relative ) assert(not self.fX, "attempt to call method 'create' (a nil value)") if ( type(text) ~= "string" ) or ( not tonumber(x) ) or ( not tonumber(y) ) then outputDebugString ( "dxText:create - Bad argument", 0, 112, 112, 112 ) return false end local new = {} setmetatable( new, dxText_mt ) --Add default settings for i,v in pairs(defaults) do new[i] = v end idAssign = idAssign + 1 new.id = idPrefix..idAssign new.strText = text or new.strText new.fX = x or new.fX new.fY = y or new.fY if type(relative) == "boolean" then new.bRelativePosition = relative end visibleText[new] = true return new end function dxText:text(text) if type(text) ~= "string" then return self.strText end self.strText = text return true end function dxText:position(x,y,relative) if not tonumber(x) then return self.fX, self.fY end self.fX = x self.fY = y if type(relative) == "boolean" then self.bRelativePosition = relative else self.bRelativePosition = true end return true end function dxText:color(r,g,b,a) if not tonumber(r) then return unpack(self.tColor) end g = g or self.tColor[2] b = b or self.tColor[3] a = a or self.tColor[4] self.tColor = { r,g,b,a } return true end function dxText:scale(scale) if not tonumber(scale) then return self.fScale end self.fScale = scale return true end function dxText:visible(bool) if type(bool) ~= "boolean" then return self.bVisible end self.bVisible = bool if bool then visibleText[self] = true else visibleText[self] = nil end return true end function dxText:destroy() self.bDestroyed = true setmetatable( self, self ) return true end function dxText:extent() local extent = dxGetTextWidth ( string.gsub(self.strText, "#%x%x%x%x%x%x", ""), self.fScale, self.strFont ) if self.strType == "stroke" or self.strType == "border" then extent = extent + self.tAttributes[1] end return extent end function dxText:height() local height = dxGetFontHeight ( self.fScale, self.strFont ) if self.strType == "stroke" or self.strType == "border" then height = height + self.tAttributes[1] end return height end function dxText:font(font) if not validFonts[font] then return self.strFont end self.strFont = font return true end function dxText:postGUI(bool) if type(bool) ~= "boolean" then return self.bPostGUI end self.bPostGUI = bool return true end function dxText:clip(bool) if type(bool) ~= "boolean" then return self.bClip end self.bClip = bool return true end function dxText:wordWrap(bool) if type(bool) ~= "boolean" then return self.bWordWrap end self.bWordWrap = bool return true end function dxText:type(type,...) if not validTypes[type] then return self.strType, unpack(self.tAttributes) end self.strType = type self.tAttributes = {...} return true end function dxText:align(horzA, vertA) if not validAlignTypes[horzA] then return self.bHorizontalAlign, self.bVerticalAlign end vertA = vertA or self.bVerticalAlign self.bHorizontalAlign, self.bVerticalAlign = horzA, vertA return true end function dxText:boundingBox(left,top,right,bottom,relative) if left == nil then if self.tBoundingBox then return unpack(boundingBox) else return false end elseif tonumber(left) and tonumber(right) and tonumber(top) and tonumber(bottom) then self.tBoundingBox = {left,top,right,bottom} if type(relative) == "boolean" then self.bRelativeBoundingBox = relative else self.bRelativeBoundingBox = true end else self.tBoundingBox = false end return true end addEventHandler ( "onClientRender", getRootElement(), function() for self,_ in pairs(visibleText) do while true do if self.bDestroyed then visibleText[self] = nil break end local l,t,r,b --If we arent using a bounding box if not self.tBoundingBox then --Decide if we use relative or absolute local p_screenX,p_screenY = 1,1 if self.bRelativePosition then p_screenX,p_screenY = g_screenX,g_screenY end local fX,fY = (self.fX)*p_screenX,(self.fY)*p_screenY if self.bHorizontalAlign == "left" then l = fX r = fX + g_screenX elseif self.bHorizontalAlign == "right" then l = fX - g_screenX r = fX else l = fX - g_screenX r = fX + g_screenX end if self.bVerticalAlign == "top" then t = fY b = fY + g_screenY elseif self.bVerticalAlign == "bottom" then t = fY - g_screenY b = fY else t = fY - g_screenY b = fY + g_screenY end elseif type(self.tBoundingBox) == "table" then local b_screenX,b_screenY = 1,1 if self.bRelativeBoundingBox then b_screenX,b_screenY = g_screenX,g_screenY end l,t,r,b = self.tBoundingBox[1],self.tBoundingBox[2],self.tBoundingBox[3],self.tBoundingBox[4] l = l*b_screenX t = t*b_screenY r = r*b_screenX b = b*b_screenY end local type,att1,att2,att3,att4,att5 = self:type() if type == "border" or type == "stroke" then att2 = att2 or 0 att3 = att3 or 0 att4 = att4 or 0 att5 = att5
  17. isnt quite what I need. I am not trying to make it go down a line or anything. All i wish to do is resize the font size depending on the characters.
  18. Hey all. Ive been working on a script. The original one I made worked perfect. Now I have simplified it for tables. My formula is correct. You should not need my code, so do not ask for me to show it . My code is working all i need to do is auto size it with string.len(messages[countcheck]) for an example: messages = { "____________________", "_________________________________", "____________________________________________________" } dxDrawColorText(messages[countcheck], 0, 0, width, height, tocolor(255,255,255,fade), (width/960)*??????, "default", "center", "center") I am going to use string.length, but I cannot figure out a way to fit the last table entry. If you know what math formula could be used please tell me. Where I put the ?????? is meant to auto size it. I tried my best to speak full english... I am in a hurry to go. Regards Chris.
  19. Let the game recorder help you. I do not record MTA. I use bandicam, with this I have successfully seperated my skype sound and my windows game sound. So i can talk to friends at the same time. Bandicam has no limit and files are much less file size. Its good.
  20. So it appears the script you have given us is to stop vehicles from killing players. Maybe you want players to stop attacking vehicles. addEventHandler("onClientVehicleEnter",getRootElement(), function(player,seat) setVehicleDamageProof(source,true) end ) exit the vehicle, then enter it. It will be indestructable.
  21. It appears no one in MTA knows how to speak good English but Karthik.
  22. The script this guy's trying to copy is basically draculas. Me and him are good friends, i created my map likes then he made his I know how he built it, but i probably shouldn't share .
  23. Nononononono! That is wrong. MTA is not scripted like this. The [ ] brackets are for showing optional arguments. What you are trying to achieve is way out of your level. I think you should try a smaller script and start from there. If you want to continue, create your own gui with the resource guieditor. Try to script it. If you fail we will try to help. Because you tried.
  24. @Monty. Draken is right. We will not give you our "police" scripts. Nor will we script for you. It is easy to make a basic police script. Wiki.multitheftauto.com. Draken is a scripter also.
  25. To get basemode ID: getElementData(source,"ID") modify my resource on the community and add it. Its not very hard.
×
×
  • Create New...