-
Posts
4,121 -
Joined
-
Last visited
-
Days Won
2
Everything posted by Kenix
-
Изменил оформление и теперь всё по группам.
-
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 ).
-
Offtopic: See functions/classes viewtopic.php?f=141&t=33091
-
Добавил ещё одну очень полезную функцию.
-
I not understand you.
-
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.
-
https://wiki.multitheftauto.com/wiki/RU/ ... awnmanager https://wiki.multitheftauto.com/index.ph ... Mapmanager
-
You need create if map started spawn all players in spawnpoints ( random spawnpoints )?
-
Server addCommandHandler( 'health', function( player ) outputChatBox( 'Your health is '..tostring( math.floor( getElementHealth( player ) ) )..'!',player,0,255,0 ) end )
-
setWeaponProperty is server side function. https://wiki.multitheftauto.com/wiki/Scr ... troduction
-
Можно ли в модулях сделать клиентский функционал? Например, чтобы сделать несколько клиентских функций , а не серверных. Просто очень хочется реализовать полезные функции , которые не надо будет вызывать.( exports,call ... ) Ну и ещё пару идей есть по этому поводу.
-
2 bullets in clip you mean? https://wiki.multitheftauto.com/wiki/SetWeaponProperty
-
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.
-
Updated again. See my post.
-
https://community.multitheftauto.com/index.php?p= ... ils&id=672
-
Not understand you. You need just check if player download? And ping < limit LOL.
-
http://buffa.ru/#/music/Steel_Deluxe/Sosamba/A_I/
-
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 )
-
Сервер 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 )
-
Покажи лог. Мы не телепаты.
-
Lol i tested it now. Idk why it not working for you. You use this script in server side?
-
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 ) ..