harryh
Members-
Posts
108 -
Joined
-
Last visited
Everything posted by harryh
-
Thank you my friend much appreciated
-
Hi, is there any events that trigger when an combobox value is changed. addEventHandler("onClientGUIChanged", DogCreate.BreedBox, updateDogSkin) This does not work. ^
-
Because you cant have parents on dxdrawtext but with GUI you can.
-
When I have the combobox is open, I can see all the entries in it but am unable to click on any of them and they don't do anything. DogCreate.DogColorCombo = guiCreateComboBox(0.28, 0.50, 0.63, 0.12, "", true, DogCreate.Window) local item = guiComboBoxGetSelected(DogCreate.BreedBox) local text = guiComboBoxGetItemText(DogCreate.BreedBox, item) local itemc = guiComboBoxGetSelected(DogCreate.DogColorCombo) local textc = guiComboBoxGetItemText(DogCreate.DogColorCombo, item) elseif (text == "Pitbull") then -- brown293 white294 grey295 blackwhtie296 setElementModel(DogCreatorPed, 293) guiComboBoxClear(DogCreate.DogColorCombo) guiComboBoxAddItem(DogCreate.DogColorCombo, "Brown") guiComboBoxAddItem(DogCreate.DogColorCombo, "White") guiComboBoxAddItem(DogCreate.DogColorCombo, "Grey") guiComboBoxAddItem(DogCreate.DogColorCombo, "Black & White") if itemc then if (textc == "Brown") then setElementModel(DogCreatorPed, 293) elseif (textc == "White") then setElementModel(DogCreatorPed, 294) elseif (textc == "Grey") then setElementModel(DogCreatorPed, 295) elseif (textc == "Black & White") then setElementModel(DogCreatorPed, 296) end end end
-
Yes Thank you for the help/.
-
Yes they are it is very strange. Here is code function updateDogSkin() --stuffhere end addEventHandler("onClientGUIChanged", DogCreate.BreedBox, updateDogSkin) function saveInfo() --stuffhere end addEventHandler("onClientGUIClick", DogCreate.BuyButton, saveInfo, false)
-
How would I do that the background gui is dxDrawRectangle(screenW * 0.8276, screenH * 0.2185, screenW * 0.1625, screenH * 0.1907, tocolor(34, 27, 48, 255), false)
-
Here are the 2 event handlers both returning nil DogCreate = {} createDogMenuOpen = true DogCreate.BuyButton = guiCreateButton(0.84, 0.34, 0.15, 0.05, "Purchase Dog", true) DogCreate.NameBox = guiCreateEdit(0.87, 0.23, 0.11, 0.03, "", true) DogCreate.MaleRadio = guiCreateRadioButton(0.89, 0.32, 0.01, 0.01, "", true) DogCreate.FemaleRadio = guiCreateRadioButton(0.96, 0.32, 0.01, 0.01, "", true) guiRadioButtonSetSelected(DogCreate.FemaleRadio, true) DogCreate.BreedBox = guiCreateComboBox(0.87, 0.27, 0.11, 0.03, "", true) addEventHandler("onClientGUIClick", DogCreate.BuyButton, saveInfo, false) addEventHandler("onClientGUIChanged", DogCreate.BreedBox, updateDogSkin)
-
I thought they were relative. Here the other part of code function DogCreateText() if createDogMenuOpen then dxDrawLine((screenW * 0.8276) - 1, (screenH * 0.2185) - 1, (screenW * 0.8276) - 1, screenH * 0.4093, tocolor(251, 5, 11, 255), 1, false) dxDrawLine(screenW * 0.9901, (screenH * 0.2185) - 1, (screenW * 0.8276) - 1, (screenH * 0.2185) - 1, tocolor(251, 5, 11, 255), 1, false) dxDrawLine((screenW * 0.8276) - 1, screenH * 0.4093, screenW * 0.9901, screenH * 0.4093, tocolor(251, 5, 11, 255), 1, false) dxDrawLine(screenW * 0.9901, screenH * 0.4093, screenW * 0.9901, (screenH * 0.2185) - 1, tocolor(251, 5, 11, 255), 1, false) dxDrawRectangle(screenW * 0.8276, screenH * 0.2185, screenW * 0.1625, screenH * 0.1907, tocolor(34, 27, 48, 255), false) dxDrawText("Name:", screenW * 0.8328, screenH * 0.2333, screenW * 0.8698, screenH * 0.2602, tocolor(255, 255, 255, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("Breed:", screenW * 0.8328, screenH * 0.2694, screenW * 0.8698, screenH * 0.2963, tocolor(255, 255, 255, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) dxDrawText("Gender:", screenW * 0.8328, screenH * 0.3056, screenW * 0.8698, screenH * 0.3324, tocolor(255, 255, 255, 255), 1.00, "pricedown", "left", "top", false, false, false, false, false) --dxDrawText("", 1723, 330, 1723, 330, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) dxDrawText("F", screenW * 0.9500, screenH * 0.3185, screenW * 0.9552, screenH * 0.3324, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) dxDrawText("M", screenW * 0.8870, screenH * 0.3185, screenW * 0.8922, screenH * 0.3324, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false) end end addEventHandler("onClientRender", getResourceRootElement(), DogCreateText) Here is a print screen:
-
How can I save these as a relative size to the screen resoultion to prevent problems. DogCreate.BuyButton = guiCreateButton(0.84, 0.34, 0.15, 0.05, "Purchase Dog", true) DogCreate.NameBox = guiCreateEdit(0.87, 0.23, 0.11, 0.03, "", true) DogCreate.MaleRadio = guiCreateRadioButton(0.89, 0.32, 0.01, 0.01, "", true) DogCreate.FemaleRadio = guiCreateRadioButton(0.96, 0.32, 0.01, 0.01, "", true) guiRadioButtonSetSelected(DogCreate.FemaleRadio, true) DogCreate.BreedBox = guiCreateComboBox(0.87, 0.27, 0.11, 0.03, "", true)
-
Thanks
-
Hi, I am creating this dog script. I need to get the players database number which is saved via getElementData(player element, "databaseid"). function loadPlayerInfo(thePlayer) local dbid = getElementData(thePlayer, "databaseid") getDInfo = mysql:query_fetch_assoc("SELECT * FROM dogs WHERE pID = '" ..dbid.."'") local result = mysql:free_result(getDInfo) InfoArray = result if (InfoArray == true) then elseif (InfoArray == false) then --No dog saved to DB print("No Dog In DB.") print(InfoArray) else print(InfoArray) print("Fatal Error has occured please contact administrator.") end end addCommandHandler("loaddogs", loadPlayerInfo) This always returns false when information is in the database as I cannot get the player element where thePlayer is the element. Also there is data in the MySQL database and it is correct. Thanks
-
Probably because element are not attached at line 4, so as there is no else to the if statement it would just end
-
Use this IsObjectInACLGroup Put this in a serverside script and set an event in the clientside to trigger when command "go" is typed. accountname = getPlayerAccount( thePlayer ) isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "PRO" ) ) Try this: Server: function startgo(thePlayer, commandName) accountname = getPlayerAccount( thePlayer ) if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "PRO" ) ) then triggerClientEvent("startGO", thePlayer, thePlayer) end end addCommandHandler("go", startgo) Client: local player = getLocalPlayer() function mob( player ) guiSetVisible ( los, true ) end function timer ( thePlayer ) setTimer ( mob, 5000, 1 ,thePlayer) outputChatBox ( "let's go!", thePlayer, 10, 250, 1 ) end addEvent("startGO", true) addEventHandler("startGO", getResourceRootElement(getThisResource()), timer)
-
Is there any function in MTA to get frames per second.
-
Support is not given to leaked scripts. vG
-
I am trying to click on the ped to activate the window but it doesn't show.
-
I want to return x, y ,z from a table and then it will create a ped in a random location. this is what i have gPedLocations = { { 1932.1513671875, -1773.64453125, 13.3828125 }, { 1937.0458984375, -1786.009765625, 13.390598297119 } } function createThePed() local x, y, z = gPedLocations[ math.random(#gPedLocations) ]
-
Ok, I understand now. How can I make this in the in the right top corner of the screen?
-
OK, I have but it in one label and it still lags, I will try dxDrawText writelines = guiCreateLabel(13, 11, 163, 102, "Local Time: " ..sTime.. "\n\nIn-Game Time: " ..string.format("%02d:%02d", getTime()).. "\n\nPing: " ..ping.. "\n\nHealth: " ..string.gsub(health,"%.%d*","").."%", false, background) Edit: Thanks dxDrawText works, but it is not in same place for all resoultions
-
I have this script, it works but when I use it, it lags the player massively. As it is using onClientRender. Here it is localPlayer = getLocalPlayer() health=0 sTime=0 ping=0 hours=0 minutes=0 function GetCurrentPlayerDateAndTime() local tTime = getRealTime() return string.format("%02d:%02d", tTime.hour, tTime.minute) end function getInfo() ping = getPlayerPing(getLocalPlayer()) sTime = GetCurrentPlayerDateAndTime() health = getElementHealth(localPlayer) end --addEventHandler ( "onClientRender", root, getInfo) function loadTheBox() background = guiCreateStaticImage(1174, 0, 186, 123, "Blackbox.png", false) guiSetAlpha(background, 30) end --addEventHandler('onClientResourceStart', resourceRoot, loadTheBox) function bInfo() localtime = guiCreateLabel(10, 1, 148, 15, "Local Time: " ..sTime.. "", false, background) igtime = guiCreateLabel(11, 26, 148, 15, "In-Game Time: " ..string.format("%02d:%02d", getTime()).. "", false, background) lagblud = guiCreateLabel(11, 51, 148, 15, "Ping: " ..ping.. "", false, background) hp = guiCreateLabel(11, 76, 148, 15, "Health: " ..string.gsub(health,"%.%d*","").."%" , false, background) end --addEventHandler ( "onClientRender", root, bInfo)
-
How can I get the position of top right corner of screen?
-
Is there anyway to get stamina from a player?
-
It wasn't about the the resolution of his problem, it's about to let you guys know relative values doesn't need to be translated in absolute ones when using gui functions. It just add code that is already written in the original functions ... (And it's not because your solution is working that it's a good solution ...) How do you know where 0.4, 0.8 etc etc. will be on the screen?
