drk
Members-
Posts
1,607 -
Joined
-
Last visited
Everything posted by drk
-
No problem
-
Search in: modes/destructionderby.lua
-
function guiCreateColorLabel(ax, ay, bx, by,str, bool, parent) local pat = "(.-)#(%x%x%x%x%x%x)" local s, e, cap, col = str:find(pat, 1) local last = 1 while s do if cap == "" and col then r,g,b = tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap) avc321 = guiCreateLabel(ax, ay, ax + w, by,cap,bool,parent) if r == nil then r = 255 end if g == nil then g = 255 end if b == nil then b = 255 end guiLabelSetColor(avc321,r,g,b) ax = ax + w r,g,b = tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)) end last = e + 1 s, e, cap, col = str:find(pat, last) end if last <= #str then cap = str:sub(last) local w = dxGetTextWidth(cap) avc123 = guiCreateLabel(ax, ay, ax + w, by,cap,bool,parent) guiLabelSetColor(avc123,r,g,b) return avc123 end end Can anyone help with this
-
Problem solved. No need to get width and height of gui element, Ive found another way
-
I have learned about guiGetSize again and I think it returns width, height size like arezu said. Anyway I will try now.
-
Dude, guiGetScreenSize returns the player SCREEN WIDTH, HEIGHT, not the GUI ELEMENT WIDTH, HEIGHT.
-
guiGetScreenSIze() returns the client screen size dude, not the gui element. I will try guiGetSize.
-
guiGetScreenSize() get the client screen resolution, not the gui element height, width.
-
Now, It's my turn! Happy birthday!
-
I've seen this in the Wiki, but it says that only get x and y position, not the height and width...
-
I'm searching for a function like guiGetWidth and guiGetHeight returning width and height of the gui element but I haven't found nothing to do this.. It's possible to get width and height of a gui element? Sorry if I'm being noob
-
Thanks Castillo.
-
I'm trying to use Talidan's textlib but when I start the script ( test script ) I get error attempt to index global 'dxText' ( a nil value ). Can someone help me? Client: local sx, sy = guiGetScreenSize() image1 = guiCreateStaticImage((236/800)*sx,(486/600)*sy,(366/800)*sx,(73/600)*sy,"images/grid.png",false) bar1 = guiCreateStaticImage((763/800)*sx,(5/600)*sy,(34/800)*sx,(37/600)*sy,"images/music.png",false) music = dxText:create("ASHUHASUASHUASHUASUHASHU",(246/800)*sx,(520/600)*sy,false) music:color(255,255,255,255) music:scale(0.5) music:postGUI(true) playing = dxText:create("Now playing:",(313/800)*sx,(490/600)*sy,false) playing:color(255,20,147,255) playing:scale(0.6) playing:postGUI(true) Meta.xml: Textlib is in the script.
-
I thought the problem was that too, but I'm a big dumb in these things '-'
-
If it's about Mapping, I think that it's the wrong section...
-
the script changes setPedFrozen to setElementFrozen automatically. Maybe in MTA:SA 1.3... In others you have to type upgrade.. setElementFrozen(source, true) setPedAnimation(source, "cop_ambient", "Coplook_loop")
-
setPedAnimation wrong: https://wiki.multitheftauto.com/wiki/SetPedAnimation I don't see any setPedFrozen in the script lol local numbers ={'1','2','3','4','5'} local drugPickupBlip = createBlip ( -1145, -1134, 130, 46, 1, 0, 0, 0, 255, 0, 99999.0 ) local drugPickup = createMarker( -1145, -1134 ,129, "cylinder", 1, 0, 0, 0, 255 ) local drugMarkerBlip = createBlip ( -2179, 715.5, 53, 24, 1, 0, 0, 0, 255, 0, 99999.0 ) local drugMarker = createMarker( -2180, 715.5, 53, "cylinder", 1, 255, 0, 0, 170 ) local drugSeller = createPed( 29, -2177, 715.5, 55, 90 ) function drugSellerAnim() setElementFrozen(source, true) setPedAnimation(source, "cop_ambient", "Coplook_loop",-1,true,false,false) end setTimer(drugSellerAnim, 1000, 1) function drugSellerImmortal () cancelEvent() end addEventHandler( "onClientPedDamage", root, drugSellerImmortal ) function giveNumber(thePlayer) local account = getPlayerAccount(thePlayer) local rand = numbers[math.random(#numbers)] if (rand == '1') then setAccountData(account, "myPlayer", 'One') outputChatBox("You have found 10 weeds. Go and sell them to a drug seller!", thePlayer, 255, 0, 0, true) elseif (rand == '2') then setAccountData(account, "myPlayer", 'Two') outputChatBox("You have found 20 weeds. Go and sell them to a drug seller!", thePlayer, 255, 0, 0, true) elseif (rand == '3') then setAccountData(account, "myPlayer", 'Three') outputChatBox("You have found 30 weeds. Go and sell them to a drug seller!", thePlayer, 255, 0, 0, true) elseif (rand == '4') then setAccountData(account, "myPlayer", 'Four') outputChatBox("You have found 40 weeds. Go and sell them to a drug seller!", thePlayer, 255, 0, 0, true) elseif (rand == '5') then setAccountData(account, "myPlayer", 'Five') outputChatBox("You have found 50 weeds. Go and sell them to a drug seller!", thePlayer, 255, 0, 0, true) end end addEventHandler("onMarkerHit", drugPickup, giveNumber) function giveMySalary(thePlayer) local account = getPlayerAccount(thePlayer) if (getAccountData(account,"myPlayer") == "One") then giveMoney(thePlayer, 100) setAccountData(account, "myPlayer", 'Zero') outputChatBox("There is just 1 drug. Here is your money. Don't forget, more drugs, more money!", thePlayer, 255, 0, 0, true) elseif (getAccountData(account,"myPlayer") == "Two") then giveMoney(thePlayer, 150) setAccountData(account, "myPlayer", 'Zero') outputChatBox("There are 2 drugs. Here is your money. Don't forget, more drugs, more money!", thePlayer, 255, 0, 0, true) elseif (getAccountData(account,"myPlayer") == "Three") then giveMoney(thePlayer, 200) setAccountData(account, "myPlayer", 'Zero') outputChatBox("There are 3 drugs. Here is your money. Don't forget, more drugs, more money!", thePlayer, 255, 0, 0, true) elseif (getAccountData(account,"myPlayer") == "Four") then giveMoney(thePlayer, 250) setAccountData(account, "myPlayer", 'Zero') outputChatBox("There are 4 drugs. Here is your money. Don't forget, more drugs, more money!", thePlayer, 255, 0, 0, true) elseif (getAccountData(account,"myPlayer") == "Five") then giveMoney(thePlayer, 300) setAccountData(account, "myPlayer", 'Zero') outputChatBox("There are 5 drugs. Here is your money. Don't forget, more drugs, more money!", thePlayer, 255, 0, 0, true) elseif (getAccountData(account,"myPlayer") == "Zero") then outputChatBox("It seems you don't have any weed on you. Go and find some.", thePlayer, 255, 0, 0, true) end end addEventHandler("onMarkerHit", drugMarker, giveMySalary) Try.
-
You are using getLocalPlayer in server-side. Remember, source in onMarkerHit event is the marker that the ped has hitted. local numbers ={'1','2','3','4','5'} local drugPickupBlip = createBlip ( -1145, -1134, 130, 46, 1, 0, 0, 0, 255, 0, 99999.0 ) local drugPickup = createMarker( -1145, -1134 ,129, "cylinder", 1, 0, 0, 0, 255 ) local drugMarkerBlip = createBlip ( -2179, 715.5, 53, 24, 1, 0, 0, 0, 255, 0, 99999.0 ) local drugMarker = createMarker( -2180, 715.5, 53, "cylinder", 1, 255, 0, 0, 170 ) local drugSeller = createPed( 29, -2177, 715.5, 55, 90 ) function drugSellerAnim(drugSeller) setElementFrozen(drugSeller, true) setPedAnimation(drugSeller, "cop_ambient", "Coplook_loop",-1,true,false,false) end setTimer(drugSellerAnim, 1000, 1) function drugSellerImmortal () cancelEvent() end addEventHandler( "onClientPedDamage", root, drugSellerImmortal ) function giveNumber(thePlayer) local account = getPlayerAccount(thePlayer) local rand = numbers[math.random(#numbers)] if (rand == '1') then setAccountData(account, "myPlayer", 'One') outputChatBox("You have found 10 weeds. Go and sell them to a drug seller!", thePlayer, 255, 0, 0, true) elseif (rand == '2') then setAccountData(account, "myPlayer", 'Two') outputChatBox("You have found 20 weeds. Go and sell them to a drug seller!", thePlayer, 255, 0, 0, true) elseif (rand == '3') then setAccountData(account, "myPlayer", 'Three') outputChatBox("You have found 30 weeds. Go and sell them to a drug seller!", thePlayer, 255, 0, 0, true) elseif (rand == '4') then setAccountData(account, "myPlayer", 'Four') outputChatBox("You have found 40 weeds. Go and sell them to a drug seller!", thePlayer, 255, 0, 0, true) elseif (rand == '5') then setAccountData(account, "myPlayer", 'Five') outputChatBox("You have found 50 weeds. Go and sell them to a drug seller!", thePlayer, 255, 0, 0, true) end end addEventHandler("onMarkerHit", drugPickup, giveNumber) function giveMySalary(thePlayer) local account = getPlayerAccount(thePlayer) if (getAccountData(account,"myPlayer") == "One") then giveMoney(thePlayer, 100) setAccountData(account, "myPlayer", 'Zero') outputChatBox("There is just 1 drug. Here is your money. Don't forget, more drugs, more money!", thePlayer, 255, 0, 0, true) elseif (getAccountData(account,"myPlayer") == "Two") then giveMoney(thePlayer, 150) setAccountData(account, "myPlayer", 'Zero') outputChatBox("There are 2 drugs. Here is your money. Don't forget, more drugs, more money!", thePlayer, 255, 0, 0, true) elseif (getAccountData(account,"myPlayer") == "Three") then giveMoney(thePlayer, 200) setAccountData(account, "myPlayer", 'Zero') outputChatBox("There are 3 drugs. Here is your money. Don't forget, more drugs, more money!", thePlayer, 255, 0, 0, true) elseif (getAccountData(account,"myPlayer") == "Four") then giveMoney(thePlayer, 250) setAccountData(account, "myPlayer", 'Zero') outputChatBox("There are 4 drugs. Here is your money. Don't forget, more drugs, more money!", thePlayer, 255, 0, 0, true) elseif (getAccountData(account,"myPlayer") == "Five") then giveMoney(thePlayer, 300) setAccountData(account, "myPlayer", 'Zero') outputChatBox("There are 5 drugs. Here is your money. Don't forget, more drugs, more money!", thePlayer, 255, 0, 0, true) elseif (getAccountData(account,"myPlayer") == "Zero") then outputChatBox("It seems you don't have any weed on you. Go and find some.", thePlayer, 255, 0, 0, true) end end addEventHandler("onMarkerHit", drugMarker, giveMySalary)
-
Good mapped but you can make your maps with more original ideas.
-
if source == imageVariable then Example: if source == button then button is the button variable in my other example.
-
no hide the window just this I don't understand this... For replacing buttons with images only change guiCreateButton to guiCreateStaticImage lol. onClientGUIClick works with all gui elements.
-
If what you mean is a web radio then I have another way. Put the sounds in a webhost or dedicated/vps web-server ( or what you want ) and use the url ( e.g.: http://IP/sound.mp3 ) in playSound ( e.g. : playSound ( 'http//293.283.172.21/mySound.mp3',false) ). If only i would have done this instead . In my music player, i read the sound files from server with fileRead and send 50000 bytes of sound data, then i save the data to file and playSound, and then send request to send next part of the file.. lol I think that your way is more hard for him.
-
gui = guiCreateWindow(...) button = guiCreateButton(...) gui_money = guiCreateWindow(...) guiSetVisible(gui,false) guiSetVisible(gui_money,false) addEventHandler('onClientGUIClick',root, function() if source == button then guiSetVisible(gui_money,true) end end )
