-
Posts
313 -
Joined
-
Last visited
Everything posted by MAB
-
that is making it visible to the player who hit the marker only and yes ik about it but this doesn't prevent the gui from changing all the peds clothes when one player click
-
problem is that it is changing the clothes of all peds in the server : server ; local marker = createMarker(0,0,0) function hitmarker(hit) if getElementType(hit) ~= "player" then return end triggerClientEvent (hit,"show",hit) end addEventHandler("onMarkerHit",marker,hitmarke client : torso = { { t = "Black-Vest", x = sw*293, y = sh*136, w = sw*403, h = sh*160, c = tocolor(255,255,255,255), tex = "vestblack", mod = "vest", si = sw*0.9 } } addEvent("show",true) addEventHandler("show",root, function() addEventHandler("onClientRender",root,draw) addEventHandler("onClientClick",root,change) end function draw() for i = 1, #torso do dxDrawText(torso[i].t, torso[i].x, torso[i].y, torso[i].w, torso[i].h, torso[i].c, torso[i].si, 'pricedown', 'left', 'top', false, false, false, false, false) end end end function change (b, s, x2, y2) if (b == 'left' and s == 'up') then for i = 1, #torso do if (x >= torso[i].x and x <= torso[i].w) and (y >= torso[i].y and y <= torso[i].h) then if (torso[i].tex and torso[i].mod) then addPedClothes ( source, torso[i].tex, torso[i].mod, 0 ) end end end end end
-
well.. all players see the text when one player hit the marker server : local marker = createMarker(0,0,0) function hitmarker(hit) if getElementType(hit) ~= "player" then return end triggerClientEvent ("show",hit) end addEventHandler("onMarkerHit",marker,hitmarker) client : addEvent("show",true) addEventHandler("show",root, function() addEventHandler("onClientRender",root,draw) end function draw() dxDrawText("text",0,0) end
-
what does (...) mean? and on the dx text string i should put guiGetText(edit) ?!
-
that is what i tried to do.. idea: make a edit box that the player can't see then make a rectangle on that edit box so the player think that it is a edit box so when he press it and start to type in the edit box the dxDrawText draws the text that is in the edit box addEventHandler("onClientRender", root, function() showCursor(true) edit = guiCreateEdit(264, 350, 178, 20, "", false) guiSetAlpha(edit, 0.00) guiSetProperty(edit, "Alpha", "0.000000") guiSetProperty(edit, "NormalTextColour", "00000000") guiEditSetMaxLength(edit, 10) text = guiGetText (edit) dxDrawRectangle(244, 345, 225, 25, tocolor(0, 0, 0, 100), true) dxDrawText( tostring(text), 278, 347, 442, 364, tocolor(255, 255, 255, 255), 1.00, "default", "left", "top", false, false, false, false, false) end )
-
hey.. does anyone know how to make a dx edit box? i don't want link of resources that i should export functions from .. i want to see codes.. an example of a dx edit box .. i tried but failed and if none could help i will post the codes i tried with .. i can't now because i am in my phone.. thanks
-
wrong parameter ... ( setElementPosition ) this should be dimen u want to check if the player and the marker on it or not addEventHandler( "onMarkerHit", [The marker that the function should happen when the player hit], MarkerHit ) setElementPosition... u wrote source.. but the source here is not the player it is the marker... example. "onPlayerJoin" event who is the source here? he is the player.. and "onVehicleEnter" event.. the source here is the Vehicle.. i hope u understood that,, Visit MTA SA Community and look for a race map there.. there are good maps there note to change the dimen you will need the setElementDimension .. the first parameter is the Element you want to change dimen of.. you can make it myMarker or hitElement ( must be put in the MarkerHit function to work with the hitElement ) and the second parameter here is the number of the dimen u want.. "int" means that the number you are going to put can't contain decimal number .. example .. setElementDimension (myMarker,1.5) -- Wrong setElementDimension (myMarker,1) -- correct hitElement parameter here is the Element (could be object, player or vehicle ) who hit the marker which could be the player so correct code is : local myMarker = createMarker (-696.45972 960.47467 12.28255, "cylinder", 4, 0, 0, 255,255 ) --- Marker created function MarkerHit( hitElement, dimen ) setElementPosition ( hitElement, 0, 0, 0 ) end addEventHandler( "onMarkerHit", myMarker, MarkerHit )
-
nvm i solved that myself..
-
GTX.. the Torso and Legs buttons still working when u press under them.. i think they need more of what u done
-
can u please tell me what math things u done?
-
where r u GTX u r my hero
-
mm .. 1. i don't know what r u talking about.. 2. the button works when i press on it or under it so i don't want it to work when i press under it.. understood me?
-
my problem it that when i click under the button ( text ) it do the function.. i want it to the function when it is clicked only not on it and under it... and the X (close) button .. when i click on its right it works.. it should be on it only not on it and on it is right .. i hope u understood me.. local sx, sy = guiGetScreenSize() local x, y = (sx/1280), (sy/768) local s = (sx/1280) local color = tocolor(255, 255, 255, 255) local color2 = tocolor(255, 255, 255, 255) local color3 = tocolor(255, 255, 255, 255) local color4 = tocolor(255, 255, 255, 255) local marker = createMarker(0,0,0) function draw () if isPedInVehicle (localPlayer) then return end showCursor(true) showChat(false) setPlayerHudComponentVisible("all",false) dxDrawRectangle(x*280, y*82, x*700, y*60, tocolor(0, 0, 0, 100), false) dxDrawText("Torso", x*289, y*92, x*385, y*120, color, s*1.00, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Legs", x*478, y*92, x*556, y*120, color2, s*1.00, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Head", x*662, y*92, x*743, y*120, color3, s*1.00, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Hands", x*852, y*92, x*954, y*120, color4, s*1.00, "bankgothic", "left", "top", false, false, false, false, false) dxDrawRectangle(x*980, y*81, x*77, y*61, tocolor(255, 0, 0, 100), false) dxDrawText("X", x*1007, y*95, x*1030, y*123, tocolor(255, 255, 255, 255), s*1.00, "bankgothic", "left", "top", false, false, false, false, false) end addEventHandler("onClientRender",root,draw) function dx_click (b, s, x2, y2) if (b == 'left' and s == 'up') then if ( x2 >= x*1007 and x2 <= (x*1007) + (x*730) and y2 > (y*95) and y2 < (y*95) + (y*123) ) then removeEventHandler('onClientClick', root, dx_click) removeEventHandler("onClientRender",root,draw) showCursor(false) showChat(true) setPlayerHudComponentVisible("all",true) end if ( x2 >= x*289 and x2 <= (x*289) + (x*85) and y2 > (y*92) and y2 < (y*92) + (y*120) ) then color = tocolor(255, 255, 0, 255) color2 = tocolor(255, 255, 255, 255) color3 = tocolor(255, 255, 255, 255) color4 = tocolor(255, 255, 255, 255) end if ( x2 >= x*478 and x2 <= (x*478) + (x*256) and y2 > (y*92) and y2 < (y*92) + (y*120) ) then color2 = tocolor(255, 255, 0, 255) color = tocolor(255, 255, 255, 255) color3 = tocolor(255, 255, 255, 255) color4 = tocolor(255, 255, 255, 255) end end end addEventHandler('onClientClick', root, dx_click)
-
what about.. note: i am posting from my phone so i can't enter wiki and get correct functions function Random () local Player = getRandomPlayer() local Count = getPlayerCount() if Count == 0 then return end if Player then if getElementData ( Player, key ) == value then return end setElementData ( Player, key , value ) end end setTimer(Random, your_time_in_secs*1000, 0)
-
it is >= not just > because the player may have 500$ so right code is : if getPlayerMoney (source) >= 500 then takePlayerMoney (source, 500) else outputChatBox ("No enough money", source) end
-
mm.. i wanted to use it for a clothes shop but i don't use other people resources and don't like to export functions... well i am good at math.. but anyway... i will use a dx tabs and buttons
-
انا مش عارف اي ام العجن اللي عملين تكتبو ده مشكله اللوحه بتاعتك انك كاتب local x, y = guiGetScreenSize() وانت بتعمل اللوحه كتبت في مكانها screenW - 400 المفروض x - 400 اتعلم برمجه بدل منتا بتاخد اكواد...
-
someone knows how to make a dx gridlist ? because i saw it in a server..
-
aaaa.... who know a good programe to create images for mta that color can be changed
-
mm.. couldn't understand things in that example + it is a marker... do u have time for example ?
-
how to move dx rectangles and texts with easing ?!
-
working... thank you very much
-
mm.. everything works well but only the CLOSE button... when i put the mouse in it i find both of texts colors turned yellow but ACCEPT button works well.. but the close button problem proves that if the player pressed the close button .. both of the buttons effects will happen in the same time because both have the same Y... and that a problem.. so someone have solution ? local screenW, screenH = guiGetScreenSize() local sW = (screenW / 1280) local sH = (screenH / 768) local tS = (screenW / 1280) local color = tocolor(255, 255, 255, 255) function dx_gui () dxDrawLine(sW*363, sH*99, sW*363, sW*632, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(sW*880, sH*99, sW*363, sH*99, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(sW*363, sH*632, sW*880, sH*632, tocolor(0, 0, 0, 255), 1, false) dxDrawLine(sW*880, sH*632, sW*880, sH*99, tocolor(0, 0, 0, 255), 1, false) dxDrawRectangle(sW*364, sH*100, sW*516, sH*532, tocolor(0, 0, 0, 100), false) dxDrawRectangle(sW*364, sH*157, sW*516, sH*6, tocolor(255, 255, 255, 255), false) dxDrawText("MEDIC JOB", sW*489, sH*108, sW*677, sH*147, tocolor(255, 255, 255, 255), tS*1.50, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("Accept", sW*381, sH*587, sW*502, sH*622, color, tS*1.00, "bankgothic", "left", "top", false, false, false, false, false) dxDrawText("CLOSE", sW*741, sH*587, sW*862, sH*622, color2, tS*1.00, "bankgothic", "left", "top", false, false, false, false, false) dxDrawRectangle(sW*364, sH*571, sW*516, sH*6, tocolor(255, 255, 255, 255), false) dxDrawText("This the medic job. In this job\nyou will be given an ambulance\nYou must drive injured people\nto this hospital before They\nDie. Injured People will be\nmarked in your map. Use F11 To\nToggle your map. You will be\nrewarded for every person you \nsave. You can get your vehicle\nFrom the yellow marker near\nyou.", 366, 169, 876, 567, tocolor(255, 255, 255, 255), 1.00, "bankgothic", "left", "top", false, false, false, false, false) end function dx_move (_, _, x, y) if ( x >= sW*741 and x <= (sW*741) + (sW*862) and y > (sH*587) and y < (sH*587) + (sH*622) ) then color2 = tocolor (255, 255, 0, 255) else color2 = tocolor (255, 255, 255, 255) end if ( x >= sW*381 and x <= (sW*381) + (sW*502) and y > (sH*587) and y < (sH*587) + (sH*622) ) then color = tocolor (255, 255, 0, 255) else color = tocolor (255, 255, 255, 255) end end function dx_click (b, s, x, y) if (b == 'left' and s == 'up') then if ( x >= sW*741 and x <= (sW*741) + (sW*862) and y > (sH*587) and y < (sH*587) + (sH*622) ) then deMenu () end if ( x >= sW*381 and x <= (sW*381) + (sW*502) and y > (sH*587) and y < (sH*587) + (sH*622) ) then deMenu () end end end function Menu () showCursor(true) addEventHandler('onClientRender', root, dx_gui) addEventHandler('onClientCursorMove', root, dx_move) addEventHandler('onClientClick', root, dx_click) end function deMenu () showCursor(false) removeEventHandler('onClientRender', root, dx_gui) removeEventHandler('onClientCursorMove', root, dx_move) removeEventHandler('onClientClick', root, dx_click) end marker = createMarker ( -270.28204, 1020.90601, 19.58599, "cylinder", 2, 255, 255, 0, 255 ) addEventHandler ( "onClientMarkerHit", marker, Menu )
-
mmm. idk what arguments to put.. that is the problem.. not what u think
-
i am trying to draw dxText in the vehicle controller screen when the vehicle hit the marker .. but the vehicle and the marker is serverside... so.. i have to use triggerClientEvent.. but i couldn't understand it so i failed.. i need an example that draws a dxText when this vehicle hits the marker medic = createMarker ( -2682.36011, 637.64075, 13.45313, "cylinder", 1.5, 255, 255, 0, 170 ) amb = createVehicle ( 416, -2706.55298, 613.83698, 14.45313 )