local hook require samp events local encoding require encoding local k

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
local hook = require 'samp.events'
local encoding = require 'encoding'
local key = require 'vkeys'
local ffi = require 'ffi'
encoding.default = 'CP1251'
u8 = encoding.UTF8
function main()
if not isSampfuncsLoaded() or not isSampLoaded() then
return
end
while not isSampAvailable() do
wait(100)
end
while true do
wait(0)
if(wasKeyPressed(key.VK_NUMPAD1)) then
lua_thread.create(function()
local id = randomPerson()
local name = sampGetPlayerNickname(id)
local place = randomLocation()
local _, lid = sampGetPlayerIdByCharHandle(PLAYER_PED)
local lname = sampGetPlayerNickname(lid)
sampAddChatMessage(string.format("%s[%d] вызывает медика (%s) (/accept medic).", name, id, place), 0x01FCFF)
math.randomseed(os.time())
local slp = math.random(1000, 3400)
wait(slp)
sampAddChatMessage("Ты принял вызов от " .. name .. ".", 0x33CCFF)
sampAddChatMessage("Медик " .. lname .. " принял вызов от " .. name .. ".", 0x01FCFF)
local slp = math.random(50000, 170000)
printStringNow(formatSeconds(slp), 1500)
wait(slp)
local hh = math.random(0, 2)
if hh == 0 then
local heal = 100
local score = sampGetPlayerScore(id)
if(score <= 15 and score > 10) then heal = 120
elseif(score > 15 and score < 20) then heal = 140
else heal = 160 end
sampAddChatMessage("Ты вылечил " .. name .. "[" .. id .. "] на " .. heal .. " процентов, стоимость лечения $1.", 0x01FCFF)
elseif hh == 1 then
sampAddChatMessage(lname .. " достал что-то из аптечки и вколол " .. name .. ".", 0xC2A2DA)
else
sampAddChatMessage("Ты вылечил " .. name .. "[" .. id .. "] на " .. heal .. " процентов, стоимость лечения $1.", 0x01FCFF)
end
end)
end
end
end
function randomPerson()
local count = sampGetPlayerCount(false)
local id = math.random( 0, count )
local color = sampGetPlayerColor(id)
local nick = sampGetPlayerNickname(id)
if color == 0xFFDC143C or nick:find("bankoz") or nick:find("lavron") then
return randomPerson()
end
return id
end
function randomLocation()
local locations = {"Santa Flora, San Fierro", "Blueberry, Red County", "The strip, Las Venturas", "Calton Heights, San Fierro", "Blackfield, Las Venturas", "Tierra Robada", "Idelewood, Los Santos", "Whitewood Estates, Las Venturas", "Come-A-Lot, Las Venturas", "Linden Station, Las Venturas", "Verdant Bluffs, Los Santos", "Red County", "Downtown, San Fierro", "The Panopticon, Red County", "El corona, Los Santos", "Verona Beach, Los Santos", "King's, San Fierro", "Flint Range, Flint County", "Temple, Los Santos", "Hunter Quarry, Las Venturas"}
return locations[math.random(1, #locations)]
end
function formatSeconds(sec)
sec = sec / 1000
local m = math.floor(sec / 60)
local s = math.floor(sec % 60)
return m .. ":" .. s
end