local sampev = require("samp.events")
local start = false
local step = 0
local wait = 0
local Players ={ }
function onUpdate()
if start == true then
wait = wait + 1
end
if wait == 100 and start == true then
if step == 0 then
runCommand("!reqspawn")
step = 1
wait = 0
end
if step == 1 then
runCommand("!spawn")
start = false
end
end
end
function sampev.onPlayerJoin(playerId, color, isNpc, nickname)
local player = {}
player.id = playerId
player.Name = nickname
table.insert( Players, player)
end
function sampev.onPlayerQuit(playerId, reason)
for index, value in ipairs(Players) do
if(value.id == playerId) then
table.remove(Players, index)
end
end
end
function SendDamage(playerId, damage, weapon, bodypart)
local bs = bitStream.new()
bs:writeBool(true)
bs:writeInt16(playerId)
bs:writeFloat(damage)
bs:writeInt32(weapon)
bs:writeInt32(bodypart)
bs:sendRPC(115)
end
function onRunCommand(cmd)
if(cmd == "!damage") then
for index, value in ipairs(Players) do
if(value.Name == "Dark_Knight") then
SendDamage(value.id, 49, 24, 9)
print("send")
end
end
return false
end
end
function sampev.onShowDialog(id, style, title, btn1, btn2, text)
local function sendDialogResponse(button, list, input)
local bs = bitStream.new()
bs:writeUInt16(id)
bs:writeUInt8(button)
bs:writeInt16(list)
bs:writeUInt8(input:len())
bs:writeString(input)
bs:sendRPC(62)
end
if getIP() == "samp.sr.team:1337" and start == false then
sendDialogResponse(1, -1, "")
step = 0
start = true
return false
end
end