Jump to content

Kenix

Retired Staff
  • Posts

    4,121
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Kenix

  1. Maybe you mean "Downloading Text" ? Easy,Example: Server: addEvent( "onClientSend",true ) local serverDisplay,serverText addEventHandler( "onClientSend",root, function( ) textDisplayRemoveObserver( serverDisplay, source ) end ) addEventHandler( "onPlayerJoin",root, function( ) serverDisplay = textCreateDisplay( ) textDisplayAddObserver ( serverDisplay, source ) serverText = textCreateTextItem ( "Downloading.Please wait!", 0.5, 0.5,1,255,0,0,255,2,"center","center",200 ) textDisplayAddText ( serverDisplay, serverText ) end ) Client: triggerServerEvent( "onClientSend",localPlayer ) -- trigger to remove text if player downloaded or maybe you mean this: Server: local timeShow = 5000 -- 5 seconds timerConnectShowText = { } addEventHandler( "onPlayerJoin",root, function( ) local serverDisplay = textCreateDisplay( ) textDisplayAddObserver ( serverDisplay, source ) local serverText = textCreateTextItem ( "Downloading.Please wait!", 0.5, 0.5,1,255,0,0,255,2,"center","center",200 ) textDisplayAddText ( serverDisplay, serverText ) timerConnectShowText[ source ] = setTimer( textDisplayRemoveObserver,timeShow,1,serverDisplay, source ) end ) addEventHandler( "onPlayerQuit",root, function( ) timerConnectShowText[ source ] = nil end ) Naturally, this example you need to modify it.
  2. More better and it should working: local screenWidth, screenHeight = guiGetScreenSize ( ) -- Get the screen resolution (width and height) function createText ( ) local team = getTeamFromName( "Aliens" ) if team then dxDrawText ( "Team:\n"..table.concat( getPlayersInTeam ( team ),"\n" ), 175, screenHeight - 98, screenWidth, screenHeight, tocolor ( 0, 0, 0, 255 ), 1.02, "pricedown" ) end end addEventHandler ( "onClientRender", root, createText ) -- keep the text visible with onClientRender. Example draw: Team: Player1 Player2 ...
  3. Hmm check GUIEditor_Window = {} GUIEditor_Button = {} GUIEditor_Label = {} GUIEditor_Edit = {} GUIEditor_Grid = {} GUIEditor_Image = {} GUIEditor_Window[1] = guiCreateWindow(701,328,584,394,"Map Shop",false) GUIEditor_Image[1] = guiCreateStaticImage(11,19,564,366,"back.png",false,GUIEditor_Window[1]) GUIEditor_Label[1] = guiCreateLabel(273,13,289,21,"Local Money:",false,GUIEditor_Image[1]) guiLabelSetColor(GUIEditor_Label[1],0,0,0) guiSetFont(GUIEditor_Label[1],"default-bold-small") GUIEditor_Label[2] = guiCreateLabel(270,75,284,70,"A Map Costs 4000$\n\nHow To Get Money?\nStand in the top3 of winners or reach the hunter",false,GUIEditor_Image[1]) guiLabelSetColor(GUIEditor_Label[2],0,0,0) guiSetFont(GUIEditor_Label[2],"default-bold-small") GUIEditor_Button[1] = guiCreateButton(280,264,265,91,"Buy Map [ -4000 ]",false,GUIEditor_Image[1]) GUIEditor_Label[3] = guiCreateLabel(272,36,252,19,"Local Map Status:",false,GUIEditor_Image[1]) guiLabelSetColor(GUIEditor_Label[3],0,0,0) guiSetFont(GUIEditor_Label[3],"default-bold-small") GUIEditor_Edit[1] = guiCreateEdit(286,211,252,45,"Local Map",false,GUIEditor_Image[1]) GUIEditor_Label[4] = guiCreateLabel(293,170,233,37,"Selected Map:",false,GUIEditor_Image[1]) guiLabelSetColor(GUIEditor_Label[4],0,255,0) guiLabelSetVerticalAlign(GUIEditor_Label[4],"center") guiLabelSetHorizontalAlign(GUIEditor_Label[4],"center",false) guiSetFont(GUIEditor_Label[4],"default-bold-small") mapGridList = guiCreateGridList(3,5,254,357,false,GUIEditor_Image[1]) guiGridListSetSelectionMode(mapGridList,2) mapsColumn = guiGridListAddColumn(mapGridList,"Maps",0.85) guiGridListSetSelectionMode(mapGridList,2) guiSetVisible (GUIEditor_Window[1], false) guiSetVisible (GUIEditor_Image[1], false) function set1( ) selectedRow, selectedCol = guiGridListGetSelectedItem( mapGridList ) gridMapName = guiGridListGetItemText( mapGridList, selectedRow, selectedCol ) guiSetText( GUIEditor_Edit[1], gridMapName ) end addEventHandler( "onClientGUIClick", mapGridList, set1 ) addEvent("sendMaps", true ) function sendmaps(name) row = guiGridListAddRow ( mapGridList ) guiGridListSetItemText ( mapGridList, row, mapsColumn, name, false, false ) end addEventHandler( "sendMaps", getLocalPlayer(), sendmaps ) function test () local mapName = guiGridListGetItemText ( mapGridList, guiGridListGetSelectedItem( row ), 1 ) outputChatBox( "cmd:lol mapName = "..tostring( mapName ) ) triggerServerEvent("nm", getLocalPlayer(), mapName) end addCommandHandler ( "lol", test ) addEventHandler("onClientGUIClick",getRootElement(), function (player) if (source == GUIEditor_Button[1]) then outputChatBox("Button doet het") mapName = guiGetText ( GUIEditor_Edit[1] ) outputChatBox( "onClientGUIClick mapName = "..tostring( mapName ) ) triggerServerEvent ("nm", getLocalPlayer(), mapName) end end) addEvent( "clearGridList", true ) function clearGridList() guiGridListClear( mapGridList ) end addEventHandler( "clearGridList", getLocalPlayer(), clearGridList ) function onresourceStart () bindKey ("F1", "down", showPanel) end addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), onresourceStart) function showPanel () getVisible = guiGetVisible (GUIEditor_Window[1]) playerName = getPlayerName ( getLocalPlayer() ) if (getVisible == true) then guiSetVisible (GUIEditor_Window[1], false) guiSetVisible (GUIEditor_Image[1], false) showCursor (false) end if (getVisible == false) then triggerServerEvent ( "dannyevent", getRootElement()) guiSetVisible (GUIEditor_Window[1], true) guiSetVisible (GUIEditor_Image[1], true) showCursor (true) local playerMoney = getPlayerMoney(source) guiSetText ( GUIEditor_Label[1], "Local Money: [ " .. playerMoney .. " ]" ) end end
  4. Kenix

    createfont

    So 1.Add to meta.xml <file src="font.ttf" /> 2. Create myFont = dxCreateFont( "font.ttf" ) For example you need use in text addEventHandler( "onClientRender",root, function( ) dxDrawText( "My Text", 100, 350, 300, 350, tocolor( 255,255,0 ), 1, myFont ) end ) 3.Full code myFont = dxCreateFont( "font.ttf" ) addEventHandler( "onClientRender",root, function( ) dxDrawText( "My Text", 100, 350, 300, 350, tocolor( 255,255,0 ), 1, myFont ) end ) P.S Strange function dxCreateFont not colored.
  5. GanJaRuleZ,You create the window and hide . infoMission1 = guiCreateWindow(239,172,364,326,"Mission 1",false) guiSetVisible ( infoMission1, false ) You understand?
  6. Я видал где-то ... Когда найду выложу.
  7. В мта можно всё А по делу это можно сделать через маркеры или через 3д линии. Функции есть на вики .
  8. I have problem with edf. The first i create "Vehilce_buy" in map editor The second i use bind F3 and see ( all Map Editor components hide and i can't create anything ) <def name="some"> <element name="Vehilce_buy" friendlyname="Buy Vehilce"> <data name="model" type="vehicleID" description="vehicle model" default="405" /> <data name="position" type="coord3d" description="XYZ position" default="0,0,0" /> <data name="rotation" type="coord3d" description="XYZ rotation" default="0,0,0" /> <data name="paintjob" type="selection:0,1,2,3" description="vehicle paintjob" required="false" /> <data name="plate" type="plate" description="number plate" required="false" /> <data name="color" type="vehiclecolors" description="vehicle colors" required="false" /> <data name="Interior" type="integer" description="GTA interior world" default="0" /> <data name="Dimension" type="integer" description="MTA dimension" default="0" /> <vehicle model="!model!" color="!color!" interior="!interior!" dimension="!dimension!" /> </element> </def> but if i am not use <data name="color" type="vehiclecolors" description="vehicle colors" required="false" /> all is normal Bug tracker: http://bugs.mtasa.com/view.php?id=6760 Help guys.
  9. So i tested now and all saved.
  10. You not understand me i need save in mysql server.If server shoutdown. P.S i test with addEventHandler( "onResourceStop",resourceRoot, function( ) outputDebugString( "Resource stopped" ) end ) [2011-12-30 12:39:57] Server stopped! [2011-12-30 12:39:57] Stopping resources... [2011-12-30 12:39:57] INFO: Resource stopped [2011-12-30 12:39:57] Closing SQLite3 database But I'm still not sure whether or not to continue. I need answer YES or NO.
  11. I have a question, assume the server shutdown. All saved in the mysql server if I use onResourceStop or not? I need an exact answer.
  12. Пример local t = { [22] = true, [23] = true -- ... } -- таблица скинов к примеру 20,23,... if t[ getElementModel( localPlayer ) ] then -- если модель игрока подоходит по табле -- ... end
  13. Да не за что с новым годом! Событие onClientRender выполняется только на клиенте. По нозванию события понятно должно быть.
  14. Пробуй addEventHandler( "onClientRender",root, function( ) local px, py, pz, tx, ty, tz, dist px, py, pz = getCameraMatrix( ) for k, v in ipairs( getElementsByType( "player" ) ) do tx, ty, tz = getElementPosition( v ) dist = math.sqrt( (px - tx) ^ 2 + (py - ty) ^ 2 + (pz - tz) ^ 2 ) if dist < 30.0 then if isLineOfSightClear( px, py, pz, tx, ty, tz, true, false, false, true, false, false, false, localPlayer ) then local sx, sy, sz = getPedBonePosition( v, 5 ) local x,y = getScreenFromWorldPosition( sx, sy, sz + 0.3 ) if x then -- getScreenFromWorldPosition returns false if the point isn't on screen dxDrawText( getPlayerName( v ), x, y, x, y, tocolor( 150, 50, 0 ), 0.85 + ( 15 - dist ) * 0.02, "bankgothic" ) end end end end end )
  15. Посмотри тогда лог в ПАПКА МТА/MTA/clientscript.log И кинь последние сообщения в логе сюда. meta.xml Твоего ресурса покажи желательно.
  16. /debugscript 3 Ничего не пишет? Мб ты не на клиенте скрипт юзаешь?
  17. Я не понял что ты хочешь сделать. Мб ты имешь ввиду чтобы текст был разноцветный как и сам цвет ника? Есть функция чтобы сделать это через dx: function dxDrawColoredText(str, ax, ay, bx, by, color, scale, font,left,top) left = "left" if not top then top = "top" end 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 color = tocolor(tonumber("0x"..col:sub(1, 2)), tonumber("0x"..col:sub(3, 4)), tonumber("0x"..col:sub(5, 6)), 255) end if s ~= 1 or cap ~= "" then local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font,left,top,true) ax = ax + w color = 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 last <= #str then cap = str:sub(last) local w = dxGetTextWidth(cap, scale, font) dxDrawText(cap, ax, ay, ax + w, by, color, scale, font,left,top,true) end end
  18. На вики всё сделано очень удобно .Все по категориям и найти то что нужно не составит большого труда.
  19. В ручную ищи ошибки Проверяй все. Через outputChatBox и outputDebugString Ну и проверяй возвращаемые значения если надо.
×
×
  • Create New...