Jump to content

50p

Retired Staff
  • Posts

    2,973
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by 50p

  1. How do you want the label to update if you don't even use guiSetText to update it? BTW, I wonder how it would look.. a function with 40 if statements LOL. You should just make images of all weapons with name of id of the weapon. So you won't have to make tens of if statements to check which image you want to show. Like: function showClientImage ( prevSlot, newSlot ) local weaponID = getPlayerWeapon( getLocalPlayer(), newSlot); guiStaticImageLoadImage( WEAPON_IMAGE, "Main/".. tostring( weaponID ) ..".png" ); end addEventHandler ( "onClientPlayerWeaponSwitch", getRootElement(), showClientImage ) Assuming you have created an image and assigned it to WEAPON_IMAGE.
  2. If you ever used image functions you'd know there is guiStaticImageLoadImage or if you use my GUI lib then you'd know about it too image:LoadImage( "newimage.png" ) I even made an example in the official topic that swaps an image when you click it.
  3. You must understand events. If you don't understand them then you can say good bye to scripting or learn it. http://development.mtasa.com/index.php? ... ent_system
  4. You can set a timer to check what is his current team or make custom events which would update that label when something happens (eg. player spawned, selected team, etc.)... You've got the event already (Event_showPlayerTheirTeam), just trigger that even when it's required to update the team name.
  5. 50p

    tostring?

    addCommandHandler ( "getip", function ( playerWhoUsedCommand, command, targetName ) local targetPlayer = getPlayerFromNick( targetName ) if targetPlayer then local targetIP = getClientIP( targetPlayer ) outputChatBox( targetName.. "'s IP is " ..targetIP, getRootElement() ) end end )
  6. 50p

    Login GUI

    Rofl, owned. If you want to post something on this forum use your brain sometimes and think about what you're going to post... This post was useless Alexander, I did show a good example of how scripts work and why it didn't work for him. If you want to be a scripter you should know how things work not just how to script because one day you may get a problem and you won't even know what causes it.
  7. 50p

    Login GUI

    I'll try to explain how all this works. The thing is that when resource starts, it first executes all the code in the scripts (from top left to the bottom right of the file, from left to right) after that the server (or client) triggers on(Client)ResourceStart. So, follow these steps (in order from 1-6, don't read 6 if you haven't read 5! That way you will understand better): -- 1st, this function is defined but is not called, why should it be called now? function resourceStarted( ) -- 6th, finally onClientResourceStart is triggered and calls this function -- which makes a button! Now you should addEventHandler with this button because it's created -- and ready to be used button = guiCreateButton( 10, 200, 100, 20, "1337 button", false ) end -- 2nd, you call this addEventHandler function which attaches a function to an event addEventHandler( "onClientResourceStart", getResourceRootElement( getThisResource() ), resourceStarted ) -- 3rd, this function is defined but is not called, why should it be called now? function buttonClicked( ) outputChatBox( "Wow! You clicked a button! Do it again!" ); end -- 4th, you call addEventHandler function which attaches a function to an event -- but what is button? it wasn't created yet! keep going --> addEventHandler( "onClientGUIClick", button, buttonClicked, false ) -- 5th, there is nothing here, right? so, onClientResourceStart is triggered, lets do it now! (go to 6th)
  8. 50p

    Login GUI

    Take a look at this MaVe: https://community.multitheftauto.com/index.php?p= ... ils&id=241
  9. Download a mod for it. It's called Detailed Radar. Hmm, yeah, but howto install this in my server? It's not possible. Who told you it's possible? First, you have to make a licence system... without it you can do nothing. USE THE DAMN EDIT BUTTON! I've seen you spaming forum not for the first time! God bless him!
  10. Download a mod for it. It's called Detailed Radar.
  11. Ignore this if you run DP2.x.
  12. 50p

    random skin

    Take a look into "broph" resource. It spawns you in a random place with random skin.
  13. I think it's the one that I'm going to include. It may be not finished but fade in/out and sliding works fine. And it works with DP2.x too, Mr.Hankey.
  14. What about any elements? Not vehicle only.
  15. Your colshape may be too small. 5 units is about 5 meters, so you may want to make it greater than 5.
  16. Yeah, it shouldn't be there, I wrote it there to test the scripts. I'll remove it and release a new version with some small bugs fixed too. The animation class is in some resource, can't remember which one though. I copied it looong time ago to my gamemode which was never released.
  17. That function isn't bad, but I'll combine arc_'s animation class for gui with mine so it will be possible to slide, fade in/out, resize (animated resizing), etc. For now you can use that function. I would not recommend using string.format() in onClientRender because that function is slow and may drop down FPS. BTW, if you use DP2.3 and you never had a serial then your serial must be 0000-0000-0000-0000. If you banned that serial you banned yourself too.. that must have been "fun" for you. Anyway, I'm not sure how much time I can get to do more wiki stuff, but hopefully will do some today.
  18. Thanks Alexander for actually starting it... I don't know when I would start it myself but once you started I had an inspiration and made a lot of new pages, templated, etc.. even fully documented 3 methods
  19. niemi, you can also use: img = myWindow:AddStaticImage( .3, .4, .3, .3, "image.png", true ) Also, your code may not work even if you do what Talidan suggested because you pass a Window object (myWindow) where it should be a GUI element (myWindow.gui). Can be something like this: img = StaticImage:Create( 0.3, 0.4, 0.3, 0.3, "image.png", true, myWindow.gui ); I'd suggest using AddStaticImage() method which sets image as a child of the window itself, so you don't have to worry about setting parent. That's why I made Add(StaticImage, Label, etc.) functions which simply add new gui element as a child.
  20. http://development.mtasa.com/index.php? ... amageProof
  21. 50p

    server

    NO MORE HELP FOR THIS GUY FROM ME!
  22. 50p

    server

    That's what they all say lol When I first saw the "NOTE" I wanted to say "Then tell your friend to come here and ask himself" but that's ridiculous.
  23. 50p

    DuplicateMessages?

    Then wiki tells what's gonna be in 1.0 because I tested my classes with nightlies and it was always triggered once. This was also a reason I had to script a workaround for Dragable() method, you couldn't just click and drag because onClientGUIClick wasn't triggered for "down" state. I'd need more info to "fix what's fixed".
  24. 50p

    DuplicateMessages?

    You also don't check the button state (checked the source at GUISharedFuncs:AddOnClick and Button:Create).. I really think that he just triggering it for both mouse states up and down. But still, without his client side code I cannot tell. http://development.mtasa.com/index.php? ... ntGUIClick Enough said.
×
×
  • Create New...