-
Posts
186 -
Joined
-
Last visited
-
Days Won
4
Everything posted by AngelAlpha
-
попробуй вот так local startJob = createPickup(-1819, -1615, 23.1, 3, 1275, 0) local blipJobStart = createBlip ( -1819, -1615, 23, 53, 1, 255, 0, 0, 255, 0, 1000) local skin = 0 local skinJob = 27 local jobActive = false local money = 0 local sum = 0 local score = 0 local markers = {} local blips = {} function jobTake(thePlayer) if (thePlayer) then setPedAnimation(thePlayer, 'sword', 'sword_4', -1, true) outputChatBox('копаете...', thePlayer, 255, 255, 255, false) setTimer ( function() setPedAnimation(thePlayer, false) outputChatBox('Вы скололи руду, отнесите её в ангар', thePlayer, 255, 255, 0, false) destroyElement(markers[thePlayer]) destroyElement(blips[thePlayer]) createMarkerDrop() score = math.random(56, 100) end, 5000, 1) end end addEventHandler('onMarkerHit', resourceRoot, jobTake) function jobDrop(thePlayer) if (thePlayer) then outputChatBox('бросаете...', thePlayer, 255, 255, 255, false) setPedAnimation(thePlayer, 'sword', 'sword_4', -1, true) setTimer( function() sum = sum + score setPedAnimation(thePlayer, false) outputChatBox('Идите за рудой', thePlayer, 255, 255, 0, false) outputChatBox('Ты принёс '..score..'кг. Всего: '..sum..'кг.', thePlayer, 255, 255, 0, false) destroyElement(markers[thePlayer]) destroyElement(blips[thePlayer]) createMarkerTake() end, 1000, 1) end end addEventHandler('onMarkerHit', resourceRoot, jobDrop) function createMarkerDrop(thePlayer) markers[thePlayer] = createMarker ( -1865.732, -1622.147, 20.9, 'cylinder', 2, 255, 0, 0, 255, resourceRoot) blips[thePlayer] = createBlip ( -1865.732, -1622.147, 21.904, 0, 2, 255, 0, 0, 255, 0, 1000, resourceRoot) setElementVisibleTo(markers[thePlayer], thePlayer, true) setElementVisibleTo(blips[thePlayer], thePlayer, true) end function createMarkerTake(thePlayer) markers[thePlayer] = createMarker ( -1806.709, -1649.031, 22.8, 'cylinder', 2, 255, 0, 0, 255, resourceRoot) blips[thePlayer] = createBlip ( -1806.709, -1649.031, 24.018, 0, 2, 255, 0, 0, 255, 0, 1000, resourceRoot) setElementVisibleTo(markers[thePlayer], thePlayer, true) setElementVisibleTo(blips[thePlayer], thePlayer, true) addEvent ("jobTake", true) end function createMarkerStartJob(thePlayer) if (thePlayer) then --local skin = 0 if(jobActive == false ) then outputChatBox('Вы устроились шахтёром', thePlayer, 255, 255, 0, false) createMarkerTake() skin = getElementModel(thePlayer) outputChatBox(''..skin..'', thePlayer, 255, 255, 0, false) setPlayerSkin(thePlayer, 27) jobActive = true elseif (jobActive == true) then money = sum*5 outputChatBox('Вы уволились с работы шахтёра и заработали: '..money..'$.', thePlayer, 255, 0, 100, false) destroyElement(markers[thePlayer]) destroyElement(blips[thePlayer]) -- destroyElement(blipJobDrop) -- destroyElement(blipJobTake) givePlayerMoney(thePlayer, money) setPlayerSkin(thePlayer, skin) sum=0 score=0 jobActive = false skin=0 end end end --bindKey('n', 'down', createMarkerTake) --addCommandHandler ( "start", jobTake ) --addEventHandler('onMarkerHit', markerJobStart, createMarkerStartJob) addEventHandler('onPickupHit', startJob, createMarkerStartJob)
-
local screenX, screenY = guiGetScreenSize() local px, py = screenX/1920, screenY/1080 local sizeX, sizeY = 345*px, 90*py local posX, posY = screenX - sizeX - 20*px, 10*py local prevHP = 0 local width = 130*px local speedAnim = 0.5 addEventHandler ("onClientRender", root, function() local curHP = getElementHealth(localPlayer) if prevHP ~= curHP then -- prevHP = curHP if prevHP < curHP then prevHP = math.min(curHP, prevHP + speedAnim) else prevHP = math.max(curHP, prevHP - speedAnim) end end dxDrawRectangle(posX+171*px, posY+46*py, width*(prevHP/getPedMaxHealth(localPlayer)), 6*py, tocolor(230,78,78,230)) end) function getPedMaxHealth(ped) assert(isElement(ped) and (getElementType(ped) == "ped" or getElementType(ped) == "player"), "Bad argument @ 'getPedMaxHealth' [Expected ped/player at argument 1, got " .. tostring(ped) .. "]") local stat = getPedStat(ped, 24) local maxhealth = 100 + (stat - 569) / 4.31 return math.max(1, maxhealth) end getPedMaxHealth это функция с вики. Чтобы менять скорость анимации меняй speedAnim
-
[HELP] A problem with using a value from a table.
AngelAlpha replied to DatPsychopath's topic in Scripting
like me if i help you, pls) -
[HELP] A problem with using a value from a table.
AngelAlpha replied to DatPsychopath's topic in Scripting
value[4] is array {50, 150,50}, you need value[5] -
dayz gamemode?
-
CD46 AC #4 DLL INJECTOR непонятно почему
AngelAlpha replied to snuzyxx's topic in Помощь / Отчеты об ошибках
Попробуй полностью мта и гта полностью переустановить -
попробуй эту функцию getPedSimplestTask
-
Try to set min mta version in meta
-
Maybe you not connect
-
пробовал писать разработчикам некста?
-
Ты зашел в обычную мта или на какой то из этих проектов?
-
устанавливай дождь вручную setRainLevel
-
dbConnection return nil, check data conection to mysql
-
-- Client triggerServerEvent ("WalkStyle", localPlayer, 55, true) -- Server addEvent ("WalkStyle", true) addEventHandler ("WalkStyle", root, function (style, forAll) if not forAll then setPedWalkingStyle(source, style) else for i, v in ipairs (getElementsByType("player")) do setPedWalkingStyle(v, style) end end end) если надо будет применять только для 1 игрока, true на false в тригере поменяй на клиенте
-
check dbConnect function in db. Maybe wrong data
-
cl[key] = {1, 1}
-
Правильное получение запроса из базы данных
AngelAlpha replied to DarkStalker30's topic in Скриптинг
Предположим переменной базы данных будет db и таблица в это бд будет называться admins local result = dbPoll(dbQuery(db, "SELECT * FROM admins WHERE name = ?", getPlayerName(player)), -1)[1]["is_admin"] if not result then print ("Запись не найдена") return end -
setTimer(function() for i, player in ipairs(getElementsByType("player")) do if getPlayerTeam (player) then setPlayerVoiceBroadcastTo(player, getTeamPlayers(player)) end end end, 1150, 0)
-
Ты не можешь сервер запустить?
-
Если у тебя есть CS:GO Skin Changer, то выключай его когда запускаешь мта
-
addCommandHandler ("me", function(pl, _, ...) local message = table.concat({...}, " ") if message:gsub(" ", "") == "" then outputChatBox ("#77ba50Usage:#FFFFFF /me [text]", pl, 255, 0, 0, true) return end local pos1 = Vector3 (getElementPosition(pl)) for i, v in ipairs (getElementsByType("player")) do local pos2 = Vector3 (getElementPosition(v)) if getDistanceBetweenPoints3D (pos1, pos2) <= 20 then -- 20 - this range outputChatBox ("*** "..getPlayerName(pl).." "..message, v, 255, 200, 0, true) end end end) Try this code
-
просто перенеси функцию с сервера на клиент
-
marker1 = createMarker(2094.8940429688,-838.72570800781,52.3, "corona", 1.5, 230, 251, 3, 153) function event(el) if getElementType(el) ~= "player" then return end if el ~= localPlayer then return end -- function open a window end addEventHandler("onClientMarkerHit", resourceRoot, event)
-
Video for example