Jump to content

Kenix

Retired Staff
  • Posts

    4,121
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Kenix

  1. Я думаю нужно больше параметров добавить к этой функции. Я про то что можно настроить видимость через здания,машины,игроков и т.д https://wiki.multitheftauto.com/wiki/ProcessLineOfSight
  2. No problem Read it https://wiki.multitheftauto.com/wiki/Scr ... troduction And it http://www.lua.org/manual/5.1/ You need know it.
  3. Client ja = getLocalPlayer() local state = false function hud ( ) if not state then showPlayerHudComponent ( "all", false ) outputChatBox ( "HUD bolo uspesne vypnute", 0, 255, 0 ) state = true else showPlayerHudComponent ( "all", true ) outputChatBox ( "HUD bolo uspesne povolené", 0, 255, 0 ) state = false end end addCommandHandler ( "hud", hud )
  4. exports.scoreboard:addScoreboardColumn( 'Time' ) setTimer( function( ) for _, v in pairs( getElementsByType( "player" ) ) do local totalTime = getElementData( v,"totalTime" ) or 0 setElementData( v,"totalTime",totalTime+1 ) setElementData( v,"Time",math.floor( tonumber( totalTime )/60 ).." Mins" ) end end, 1000, 0 ) Why you need variable index you can use _ ( freeze variable ) in loop. And second remember operator or is very useful.
  5. no,dxDrawText is client side function. https://wiki.multitheftauto.com/wiki/Scr ... troduction
  6. And your resources have duplicate
  7. Should work Server side ------------------- ----DEFINITION---- ------------------- call(getResourceFromName("scoreboard"), "addScoreboardColumn", "Wins", root, 3, .08 )-----| ------------ ---WINNER--- ------------ function winHandler( rank,_ ) if rank == 1 then setElementData ( source, "Wins", tonumber( getElementData ( source, "Wins" ) or 0 ) + 1 ) end end addEventHandler( "onPlayerFinish",root,winHandler )
  8. This is worng Correct function start( player ) if isElement( player ) then crate = createObject( 2991,-1353,-185,14 ) local team = getPlayerTeam( player ) local object = createObject( 2991, -1353, -185, 14 ) if team then local police = getTeamFromName( "Police" ) local criminals = getTeamFromName( "Criminals" ) if team == police then outputChatBox( "You're a police officer.", player, 0, 255, 0 ) elseif team == criminal then outputChatBox( "You're a criminal.", player, 0, 255, 0 ) end end end end addEventHandler("onResourceStart", resourceRoot, function( resource ) setTimer( function ( ) local players = getElementsByType( "player" ) for _, player in pairs( players ) do start( player ) end end , 7500, 1) end )
  9. Прочти эту тему ещё раз: viewtopic.php?f=141&t=32458
  10. Эта функция будет окрашивать весь лейбл в один цвет. Если нужно разные цвета 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
  11. local label = guiCreateLabel( 0.5,0.5,0.9,0.9,"",true ) guiLabelSetHexColor ( label, "#2e88f9Текст",true )
  12. Try function cheata (text,msType) if msType == 2 then executeCommandHandler("t",source,_,text) end end addEventHandler( "onPlayerChat", getRootElement(), cheata ) Test it and see in debug.
  13. Да я уже понял . Спасибо
  14. Ты можешь запросить эту функцию на баг трекере.
  15. Kenix

    how to...

    Try function adminChat( thePlayer,_,... ) local text = table.concat( {...}, "" ) local name = getPlayerName( thePlayer ) for _,v in pairs( getPlayersInGroup( accName ) ) do outputChatBox ("#FF0000(Admin Chat) "..tostring( name )..": #FFFFFF"..tostring( text ), v, 255, 255, 255, true) end end addCommandHandler("ac", adminChat) function getPlayersInGroup( accName ) local Table = { } for _,v in pairs( getElementsByType( "player" ) ) do local accName = getAccountName ( getPlayerAccount ( v ) ) if isObjectInACLGroup ( "user." .. tostring( accName ), aclGetGroup( "Admin" ) ) or isObjectInACLGroup ( "user." .. tostring( accName ), aclGetGroup ( "SuperModerator" ) ) or isObjectInACLGroup ( "user." .. tostring( accName ), aclGetGroup ( "Moderator" ) ) then table.insert( Table,v ) end end return Table end Code updated recheck it
  16. Через таблицы лучше local t = { [5] = true, [6] = true --.... } if t[ getPedWeapon( localPlayer ) ] then -- ... end
  17. Спасибо большое я просто думал что gui-window нету в аргументах getElementsByType
  18. function isUnderWater( ) local task,task2 = getPedTask( localPlayer,"primary",2 ) if task == "TASK_COMPLEX_IN_WATER" and task2 == "TASK_SIMPLE_SWIM" then -- игрок в воде local _,_,z = getElementPosition( localPlayer ) if z < -1 then return true end return false end return false end Написал функцию но она проверяет подводой или нет. Сегодня попробую проверить...
  19. If it not use convert number to string in function outputChatBox then it created a error in script. Just test my code and see. Idk what you mean "detect" you can see him message in log file or create onPlayerChat event create a outputDebugString or outputServerLog.
  20. Повторю ещё раз мой прошедший пост: getPedStat ( localPlayer, 225 ) Это показывает какой у тебя скилл а не сколько кислорода у тебя. Обновил пост
  21. function cheata ( text,msType ) if msType == 2 then outputChatBox( tostring( msType ) ) outputChatBox( text ) end end addEventHandler( "onPlayerChat", root, cheata ) Because variable msType is number and you can't output in function outputChatBox.You need convert number to string see arguments in function https://wiki.multitheftauto.com/wiki/OutputChatBox
  22. Мне нужно проверить в цикле есть ли открытые окна или нет. Но я не знаю есть ли для функции getElementsByType 1 аргумент что-то подобия "gui-window". Может быть это оно и есть я не знаю.
×
×
  • Create New...