Jump to content

50p

Retired Staff
  • Posts

    2,973
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by 50p

  1. There is no way to change button's background. You can only change label colour. You could create 126, 1x1 images with specific colours and stretch them all over button's background (button being parent of the colour image) but I wouldn't recommend it since that's a lot of images and its creation may drop down FPS or freeze PC for the loading time. It may not be that bad since they are just 1x1 images, give it a try.
  2. You shouldn't be making loads of windows. It stays in player's RAM all the time until you destroyElement (destroy GUI elements) or stop resource. If you'll have 20 houses then you'll create 20 windows which is not recommended. It may even freeze your players' MTA to create the GUI elements. You should make just 1 window and change its label's text for different house to show different information. Use break to stop loops (for or while loops). function onColShapeLeaveCrCpCs( theElement, matchingDimension ) if ( theElement == getLocalPlayer() ) then -- Checks whether the leaving element is the local player for houses=0 , casasnumclient do if(source == posicionCasas[houses]) then guiSetVisible(windowTituloCasa[houses], false) break; -- break the loop to save processing other houses when it's not needed end end end end
  3. How do you want to use it then? This is used to check if element is within collision shape. What do you need it for? You will never make GUI pop up without using events. EDIT: That's fine, but you should learn from making simple things and get to harder and harder ones.. Most of beginners go straight to hard things and it makes them tear their hair out.
  4. This is the same frequent problem with people not thinking logically. If you want something to happen when you enter colshape then why don't you use onColShapeHit? Do you use it? I can't find code about onColShapeHit in your code. You check if source (root element) is within colshape when player joins the server, this is so wrong. You should consider rewriting your script and if your houses are in xml file then I wouldn't recommend to use them on client-side, just send the information about the house to a client when it's needed (when he enters col shape). If you don't know what I meant by: "- isElementWithinColshape will not work since you check if "root element" is within colshape which is invalid." then you need to trace your code. I asked you to debug your scripts. Go and check what source is and you'll understand what I meant. BTW, what is getRootPlayer or id? I don't understand why people go straight to hard scripts without any knowledge how to do it.
  5. It doesn't work because: - You triggerClientEvent for everyone on the server and the source will be root element - isElementWithinColshape will not work since you check if "root element" is within colshape which is invalid. DO NOT use triggerClientEvent for player who joined the server in onPlayerJoin event because players have to download resource before you can triggerClientEvent. If player is downloading resources and you try to use triggerClientEvent you will get an error message saying you try to trigger client event which is not added client-side because client script hasn't been started yet and so event is not added. If you want to create GUI for player who joins your server, use onClientResourceStart instead of onPlayerJoin and triggerClientEvent. There is probably easier way of achieving what you want but we don't know what you're trying to do. What do you want the script to do?
  6. I'm confused now. CTCCoco, is the code you posted at the top the code you want to use in server-side script? If so, how do you want to use GUI functions in it? GUI functions are available for client-side script only. If your casas.xml is client-side file (as I explained before), then you can't access it from server-side script with xmlLoadFile. When is windowCrCpCs called and by who/what (function, event or command)? Remember GUI functions are not available in server-side script.
  7. I haven't replied earlier simply because I didn't have access to internet. Anyway, debug, debug, debug. You MUST to learn how to debug your scripts. It makes your life so much easier and happier without wasting time and waiting for someone to reply and tell you to debug. If you don't know how to debug, you will always ask why this and that doesn't work in your script when you could have fixed it yourself easier if you debugged it. Bad argument is one of the most frequent warnings you will always get in your scripts if you don't pay attention to what arguments you are passing to functions. Another one is: You will get this error very often if you won't pay attention to variables when concatenating strings. At least this error tells you what is wrong. You know that hOwner is a boolean variable and you know what to look for. Find out (debug) why hOwner is bool not string.
  8. Why don't you check your meta.xml? If you want to open .xml file with xml function in client-side script you should make the file available for clients. <file src="casas.xml" /> OR <config src="casas.xml" type="client" />
  9. When you're debugging script use "debugscript 3" command and you will see a debug box which tells you about problems in server-side and client-side scripts.
  10. 50p

    pay issue

    You are missing an end before addCommandHandler.
  11. The most important thing about "How to" questions is the answer from yourself. Think about what you'll need to do for something to happen. If you think or search longer, most of the time the questions are answered without need to ask a question. Lets think logically: You want a ped to stand still, then why don't you make one with createPed? You want to show GUI when you click at him/her, why don't you use onClientClick event to detect clicking, showCursor to show/hide cursor to allow player to click and guiSetVisible to show/hide the GUI? If you don't know how to combine them all then read tutorials (probably again) or at least try to script it and ask again if you'll have problems because we want to help you to learn.
  12. If onPlayerQuit is not triggered when you leave with quit command than it's a bug and should be reported.
  13. 50p

    Bug or what?

    This should work, but the variable this is not defined! The code with the variable this defined this = getResourceRootElement(getThisResource()) function markerHit( ) if ( source == indJuodas ) then outputChatBox("Boo") end end addEventHandler( "onRecourseStart", getResourceRootElement(), function( ) indJuodas = createMarker(216.9921875, 79.0078125, 1004.0390625, "cylinder", 1.5, 1, 1, 1) setElementInterior(indJuodas,6) addEventHandler( "onMarkerHit", this, markerHit ) end ) You have to read wiki more often. https://wiki.multitheftauto.com/wiki/AddEventHandler
  14. 50p

    Bug or what?

    Try this: function markerHit( ) if ( source == indJuodas ) then outputChatBox("Boo") end end addEventHandler( "onRecourseStart", getResourceRootElement(), function( ) indJuodas = createMarker(216.9921875, 79.0078125, 1004.0390625, "cylinder", 1.5, 1, 1, 1) setElementInterior(indJuodas,6) addEventHandler( "onMarkerHit", this, markerHit ) end )
  15. 50p

    Car Colours

    There are loads of colours which are not documented. Make a simple command to change your vehicle colour and test values <126 or use the one below. There are some interesting colours. addCommandHandler( "colour", function( plr, _, col ) col = tonumber( col ); if col then local veh = getPlayerOccupiedVehicle( plr ) if veh then setVehicleColor( veh, col, col, col, col ); end end end )
  16. Is there anything like leaf.dimension. I didn't say not to learn from freeroam resource without reason. It's just not for rookies.
  17. 50p

    Car Colours

    Your problem is not similar, it's opposite of what Assassin-NL wants. He wants to convert RGB to gta colour id and you want to convert colour id to RGB. If you open Vehicle Colors site and right-click "View source code" (or something similar), you'll find the list of all colours, just scroll down a bit. The GTA colour indices are not set in any kind of pattern so it's not easy to calculate RGB based on colour index without knowing the their RGB values.
  18. 50p

    Bug or what?

    myMarker = createMarker( ......... ) addEventHandler( "onMarkerHit", getResourceRootElement(), function( ) if ( source == myMarker ) then -- You hit your marker, do whatever you want here end end )
  19. It will not change the interior but will change dimension. What's the point of changing dimension without changing interior or what's the point of setting player's dimension to the id of interior? No matter what entrance player enters, he will be set to that interior and so will be player's dimension.
  20. i want a huge house with loads of money on my bank account pls help Giving orders is not the way to get help.
  21. 50p

    Ped Follows you

    @tomdrum11, I made peds example script awhile ago (when MTA was out in nightly builds before 1.x). You can have a look at it, https://community.multitheftauto.com/index.php?p= ... ils&id=234 It's nothing fancy just peds that follow you, that was a purpose of the script. You can give them weapons but they won't use it.
  22. I mean for create a GUI for example a Buy a House GUI or LOGIN GUI. How you get the coordinates? Magic? Thanks for help a noob guiGetScreenSize returns width and height of the screen. You can use it to calculate your positions. I don't know what you have problems with Each pixel on your screen has a position (x, y) and it's your choice where you create your elements. If you want to create something in the top left corner, you use 0, 0 for x and y. If you want to create something at the bottom left of the screen, you use 0 for X and you need to calculate Y, like so: screenWidth, screenHeight = guiGetScreenSize(); -- I usually make a table instead of 2 variables HEIGHT_OF_YOUR_ELEMENT = 100 WIDTH_OF_YOUR_ELEMENT = 100 guiCreateWindow( 0, screenHeight - HEIGHT_OF_YOUR_ELEMENT, WIDTH_OF_YOUR_ELEMENT, HEIGHT_OF_YOUR_ELEMENT, "bottom left", false ); Basically, take away height of your GUI element from the height of the screen. Explain what you don't understand or what pills you have taken.
  23. 50p

    Bug or what?

    It's a bug to me. It's been around since DP1. You should addEventHandler to root element (resource's root element is better) and make sure that the marker hit is the marker you created.
  24. 50p

    Car Colours

    No, because vehicle colours are not set with RGB but just a number (from 1-126 but can go higher). So, it's not that easy to do it especially with colours (1-126) not being in colour order.
×
×
  • Create New...