Jump to content

Kenix

Retired Staff
  • Posts

    4,121
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Kenix

  1. Kenix

    New chat

    Server side. function infochat( thePlayer, commandName,... ) if exports.global:isPlayerBronzeDonator( thePlayer ) or exports.global:isPlayerAdmin( thePlayer ) then local tArgs = { ... } if #tArgs == 0 then outputChatBox( "SYNTAX: /" .. commandName .. " [Message]", thePlayer, 255, 194, 14 ) else local message = table.concat( tArgs, " " ) local title = "" local hidden = getElementData( thePlayer, "hiddenadmin" ) or 0 if exports.global:isPlayerAdmin( thePlayer ) then if hidden == 1 or exports.global:getPlayerAdminTitle( thePlayer ) == "Player" then if not exports.global:isPlayerBronzeDonator( thePlayer ) then title = "Bronze Donator" else title = exports.global:getPlayerDonatorTitle( thePlayer ) end else title = exports.global:getPlayerAdminTitle( thePlayer ) end elseif exports.global:isPlayerBronzeDonator( thePlayer ) then title = exports.global:getPlayerDonatorTitle( thePlayer ) end for key, value in pairs( getElementsByType 'player' ) do if exports.global:isPlayerBronzeDonator( value ) or exports.global:isPlayerAdmin( value ) then if getElementData( value, "infochat" ) == 1 then outputChatBox( "[Donator] " .. title .. " " .. getPlayerName( thePlayer ) .. ": " .. message, value, 160, 164, 104 ) end end end end end end addCommandHandler( "i", infochat, false, false ) addCommandHandler( "info", infochat, false, false ) addCommandHandler( "ichat", infochat, false, false )
  2. If this 'fence' is mta element then it detected or otherwise not detected. If not detected you need use https://wiki.multitheftauto.com/wiki/ProcessLineOfSight and scan radius in onClientRender event.
  3. onGamemodeMapStart is server side event. localPlayer is client side variable. https://wiki.multitheftauto.com/wiki/Pre ... ables_list
  4. addEvent( "onPlayerFinish",true ) addEventHandler( "onPlayerFinish",root, function ( rank,finishtime ) local account = getPlayerAccount( source ) if isGuestAccount( account ) then outputChatBox( "You must be logged in to get the reward." , source, 255, 0, 0, true ) else if rank == 1 then setAccountData( account, "Race Wins", tonumber( getAccountData( account,"Race Wins" ) )+1 ) elseif rank >= 2 then setAccountData( account, "Race Loses", tonumber( getAccountData( account,"Race Loses" ) )+1 ) end end end )
  5. Kenix

    Error ???

    Wrong code al3grab charLabel[1] = guiCreateLabel( 5,0,100,15,"Something",false ) charLabel[2] = guiCreateLabel( 5,0,100,15,"Something",false ) charLabel[3] = guiCreateLabel( 5,0,100,15,"Something",false ) for _,v in pairs ( charLabel ) do guiSetFont( v, "default-bold-small" ) end
  6. Yes, you right. Added to wiki https://wiki.multitheftauto.com/wiki/Pre ... ables_list Created link in Introduction to Scripting. https://wiki.multitheftauto.com/wiki/Scr ... troduction
  7. Kenix

    Error ???

    local charPane = { } local charLabel = { } for k,v in ipairs( character ) do local y = ( k - 1 )* 55 charPane[k] = guiCreateScrollPane( 7, 130 + y, 250, 50, false ) charLabel[k] = guiCreateLabel( 5,0,100,15,v,false,charPane[k] ) guiSetFont( charLabel[k], "default-bold-small" ) end
  8. banPlayer ты не можешь юзать т.к требует элемента игрока на сервере. Аккаунт можешь банить только мта сообщества.( т.е не игрока с аккаунтом на сервере ) Смотри в аргументах. function banPlayerCommand ( player, command, ip, serial, reason ) -- The function header and where source is defined if addBan ( ip, nil , serial, player, reason or '' ) then outputChatBox ( "ban: success", player ) end end addCommandHandler ( "bann", banPlayerCommand ) Тока так если или написать свою систему.
  9. 1)2 аргумент в функции addBan это строка. 2) bannedName это строка, а не элемент, ты не сможешь получить аккаунт.
  10. playSound3D 1 аргумент должен быть url. P.S Добавил на вики пример и допилил описание ( что можно юзать url ).
  11. Потому-что ты юзаешь 3 аргумента там всего их 2 https://wiki.multitheftauto.com/wiki/SetSoundVolume. И переменная przom таблица , а не звуковой элемент setSoundVolume(przom,0.1,0.1) Исправлено: local przom = { "przom/tune1.ogg","przom/tune2.ogg", "przom/tune3.ogg","przom/tune4.ogg", "przom/tune5.ogg","przom/tune6.ogg", "przom/tune7.ogg" } function playsound( ) local sound = playSound( przom[ math.random( #przom ) ] ) setSoundVolume( sound,0.1 ) end setTimer( playsound, 120000,0 )
  12. 1.variable quitPlayer nil in your script 2.addEventHandler have only 5 arguments and 4 argument is getPropagated but you use function 3.You forgot , Fixed code. addEventHandler ( "onPlayerQuit", root, function( ) if getElementData( source,"bank" ) == 1 then setElementAlpha( bankMarker,255 ) triggerServerEvent( "ServerPlaySoundRobberyStop",root ) setElementData( source,"bank",2 ) if isTimer( bankRobberTimer ) then killTimer( bankRobberTimer ) end if isTimer( timerWasted ) then killTimer( timerWasted ) end timerWasted = setTimer( function( player ) setElementData( player,"bank",0 ) end, 60000, 1 , source ) end end ) https://wiki.multitheftauto.com/wiki/AddEventHandler Learn it viewtopic.php?f=141&t=32458
  13. Молодец,Добавил в первый пост. Добавил ещё 5 функций с примерами
  14. Try use this scripts for convert to dff and col.
  15. If this 'fence' is mta element then it detected or otherwise not detected. If not detected you need use https://wiki.multitheftauto.com/wiki/ProcessLineOfSight and scan radius in onClientRender event.
  16. Little fix, at the request of the author. addEvent( "stopplaySoundRobbery",true ) addEvent( "playSoundRobbery",true ) addEvent( "playSoundRobberyStop",true ) local timerShape,timerWasted bankMarker = createMarker( 364.00500488281,163.38682556152,1008.3828125,"cylinder",3,150,0,0,255 ) bankBip = createBlip ( 2416.5532226563, 1124.1168212891, 10.8203125, 36, 2 ) setElementInterior( bankMarker,3,364.00500488281,163.38682556152,1007.4828125 ) --3 int missionState = 0 bankColshape = createColCircle ( 2414.1735839844,1123.9982910156,10.8203125,1 ) addEventHandler( "onClientColShapeLeave",bankColshape, function( LeaveElement, matchingDimension ) if LeaveElement == localPlayer then if getElementData( LeaveElement,"bank" ) == 1 then setElementAlpha( bankMarker,255 ) outputChatBox( "`Миссия провалена вы не захватили банк!",255,0,0 ) triggerServerEvent( "ServerPlaySoundRobberyStop",root ) setElementData( LeaveElement,"bank",2 ) if isTimer( bankRobberTimer ) then killTimer( bankRobberTimer ) end if isTimer( timerShape ) then killTimer( timerShape ) end timerShape = setTimer( function ( player ) setElementData( player,"bank",0 ) end, 60000, 1,LeaveElement ) end end end ) addEventHandler( "onClientPlayerWasted",localPlayer, function( ) if getElementData( source,"bank" ) == 1 then outputChatBox( "`Миссия провалена вы не захватили банк!",255,0,0 ) setElementAlpha( bankMarker,255 ) triggerServerEvent( "ServerPlaySoundRobberyStop",root ) setElementData( source,"bank",2 ) if isTimer( bankRobberTimer ) then killTimer( bankRobberTimer ) end if isTimer( timerWasted ) then killTimer( timerWasted ) end timerWasted = setTimer( function( player ) setElementData( player,"bank",0 ) end, 60000, 1 , source ) end end ) addEventHandler( "playSoundRobbery",root, function( ) sound = playSound3D ("alarm.mp3", 364.00500488281,163.38682556152,1010.3828125, true ) setSoundMaxDistance ( sound, 50 ) end ) addEventHandler( "playSoundRobberyStop",root, function( ) stopSound( sound ) end ) addEventHandler( "onClientMarkerHit",bankMarker, function( hitElement, matchingDimension ) if hitElement == localPlayer then if getElementData( hitElement,"bank" ) == 1 or getElementData( hitElement,"bank" ) == 2 then return end showCursor( true ) bankWindow = guiCreateWindow(0.3184,0.3568,0.3809,0.306,"ROBBER",true) buttonYes = guiCreateButton(36,147,89,46,"Yes",false,bankWindow) buttonNo = guiCreateButton(251,147,89,46,"No",false,bankWindow) addEventHandler ( "onClientGUIClick", buttonYes, function( ) showCursor( false ) guiSetVisible( bankWindow,false ) triggerServerEvent( "ServerPlaySoundRobbery",root ) --triggerServerEvent("ServerPlaySoundRobbery",localPlayer) outputChatBox( "`Вы захватили банк вы должны продержаться 5 минут.",255,0,0 ) setElementAlpha( bankMarker,0 ) outputChatBox( "`Вы сможете захватить банк через 180 минут.",255,0,0 ) outputChatBox( "`Если вы выйдите из банка то миссия будет провалена!",255,0,0 ) setElementData( hitElement,"bank",1 ) callServerfunction( "setPlayerWantedLevel",hitElement, 6 ) --missionState = 1 if isTimer( bankRobberTimer ) then killTimer( bankRobberTimer ) end bankRobberTimer = setTimer( function( ) outputChatBox("`Вы успешно ограбили банк вы получили 100 000 $.",255,0,0) triggerServerEvent("ServerPlaySoundRobberyStop",root) setTimer( function( ) setElementData( localPlayer,"bank",0 ) setElementAlpha( bankMarker,255 ) end, 60000 , 1 ) callServerfunction( 'givePlayerMoney',localPlayer,100000 ) end, 60000, 1 ) --300000 end ,false ) addEventHandler ( "onClientGUIClick", buttonNo, function ( ) showCursor( false ) guiSetVisible( bankWindow,false ) end ,false ) end end ) function callServerfunction( funcname, ... ) local arg = { ... } if arg[1] then for key, value in next, arg do if type( value ) == "number" then arg[ key ] = tostring( value ) end end end triggerServerEvent( "onClientCallsServerFunction", resourceRoot , funcname, unpack( arg ) ) end addCommandHandler( "data", function( ) setElementData( localPlayer,"bank",0 ) end )
  17. Kenix

    Help please !

    You can create most images ( animated effect ) or you can use this library: viewtopic.php?f=108&t=24262&hilit=textlib Download link: http://www.mediafire.com/?o3ndd7jtf8gqf54 This library have functions for animate dx/gui.
×
×
  • Create New...