--Нам понадобится samp lua для работы чатом диалогами local events req

  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
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
--Нам понадобится samp.lua для работы с чатом и диалогами
local events = require 'lib.samp.events'
local act = false --Состояние бота(вкл/выкл)
local run = 0 --[[
0 = состояние выключенного скрипта
1 = бег к устройству
2 = бег к столу с деталями
3 = бег к столу сборки
4 = бег к сдаче готовой детали]]
function main()
sampRegisterChatCommand('pobejali',activation)
while true do
wait(100)
if run == 1 then
run = 0
runTo2(2568.2, -1281.5, 1044,0.3, -255, false)
end
if run == 2 then
run = 0
runTo2(2559.5, -1289.5, 1044,0.5,-255, false)
runTo2(2558.99, -1287.22, 1044,0.5,-255, false)
end
if run == 3 then
run = 0
runTo2(2556.71, -1291, 1044,0.5,-255, false)
end
if run == 4 then
run = 0
runTo2(2564.7, -1292.9, 1044,0.5,-255, false)
end
end
wait(-1)
end
function activation()
if act == false then act = true printString('Bot ~g~On',1000) run = 1
elseif act == true then act = false printString('Bot ~g~Off',1000) run = 0 end
end
function events.onShowDialog(did,style,title,btn1,btn2,text)
if did == 41 and act then
sampSendDialogResponse(did,1,-1,'')
return false
end
end
function events.onServerMessage(clr, msg)
if string.find(msg,'Поздравляем.') and string.find(msg,'чтобы взять детали.') then
run = 2
end
---------------------
if string.find(msg,'Вы взяли детали.') then
run = 3
end
if string.find(msg,'Вы собрали запчасть.') then
run = 4
end
---------------------
if string.find(msg,'Запчасть сдана на склад.') then
run = 2
end
if string.find(msg,'Вы сделали бракованную запчасть') then
run = 2
end
if string.find(msg,'На этом столе нет деталей.') then
run = 2
end
if string.find(msg,'Вы уронили запчасть') then
run = 2
end
end
function runTo(x, y, z, radius, isRun)
while true do
local posX, posY, posZ = getCharCoordinates(playerPed)
SetAngle(x, y, z)
wait(0)
local dist = getDistanceBetweenCoords3d(x, y, z, posX, posY, z)
MovePlayer(-255, isRun, dist)
if dist < radius then
return
end
end
end
function MovePlayer(move_code, isRun, dis)
setGameKeyState(1, move_code)
if isSprint then
setGameKeyState(16, 255)
end
end
function SetAngle(x, y, z)
local posX, posY, posZ = getCharCoordinates(playerPed)
local pX = x - posX
local pY = y - posY
local zAngle = getHeadingFromVector2d(pX, pY)
if isCharInAnyCar(playerPed) then
local car = storeCarCharIsInNoSave(playerPed)
setCarHeading(car, zAngle)
else
setCharHeading(playerPed, zAngle)
end
restoreCameraJumpcut()
end
function runTo2(x, y, z, radius, isSprint) --новый бег
while true do
wait(0)
if act then
local posX, posY, posZ = getCharCoordinates(playerPed)
--angle
local pX = x - posX
local pY = y - posY
local zAngle = getHeadingFromVector2d(pX, pY)
local ang = getCharHeading(playerPed)
local zz = math.abs(zAngle) - math.abs(ang)
local wp = fix(representIntAsFloat(readMemory(0xB6F248, 4, false)))
local gg = fix(representIntAsFloat(readMemory(0xB6F258, 4, false)))
gg = math.abs(gg)
local betaRun = math.abs(gg-GetAngleBeetweenTwoPoints(x,y))
if wp < 1.0 and wp < -1.0 then wp = 0 end
setCameraPositionUnfixed(wp-0.001, GetAngleBeetweenTwoPoints(x,y))
local dist = getDistanceBetweenCoords3d(x, y, z, posX, posY, z)
setGameKeyState(1, -255)
if isSprint then
setGameKeyState(16, 255)
end
if dist < radius then
return
end
end
end
end
function events.onSendAimSync(d)--спизженный фикс
if isActive then
local x = math.random(10, 150)
local y = math.random(10, 150)
local z = math.random(10, 150)
local oldX = d.camFront.x
local oldY = d.camFront.y
local oldZ = d.camFront.z
d.camFront.x = x / 100
d.camFront.y = y / 100
d.camFront.z = z / 100
end
end
function fix(angle) --еще один фикс
while angle > math.pi do
angle = angle - (math.pi*2)
end
while angle < -math.pi do
angle = angle + (math.pi*2)
end
return angle
end
function GetAngleBeetweenTwoPoints(x2,y2) -- нужно зачемта
local x1, y1, z1 = getCharCoordinates(playerPed)
local plus = 0.0
local mode = 1
if x1 < x2 and y1 > y2 then plus = math.pi/2; mode = 2; end
if x1 < x2 and y1 < y2 then plus = math.pi; end
if x1 > x2 and y1 < y2 then plus = math.pi*1.5; mode = 2; end
local lx = x2 - x1
local ly = y2 - y1
lx = math.abs(lx)
ly = math.abs(ly)
if mode == 1 then ly = ly/lx;
else ly = lx/ly; end
ly = math.atan(ly)
ly = ly + plus
return ly
end