Forum

> > CS2D > Scripts > Bug on my script
Forums overviewCS2D overview Scripts overviewLog in to reply

English Bug on my script

5 replies
To the start Previous 1 Next To the start

old Bug on my script

loadkinger
User Off Offline

Quote
Hello,

My ESP script have bugs when two player enable the ESP script, when enabled, only for one player works
No have errors in my console

Who can help me?

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
addhook ("join","_join");
addhook ("say","_say");
addhook ("always","_always");

USGN_allow = {xxxxx}

function Masterarray(m,v)
	local buff = {}
		for i=1,m or 1 do
			buff[i] = v or 0
		end
	return buff
end

_aim = Masterarray(32)
_img = Masterarray(32,{})
_img2 = Masterarray(32,{})

for i = 1,32 do
	_img[i][i] = nil
	_img2[i][i] = nil
end


function SCRIPT_check(id)
id=tonumber(id)
i=tonumber(i)
for i=1,32 do
if _img[id][i]~=nil then
	if player(i,"health") == 0 or player(id,"health") == 0 then
	freeimage(_img2[id][i])
	_img2[id][i] = nil
	freeimage(_img[id][i])
	_img[id][i] = nil
	end
end
if _img[id][i]==nil then
	if player(i,"exists") and player(id,"exists") and player(i,"health") > 0 and player(id,"health") > 0 and player(i,"team") ~= player(id,"team") then
	_img[id][i] = image("gfx/sprites/line.bmp",player(id,"x"),player(id,"y"),3,id)
	_img2[id][i] = image("gfx/sprites/line2.bmp",1,1,132+i,id)
	end
end
if _img[id][i]~=nil then
	if not player(i,"exists") or not player(id,"exists") then
		freeimage(_img[id][i])
		_img[id][i] = nil
		end
	end
end
id = tonumber(id)
for i=1,32 do
if _img[id][i]~=nil then
	if player(i,"exists") and _aim[id] == true then
	local rot = (math.deg(math.atan2(player(i,"y")-player(id,"y"),player(i,"x")-player(id,"x")))+90)
		if rot>180 then rot = rot - 360 end
			local linex = player(id,"x") + (math.sin(math.rad(rot))*((math.sqrt((player(i,"x")-player(id,"x"))^2 + (player(i,"y") - player(id,"y"))^2))/2))
			local liney = player(id,"y") - (math.cos(math.rad(rot))*((math.sqrt((player(i,"x")-player(id,"x"))^2 + (player(i,"y") - player(id,"y"))^2))/2))
			imagepos (_img[id][i],linex,liney,rot)
			imagescale (_img[id][i],1,((math.sqrt((player(i,"x")-player(id,"x"))^2 + (player(i,"y") - player(id,"y"))^2))))
			local hp = player(i,"health")
			if (hp>90) then
				imagecolor(_img[id][i],0,255,0)
				imagecolor(_img2[id][i],0,255,0)
			elseif (hp>60) and (hp<91) then
				imagecolor(_img[id][i],255,255,0)
				imagecolor(_img2[id][i],255,255,0)
			elseif (hp>30) and (hp<61) then
				imagecolor(_img[id][i],255,128,0)
				imagecolor(_img2[id][i],255,128,0)
			elseif (hp>0) and (hp<31) then
				imagecolor(_img[id][i],255,0,0)		
				imagecolor(_img2[id][i],255,0,0)		
				end
			end
		end
	end
end

function SCRIPT_setimage(id)
id=tonumber(id)
for i=1,32 do
	if player(id,"exists") and player(i,"exists") and player(i,"health") > 0 and player(i,"team") ~= player(id,"team") then
		SCRIPT_restart(id)
		_aim[id] = true
		_img[id][i] = image("gfx/sprites/line.bmp",player(id,"x"),player(id,"y"),3,id)
		_img2[id][i] = image("gfx/sprites/line2.bmp",1,1,132+i,id)
		end 
	end
end

function _join(p)
_aim[p] = false
for i=1,32 do
	if _img[i][p]~=nil then
	freeimage(_img[i][p]) 
	freeimage(_img2[i][p]) 
	_img[i][p] = nil
	_img2[i][p] = nil
	end
end
for i , v in ipairs(USGN_allow) do
	if (player(p,"usgn") == v) then 
		msg2 (p,"©000255000You are allowed to use _aimlineviewer!@C")
		msg2 (p,"©000255000Say !_aimlineviewer to turn it on and say it again to turn it off!@C")
		end
	end
end


function _say(p,t)
for i , v in ipairs(USGN_allow) do
	if (player(p,"usgn") == v) then 
		if t=="!ESP" then
			if _aim[p]==false then
				_aim[p] = true
			else
				SCRIPT_restart(p)
				end
			end
		end
	end
end

function _always()
for i=1,32 do
	i=tonumber(i)
	if _aim[i] == true then
		SCRIPT_setimage(i)
		SCRIPT_check(i)
		end
	end
end

function SCRIPT_restart(id)
for i=1,32 do
	if _img[id][i]~=nil then
		freeimage(_img2[id][i])
		_img2[id][i] = nil
		freeimage(_img[id][i])
		_img[id][i] = nil
	end
end
_aim[id] = false
end
Sorry for my english, i am french

old Re: Bug on my script

AlcatrazZ
BANNED Off Offline

Quote
maybe change this:
for i = 1,32 do
	_img[i][i] = nil
	_img2[i][i] = nil
end

to
for x = 1,32 do
	for y = 1,32 do
		_img[x][y] = nil
		_img2[x][y] = nil
	end
end

old Re: Bug on my script

loadkinger
User Off Offline

Quote
user AlcatrazZ has written
maybe change this:
for i = 1,32 do
	_img[i][i] = nil
	_img2[i][i] = nil
end

to
for x = 1,32 do
	for y = 1,32 do
		_img[x][y] = nil
		_img2[x][y] = nil
	end
end


Not work

old Re: Bug on my script

r4ndxm
User Off Offline

Quote
Maybe change this
1
function SCRIPT_restart(id)
to this.
1
function SCRIPT_restart(p)

old Re: Bug on my script

loadkinger
User Off Offline

Quote
user r4ndxm has written
Maybe change this
1
function SCRIPT_restart(id)
to this.
1
function SCRIPT_restart(p)


No work

-------------------------------------------------

I Have a new idea, who fix this script to work whit tween_move?

Thanks
To the start Previous 1 Next To the start
Log in to reply Scripts overviewCS2D overviewForums overview