drk
Members-
Posts
1,607 -
Joined
-
Last visited
Everything posted by drk
-
setTimer ( function ( ) local cx = math.random ( 1005, 5555 ) for i, v in ipairs ( getElementsByType ( 'player' ) ) do givePlayerMoney ( v, cx ) outputChatBox( 'You won ' .. cx, v, 255, 255, 255, false ) end end, 1000, 0 )
-
I removed the getPlayerName function that removes hex color from _common.lua I will try now. Anyway Kenix is helping me. I think you can lock this post
-
I used getPlayerName(source) and it return without colors
-
I'm trying to create a gui label and use color codes in the label. I tried editing guiCreateColorLabel ( you can find it on forum ) but it don't work. It appear without color codes but no colors Anyone knows a way to put color codes in a label and the colors appear?
-
This skype group is for helping people in Lua scripting.
-
Server Side: addEvent("onMapStarting",true) addEvent('buyMap',true) function buyMap(thePlayer,mapName) local playerCash = tonumber(loadPlayerData(thePlayer,"cash")) if ( mapIsAlreadySet == false ) then if ( not mapName == "" ) then if ( playerCash >= mapCost ) then triggerEvent("onSetNextMap",thePlayer,thePlayer,mapName) else outputChatBox("#FF6600* #FFFFFFYou don't have enough money to set a map!",thePlayer,255,255,255,true) end else outputChatBox("#FF6600* #FFFFFFPlease select a map from the list first!",thePlayer,255,255,255,true) end else outputChatBox("#FF6600* #FFFFFFA map is already set at the moment! Please try again later.",thePlayer,255,255,255,true) end end addEventHandler('buyMap',root,buyMap) function resetMapSetStatus() mapIsAlreadySet = false end addEventHandler("onMapStarting",getRootElement(),resetMapSetStatus) addEvent("onSetNextMap",true) addEventHandler("onSetNextMap",getRootElement(), function (thePlayer,mapName) local playerCash = tonumber(loadPlayerData(thePlayer,"cash")) savePlayerData(thePlayer,"cash",playerCash-mapCost) outputChatBox("#FFFFFFNextmap: "..getPlayerName(thePlayer).."#FFFFFF has bought a next map!",getRootElement(),255,255,255,true) outputChatBox("#FFFFFFNextmap: #FF8800"..mapName,getRootElement(),255,255,255,true) mapIsAlreadySet = true scoreboardRefresh(thePlayer) achievement31(thePlayer) end ) Client Side: function buyNextMap() local selectedMap, column = guiGridListGetSelectedItem(gridMaps) if not selectedMap and not column and selectedMap == -1 and column == -1 then outputChatBox("#FF6600* #FFFFFFERROR! Please select a Map to buy!",255,255,255,true) -- you can't use color codes in client-side else local mapName = guiGridListGetItemText(gridMaps,colName,1) --change colName by your column name. triggerServerEvent("buyMap",localPlayer,localPlayer,mapName) end end addEventHandler("onClientGUIClick",btn_buyNextMap, buyNextMap, true)
-
Server-side: addCommandHandler('deletemap', function(player,cmd,...) local map = table.concat(...,' ') local search = getResourceFromName(map) if search then deleteResource(search) outputChatBox("Map sucessfully deleted!",player,255,255,255,false) else outputChatBox("Map not found!",player,255,255,255,false) end end ) Add to meta.xml: <min_mta_version server="1.1.1-9.03316" /> Not tested. Command: /deletemap MapResourceName
-
Admin resource probably is not in ACL.
-
Ye, reupload it please. Megaupload is down forever
-
You have to change resolutionX and resolutionY in dxDrawRelativeRectangle and dxDrawRelativeText and put your resolution X, resolution Y.
-
https://wiki.multitheftauto.com/wiki/Ser ... _functions
-
local sx, sy = guiGetScreenSize() dxDrawText(join,(posX/yourResolutionX)*sx,(posY/yourResolutionY)*sy,(width/yourResolutionX)*sx,(height/yourResolutionY)*sy,tocolor(255,255,255,255),0.6,"pricedown","left","top",false,false,true) Example: local sx, sy = guiGetScreenSize() dxDrawText("My text",(10/800)*sx,(200/600)*sy,(10/800)*sx,(200/600)*sy,tocolor(255,255,255,255),0.6,"pricedown","left","center",false,false,true)
-
I think this is more easy to understand... local join = '' local quit = '' addEventHandler('onClientRender',root, function() dxDrawText(join,x,y,width,height,color,size,font,left,top,clip,wordbreak,postGUI) dxDrawText(quit,x,y,width,height,color,size,font,left,top,clip,wordbreak,postGUI) end ) addEventHandler('onClientPlayerJoin',root, function() join = getPlayerName(source).." has joined the game!" setTimer( function() join = '' end, 5000,1) end ) addEventHandler('onClientPlayerQuit',root, function(reason) quit = getPlayerName(source).." has left the game! Reason: "..reason setTimer( function() quit = '' end, 5000,1) end )
-
I think that isn't called "Colshape"... I don't know the name.
-
Kenix, your work but color codes appears and not colors. Cadu12, I've seen that r, g, b is nil then it sets r = 255, g = 255, b = 255. My code: function guiCreateColorLabel ( ax, ay, bx, by, str, relative, 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 = tocolor( tonumber( "0x"..col:sub( 1, 2 ) ), tonumber( "0x"..col:sub( 3, 4 ) ), tonumber( "0x"..col:sub( 5, 6 ) ), 255 ) end last = e + 1 s, e, cap, col = str:find( pat, last ) end if r == nil then r = 211 end if g == nil then g = 211 end if b == nil then b = 211 end if last <= #str then cap = str:sub( last ) string = string.gsub(cap,'%x%x%x%x%x%x','') label = guiCreateLabel ( ax, ay, bx, by, string, relative, parent ) guiLabelSetColor ( label, r, g, b ) return label end end
