Jump to content

Kenix

Retired Staff
  • Posts

    4,121
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Kenix

  1. Kenix

    Music topic :)

    Do you like music? All types of music You can post here your musics! Go ahead! Some rules: - If you have more than two musics post in spoiler tags: -- spoiler tag [spoiler][/spoiler] - Use bb code (youtube) [youtube][/youtube] Example Url music is So we need use only https://www.youtube.com/watch?v=dBgArsOUbEo [spoiler] [youtube]21vLe_yIjRw[/youtube] [youtube]dBgArsOUbEo[/youtube] [/youtube] Begin.
  2. Kenix

    LC 2 MTA

    Good job!
  3. Kenix

    [REL] DxWorld

    Also You Scripting moderator (Guru) Why you write this to me? it's good for you insult/humiliate to people?
  4. Kenix

    [REL] DxWorld

    Haha nice joke dude. I not say about you. You not know what i mean, because you don't know about OOP. Also, see source code mta and you can understand.
  5. Kenix

    [REL] DxWorld

    It's rly sample. All can do this. If you make this via class it's will be more better. For example Methods CWorldText:CWorldText( sText ) CWorldText:Destroy( ) CWorldText:Color( nR, nG, nB, nA ) CWorldText:Position( fX, fY, fZ ) CWorldText:Attach( pElement, fPosOffX, fPosOffY, fPosOffZ, fRotOffX, fRotOffY, fRotOffZ ) ... Also use this classlib by lua devs and updates by Setuper and Kernell P.S All description you can see here too Example usage class 'CWorldText' function CWorldText:CWorldText( sText ) -- TODO self.sText = sText self.nR = 255 self.nG = 255 self.nB = 255 self.nA = 255 end function CWorldText:Color( nR, nG, nB, nA ) if type( nR ) == 'number' and type( nG ) == 'number' and type( nB ) == 'number' then -- TODO self.nR = nR self.nG = nG self.nB = nB self.nA = type( nA ) == 'number' and nA or 255 end return self.nR, self.nG, self.nB, self.nA end Text = CWorldText 'Some text' Text:Color( 255, 0, 0, 175 )
  6. В мап едиторе есть "прицел" внизу, где список элементов (пикапы, тачки, .. ) Кликаешь на него и у тебя появляется прицел на экране, подлетаешь к объекту жмёшь ЛКМ и у тебя появляется этот объект и ты его можешь ставить куда угодно.
  7. All wrong. You use server side functions in client side.
  8. https://community.multitheftauto.com/index.php?p= ... ls&id=4919
  9. Русских серверов намного больше. Активная реклама, пиар поможет притоку русских игроков. Сам сервер должен быть уникальным, чтобы на него заходили игроки.
  10. Write number string like 123456 ... and test again and you can see this more good. This function should transfer string.
  11. If you not want fix. Okay .. Better council. Check variables height, numLines, ..
  12. Зачем писать одно и тоже если на вики написано всё чётко про это. P.S По-моему это как минимум глупо писать, что кто то хуже, а другой лучше. P.S2 Kero 9 Destiny давай заканчивай уже с этим.
  13. Solidsnake14 Can you upload your resource? I test and fix.
  14. function string.transfer( s, nMax ) if type( s ) == 'string' and type( nMax ) == 'number' then local nMaxOld = nMax local nLength = #s -- change to utfLen( s ) if you working with unicode. if nLength >= nMax then local sNew = '' local nStart = 0 for nCount = 1, math.ceil( nLength / nMax ) do sNew = sNew .. '\n'.. s:sub( nStart + 1, nMax ) nStart = nMax nMax = nMax + nMaxOld end return sNew:sub( 2, #sNew ) -- -- change #sNew to utfLen( sNew ) if you working with unicode. end return s end return false end print( string.transfer( '123456', 2 ) ) --[[ 12 34 56 ]] ?
  15. Kenix

    Medic problem

    Anyway. You should write correct code.
  16. Kenix

    Medic problem

    Again fail takePlayerMoney, givePlayerMoney is not synced. You should trigger to server side and use this.
  17. У тебя в коде было написано 'onReplayerStart', я не обратил внимание на это. Должно быть onResourceStart. root - корень всех элементов, resourceRoot - корень всех элементов текущего ресурса. Дерево элементов Если источник( source ) nil, то будет использоваться переменная pPlayer. Т.к в функции-обработчике команды нет источника, приходится делать это.
  18. Kenix

    Medic problem

    Alpha onPlayerDamage event is not cancelled. localPlayer only in client side.
  19. source - это скрытая переменная в функции-обработчике события, она может содержать в себе элемент (корень всех элементов( root ), игрока, объект, ... ). Тебе нужно использовать именно там, а не вне функции-обработчика события. Команды тоже не будут работать. Так будет правильнее local source = source or pPlayer и addEventHandler("onPlayerSpawn",getRootElement(),bindKeys) При каждом спавне игрока будут биндится все кнопки для всех игроков. и при старте любого ресурса тоже будут биндится все кнопки для всех игроков. addEventHandler("onReplayerStart",getRootElement(),bindKeys) Это if getVehicleEngineState( pVehicle ) then setVehicleEngineState( pVehicle, false ) else setVehicleEngineState( pVehicle, true ) end можно заменить этим setVehicleEngineState( pVehicle, not getVehicleEngineState( pVehicle ) ) Тоже самое if isVehicleLocked( pVehicle ) then setVehicleLocked( pVehicle, false ) else setVehicleLocked( pVehicle, true ) end setVehicleLocked( pVehicle, not isVehicleLocked( pVehicle ) ) и if getVehicleOverrideLights( pVehicle ) == 2 then setVehicleOverrideLights( pVehicle, 1 ) else setVehicleOverrideLights( pVehicle, 2 ) end setVehicleOverrideLights( pVehicle, getVehicleOverrideLights( pVehicle ) == 2 and 1 or 2 ) Правильный код. addEvent( 'onVehicleChangeEngine', true ) addEvent( 'onVehicleChangeLight', true ) addEvent( 'onVehicleChangeLock', true ) function SwitchEngine( pPlayer ) local source = source or pPlayer if isPedInVehicle( source ) then local pVehicle = getPedOccupiedVehicle( source ) if pVehicle and getVehicleController( pVehicle ) == source then setVehicleEngineState( pVehicle, not getVehicleEngineState( pVehicle ) ) end end end function SwitchLight( pPlayer ) local source = source or pPlayer if isPedInVehicle( source ) then local pVehicle = getPedOccupiedVehicle( source ) if pVehicle and getVehicleController( pVehicle ) == source then setVehicleOverrideLights( pVehicle, getVehicleOverrideLights( pVehicle ) == 2 and 1 or 2 ) end end end function SwitchLock( pPlayer ) local source = source or pPlayer if isPedInVehicle( source ) then local pVehicle = getPedOccupiedVehicle( source ) if getElementID( pVehicle ) == getPlayerName( source ) then setVehicleLocked( pVehicle, not isVehicleLocked( pVehicle ) ) end end end function BindKeys( ) if eventName == 'onPlayerJoin' then bindKey( source, '2', 'down', SwitchEngine ) bindKey( source, '1', 'down', SwitchLight ) else for _, pPlayer in ipairs( getElementsByType 'player' ) do bindKey( pPlayer, '2', 'down', SwitchEngine ) bindKey( pPlayer, '1', 'down', SwitchLight ) end end end addCommandHandler( 'engine', SwitchEngine ) addCommandHandler( 'lights', SwitchLight ) addCommandHandler( 'lock', SwitchLock ) addEventHandler( 'onReplayerStart', resourceRoot, BindKeys ) addEventHandler( 'onPlayerJoin', root, BindKeys ) addEventHandler( 'onVehicleChangeEngine', root, SwitchEngine ) addEventHandler( 'onVehicleChangeLight', root, SwitchLight ) addEventHandler( 'onVehicleChangeLock', root, SwitchLock )
  20. All is good but where 'end' and ') '?
  21. it's wrong type Lua is case sensitive. Type marker should be 'cylinder'.
×
×
  • Create New...