Jump to content

AGENT_STEELMEAT

Members
  • Posts

    551
  • Joined

  • Last visited

Everything posted by AGENT_STEELMEAT

  1. Hey all, I made a simple DX notification script for my gamemode (JohnMode) and I figured I might as well release it since it took 15 minutes to write. Here it is: -- -- DX NOTIFICATIONS -- local notificationQueue = {} local drawNotifications function createNotification(id, message, x, y, width, height, font, scale, textColor, bgColor, showTicks) if notificationQueue[id] then destroyNotification(id) end if type(message) ~= "string" or type(x) ~= "number" or type(y) ~= "number" or type(width) ~= "number" or type(height) ~= "number" then return false end if type(font) ~= "string" then font = --[[ TODO: Define the a default font! ]] end if type(scale) ~= "number" then scale = --[[ TODO: Define a default scale! ]] end if type(textColor) ~= "table" then textColor = --[[ TODO: Define a default color (in format {r, g, b}) ! ]] end if type(bgColor) ~= "table" then bgColor = --[[ TODO: Define a default background color (in format {r, g, b})! ]] end if not showTicks then showTicks = --[[ TODO: Define a default show time (in miliseconds)! ]] end local newNotification = {} newNotification.message = message newNotification.x = x newNotification.y = y newNotification.width = width newNotification.height = height newNotification.font = font newNotification.scale = scale newNotification.textColor = textColor newNotification.bgColor = bgColor newNotification.showTicks = showTicks newNotification.shownTicks = 0 newNotification.lastAlpha = 0 if #notificationQueue == 0 then addEventHandler("onClientRender", root, drawNotifications) end notificationQueue[id] = newNotification end function destroyNotification(id) if notificationQueue[id] then notificationQueue[id] = nil if #notificationQueue == 0 then removeEventHandler("onClientRender", root, drawNotifications) end end end --[[local]] function drawNotifications() --[[if not isLocalPlayerLoggedIn(localPlayer) then return end]] for id, notification in pairs(notificationQueue) do local shownTicks, lastAlpha = notification.shownTicks, notification.lastAlpha local bgColor, textColor = notification.bgColor, notification.textColor -- If the nofication is still new or fading in if shownTicks == 0 then if lastAlpha < 200 then lastAlpha = lastAlpha + 6 if lastAlpha > 200 then lastAlpha = 200 end bgColor[4] = lastAlpha textColor[4] = lastAlpha notification.lastAlpha = lastAlpha else notification.firstTick = getTickCount() notification.shownTicks = 1 end elseif shownTicks >= notification.showTicks then -- Fade out or delete old notifications if lastAlpha > 0 then lastAlpha = lastAlpha - 6 if lastAlpha < 0 then lastAlpha = 0 end notification.lastAlpha = lastAlpha bgColor[4] = lastAlpha textColor[4] = lastAlpha else destroyNotification(id) end else -- Buisness as usual notification.shownTicks = getTickCount() - notification.firstTick end dxDrawRectangle(notification.x, notification.y, notification.width, notification.height, tocolor(unpack(bgColor))) dxDrawText(notification.message, notification.x, notification.y, notification.x + notification.width, notification.y + notification.height, tocolor(unpack(textColor)), notification.scale, notification.font, "center", "center") end end Caveats: - THE SCRIPT WILL NOT WORK PROPERLY IN ITS CURRENT FORM! You need to define your own default variables in the script - this is done to prevent everyone from having the same style notifications. - This script does not support dx-fonts. If you want that functionality, implement it yourself (it's not hard)! - This script does not magically ensure that the width of the text is less than the width of the box - that is up to you. You could easily implement an auto-size feature, however. - It's client-side only (I really shouldn't have to mention this, but you never know). Cheers and titties.
  2. As I said above, you need the douche. It's reusable and has a 10 year warranty.
  3. I'm not the one with sand in my vagina - your the one coming onto a public forum complaining about something and inciting a flame war. I really do suggest you use the douche - it comes with 10 year warranty.
  4. ATTENTION CHILDREN Firstly, I would like for the majority of you to go and grab one of these, and clear the sand out of your vagina with it. Secondly, the fact that your demanding something out of a server owner shows just how immature you are. It is their server, not yours (what are you, a communist?). They have no obligation to please you/ If you don't like the way they run their server, then leave. If you think your ideas are so gracefull and holy, go open your own server (SPOILER: it'll fail). Thirdly, I think you've all forgotten something: IT'S JUST A BLOODY GAME. It's not something to worth getting sand in your vagina over. Go outside or something.
  5. This 'resource' is awfull, lol. I mean seriously, advertising 'futures' like 'Add Sound when he Press Yes images', 'Add Give Money Button', 'Fixed Cursor show When gui hide', 'Added Msg To ChatBox say "Press F3 To Show The Gui'? Those are basic, common sense things that a money transfer GUI would need - there is nothing innovative about this resource, in fact it could be coded more efficiently (from scratch) in about 10 minutes. It's resources like this that make the community center look more like a trash can. 1/5
  6. The source code for this should be put up on google code or something, if it isn't already.
  7. Side note: I have an antiturk resource lying around if you want it, lol.
  8. No, this one is actually 5x better - it is written properly and works.
  9. AGENT_STEELMEAT

    deleted

    This looks like someone took a bunch of community resources, vG, and MTA Paradise, translated half of the outputs to Polish, modified a couple of variables and threw their own name on it. Words can not describe how awful this excuse for a gamemode is. Taking all of the most common, un-original scripts you can find and slapping them together to form an 'engine' is a joke.
  10. I think you could just disable GTA's HUD with showHudComponent(), and just draw it yourself.
  11. And the NPG team likes it pirated and with easy to access FTP passwords. (did I just say that?)
  12. You could just prevent duplicate entries from being added in the first place...
  13. This is a really bad tutorial, especially the client side part. One word: spaghetti.
  14. Liberty:Unleashed is a great MP mod for GTA III, MTA is a great mod for SA, and IV+ will be coming out soon. At some point, I'm assuming MTA Orange's code will be put to use in a mod for V. The only main gap is in VC, which currently only has some MTA 0.5 s'ghetti. There is a Vice:Unleashed in the works (by the LU team), but that kinda under wraps. In other words, learn C++ and get to work.
  15. HandlingEditor Lean-and-Mean A new version of hedit is planned - named 'lean-and-mean'. It is intended to be a lighter version of hedit with more efficient, better structured code. Details coming soon.
  16. RPG is a 'roleplay game', where the game is typically realistic (but not strict as to certain roles/goals), while Rolepay is actually assuming a role in SA and playing it strictly.
  17. The server shows up as running 1.2 - you might want to update that.
  18. The only way to have AI peds and vehicles in MTA is to make/use an AI script. Slothman's zombie resource is a great example. AI resources are typically complicated, and beacuse of this not many people have attempted making a full-scale AI in MTA. Sad but true.
  19. Emm, well, that's kinda fail. In that case, just allocate IDs that are not necessarily linked to an account, but to the player entities.
  20. Ehh, the ID should be assigned by the server, not the client. In fact, the ID should be automatically determined by MySQL (using 'id bigint unsigned NOT NULL auto_increment PRIMARY KEY').
  21. It would make more sense too send the user ID only (as it's shorter than the username string), and only send the coordinates if they have changed (rather than every x frames). Also: You should not be sending passwords out - they should only go one-way and be encrypted at all times.
  22. Oh look, we've gone gravedigging AND off topic.
×
×
  • Create New...