- 1
- 0
- Версия SA-MP
-
- 0.3.7 (R1)
script_name("Silent_Radius_Kill")
script_author("Gemini")
require "lib.moonloader"
local samputils = require 'lib.samp.events'
function main()
while not isSampAvailable() do wait(100) end
sampRegisterChatCommand("killeveryone", function()
local px, py, pz = getCharCoordinates(PLAYER_PED)
for i = 0, 1000 do
if sampIsPlayerConnected(i) then
local result, ped = sampGetCharHandleBySampPlayerId(i)
if result and ped ~= PLAYER_PED then
local x, y, z = getCharCoordinates(ped)
local dist = getDistanceBetweenCoords3d(px, py, pz, x, y, z)
-- if player is 20 metre radius
if dist <= 20 then
lua_thread.create(function()
-- sending attack (Damage) on player ID
-- 51 is attack weapon ID (Grenade/Explosion)
sendGiveDamage(i, 100.0, 51, 3)
-- visual effect
addExplosion(x, y, z, 7, 5.0, true, false, 0.1)
end)
end
end
end
end
sampAddChatMessage("{FF4500}[Silent Kill]{FFFFFF} sending packet!", -1)
end)
wait(-1)
end
-- function which sending GiveDamage RPC
function sendGiveDamage(playerId, damage, weapon, bodypart)
local bs = raknetNewBitStream()
raknetBitStreamWriteBool(bs, false) -- Give Damage (false) / Take Damage (true)
raknetBitStreamWriteInt16(bs, playerId)
raknetBitStreamWriteFloat(bs, damage)
raknetBitStreamWriteInt32(bs, weapon)
raknetBitStreamWriteInt32(bs, bodypart)
-- RPC ID 115 Is GiveDamage Samp
raknetSendRpc(115, bs)
raknetDeleteBitStream(bs)
end
script_author("Gemini")
require "lib.moonloader"
local samputils = require 'lib.samp.events'
function main()
while not isSampAvailable() do wait(100) end
sampRegisterChatCommand("killeveryone", function()
local px, py, pz = getCharCoordinates(PLAYER_PED)
for i = 0, 1000 do
if sampIsPlayerConnected(i) then
local result, ped = sampGetCharHandleBySampPlayerId(i)
if result and ped ~= PLAYER_PED then
local x, y, z = getCharCoordinates(ped)
local dist = getDistanceBetweenCoords3d(px, py, pz, x, y, z)
-- if player is 20 metre radius
if dist <= 20 then
lua_thread.create(function()
-- sending attack (Damage) on player ID
-- 51 is attack weapon ID (Grenade/Explosion)
sendGiveDamage(i, 100.0, 51, 3)
-- visual effect
addExplosion(x, y, z, 7, 5.0, true, false, 0.1)
end)
end
end
end
end
sampAddChatMessage("{FF4500}[Silent Kill]{FFFFFF} sending packet!", -1)
end)
wait(-1)
end
-- function which sending GiveDamage RPC
function sendGiveDamage(playerId, damage, weapon, bodypart)
local bs = raknetNewBitStream()
raknetBitStreamWriteBool(bs, false) -- Give Damage (false) / Take Damage (true)
raknetBitStreamWriteInt16(bs, playerId)
raknetBitStreamWriteFloat(bs, damage)
raknetBitStreamWriteInt32(bs, weapon)
raknetBitStreamWriteInt32(bs, bodypart)
-- RPC ID 115 Is GiveDamage Samp
raknetSendRpc(115, bs)
raknetDeleteBitStream(bs)
end