Script

Goori

Активный
Автор темы
108
27
Что делает данный скрипт?
 

Вложения

  • random_anim.lua
    965 байт · Просмотры: 10

Cheese

Потрачен
43
10
Скрипт когда вы умираете в игре и спавнитесь даёт рандомную анимацию, кстати пофиксил код он устаревший + неправильно написали
Сурс код:
local ev = require 'lib.samp.events'
local anims = {"KD_left","KD_right","KO_shot_face","KO_shot_stom","KO_skid_front","KO_spin_L","KO_spin_R"}
local pID;
local state = false
local thread1

function main()
  if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(100) end
    while true do
    wait(0)
  end
end

function ev.onPlayerDeath(playerId)
  isSpawned = sampIsLocalPlayerSpawned()
  if isSpawned then
    inStream, ped = sampGetCharHandleBySampPlayerId(playerId)
    if inStream then
      pID = playerId;
      state = true
      thread1 = lua_thread.create_suspended(playanim)
      thread1:run()
    end
  end
end

function playanim()
  while(state) do
    wait(100)
    inStream, ped = sampGetCharHandleBySampPlayerId(pID)
    if inStream then
      local rand = math.random(1,7)
      clearCharTasksImmediately(ped)
      setCharAnimSpeed(ped, anims[rand], 0.8)
      taskPlayAnim(ped, anims[rand], "PED", 3.0, false, false, false, false, -1)
      state = false
    end
  end
end
 

Вложения

  • random_anim.lua
    1 KB · Просмотры: 14

zakatov

Cogito ergo sum
Проверенный
1,969
718
Скрипт когда вы умираете в игре и спавнитесь даёт рандомную анимацию, кстати пофиксил код он устаревший + неправильно написали
Сурс код:
local ev = require 'lib.samp.events'
local anims = {"KD_left","KD_right","KO_shot_face","KO_shot_stom","KO_skid_front","KO_spin_L","KO_spin_R"}
local pID;
local state = false
local thread1

function main()
  if not isSampfuncsLoaded() or not isSampLoaded() then return end
    while not isSampAvailable() do wait(100) end
    while true do
    wait(0)
  end
end

function ev.onPlayerDeath(playerId)
  isSpawned = sampIsLocalPlayerSpawned()
  if isSpawned then
    inStream, ped = sampGetCharHandleBySampPlayerId(playerId)
    if inStream then
      pID = playerId;
      state = true
      thread1 = lua_thread.create_suspended(playanim)
      thread1:run()
    end
  end
end

function playanim()
  while(state) do
    wait(100)
    inStream, ped = sampGetCharHandleBySampPlayerId(pID)
    if inStream then
      local rand = math.random(1,7)
      clearCharTasksImmediately(ped)
      setCharAnimSpeed(ped, anims[rand], 0.8)
      taskPlayAnim(ped, anims[rand], "PED", 3.0, false, false, false, false, -1)
      state = false
    end
  end
end
12 февраля.. чел спросил 12го февраля..