Jump to content

Kenix

Retired Staff
  • Posts

    4,121
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Kenix

  1. Изменил оформление и теперь всё по группам.
  2. It is not humane. local timers = { } function aFunction( sourcePlayer ) timers[ sourcePlayer ] = setTimer ( anotherFunction, 120000, 1, sourcePlayer ) -- call anotherFunction end function anotherFunction ( sourcePlayer ) if isTimer( timers[ sourcePlayer ] ) then killTimer( timers[ sourcePlayer ] ) timers[ sourcePlayer ] = nil end end addEventHandler( 'onPlayerQuit',root, function( ) timers[ source ] = nil end ) Index in table is player element( userdata ).
  3. Offtopic: See functions/classes viewtopic.php?f=141&t=33091
  4. Добавил ещё одну очень полезную функцию.
  5. Server addEventHandler( 'onGamemodeMapStart', root, function( startedMap ) local spawns = getElementsByType( 'minispawnpoint', resourceRoot ) for _,v in pairs( getElementsByType 'player' ) do local random = math.random ( #spawns ) local posX = getElementData( spawns[ random ], 'posX' ) local posY = getElementData( spawns[ random ], 'posY' ) local posZ = getElementData( spawns[ random ], 'posZ' ) local team = getElementData( spawns[ random ], 'team' ) local rot = getElementData( spawns[ random ], 'rot' ) or getElementData( spawns[ random ], 'rotZ' ) or 0 spawnPlayer( v,posX,posY,posZ,rot, 0,0,0,getTeamFromName( team ) ) end end ) addEventHandler( 'onPlayerJoin',root, function( ) local spawns = getElementsByType( 'minispawnpoint', resourceRoot ) local random = math.random ( #spawns ) local posX = getElementData( spawns[ random ], 'posX' ) local posY = getElementData( spawns[ random ], 'posY' ) local posZ = getElementData( spawns[ random ], 'posZ' ) local team = getElementData( spawns[ random ], 'team' ) local rot = getElementData( spawns[ random ], 'rot' ) or getElementData( spawns[ random ], 'rotZ' ) or 0 spawnPlayer( source,posX,posY,posZ,rot, 0,0,0,getTeamFromName( team ) ) end ) Updated. But i think you need create 2 type elements( for 2 teams ). Example:redspawnpoint,greenspawnpoint. And loop it.
  6. https://wiki.multitheftauto.com/wiki/RU/ ... awnmanager https://wiki.multitheftauto.com/index.ph ... Mapmanager
  7. You need create if map started spawn all players in spawnpoints ( random spawnpoints )?
  8. Server addCommandHandler( 'health', function( player ) outputChatBox( 'Your health is '..tostring( math.floor( getElementHealth( player ) ) )..'!',player,0,255,0 ) end )
  9. setWeaponProperty is server side function. https://wiki.multitheftauto.com/wiki/Scr ... troduction
  10. Можно ли в модулях сделать клиентский функционал? Например, чтобы сделать несколько клиентских функций , а не серверных. Просто очень хочется реализовать полезные функции , которые не надо будет вызывать.( exports,call ... ) Ну и ещё пару идей есть по этому поводу.
  11. 2 bullets in clip you mean? https://wiki.multitheftauto.com/wiki/SetWeaponProperty
  12. Server addCommandHandler ( "jetpack", function ( player ) local playerTeam = getPlayerTeam ( player ) if playerTeam then local name = getTeamName ( playerTeam ) if name == "Owner" or name == "Admin" then local px, py, pz = getElementPosition ( player ) createPickup ( px, py, pz, 3, 370, 30000 ) end end end ) Because arguments need number( not string ). And you not add player to arguments command handler function. See on wiki.
  13. Updated again. See my post.
  14. Kenix

    Shoting Bots

    https://community.multitheftauto.com/index.php?p= ... ils&id=672
  15. Not understand you. You need just check if player download? And ping < limit LOL.
  16. http://buffa.ru/#/music/Steel_Deluxe/Sosamba/A_I/
  17. Server local PingTable = { } local default_time = 10000 addEventHandler( 'onPlayerJoin', root, function( ) PingTable [ source ] = setTimer( function( player ) if getPlayerPing( player ) > tonumber( get( 'MaxPing' ) ) then kickPlayer( player, "High Ping" ) else outputConsole( '*'..getPlayerName( player ).. ' Has passed the ping check' ) end end, tonumber( get( "Delay" ) or default_time ), 0 , source ) end ) addEventHandler( 'onPlayerQuit', root, function( ) if isTimer( PingTable [ source ] ) then killTimer( PingTable [ source ] ) end PingTable [ source ] = nil end )
  18. Сервер createTeam ( "Medic", 200, 0, 100 ) addEventHandler( 'onPlayerDamage',root, function( attacker, weapon, bodypart, loss ) local health = getElementHealth( source ) if isElement( attacker ) and attacker ~= source and weapon == 41 and health < 100 then local team = getPlayerTeam( attacker ) if team then if getTeamName( team ) == 'Medic' then local money = getPlayerMoney( source ) if money >= 10 then givePlayerMoney( attacker,10 ) takePlayerMoney( source,10 ) setElementHealth( source,getElementHealth( source ) + 10 ) end end end end end ) Клиент addEventHandler( 'onClientPlayerDamage',localPlayer, function( attacker, weapon, bodypart, loss ) local health = getElementHealth( source ) if isElement( attacker ) and attacker ~= source and weapon == 41 and health < 100 then local team = getPlayerTeam( attacker ) if team then if getTeamName( team ) == 'Medic' then if getPlayerMoney( ) >= 10 then cancelEvent( ) end end end end end )
  19. Lol i tested it now. Idk why it not working for you. You use this script in server side?
  20. Working local policeSkins = { [280] = true, [281] = true, [282] = true, [283] = true, [284] = true, [285] = true, [286] = true } local theMarker = createMarker ( 1545.400, -1627.600, 13.400, "cylinder", 6, 255, 255, 255, 255 ) local gate = createObject ( 968, 1544.6999511719, -1631, 13.199999809265, 0, 270, 270 ) local state = { } local function gateState( hitElement,dim ) local el if getElementType( hitElement ) == 'player' then el = hitElement elseif getElementType( hitElement ) == 'vehicle' then el = getVehicleController( hitElement ) end if policeSkins[ getElementModel ( el ) ] then state[ el ] = not state[ el ] if state[ el ] then moveObject ( gate, 1500, 1544.6999511719, -1631, 23.199999809265 ) else moveObject ( gate, 1500, 1544.700, -1630.800, 13.300 ) end end end addEventHandler( "onMarkerHit", theMarker, gateState ) addEventHandler( 'onPlayerQuit',root, function( ) state[ source ] = nil end ) Just need interchange But you only hit marker and done ( you not re hit again ) ..
×
×
  • Create New...