More 

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
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
-------------------------------------------------------------------------------- -- Slenderman by ZJ -------------------------------------------------------------------------------- -- Setup Tables if zj==nil then zj={} end zj.slenderman={} zj.slenderman.gfx={} -- Load & Prepare Ressources zj.slenderman.gfx[0]=loadgfx("MyCCelf/slenderman0.png") setmidhandle(zj.slenderman.gfx[0]) zj.slenderman.gfx[1]=loadgfx("MyCCelf/slenderman1.png") setmidhandle(zj.slenderman.gfx[1]) zj.slenderman.gfx[2]=loadgfx("MyCCelf/slenderman2.png") setmidhandle(zj.slenderman.gfx[2]) zj.slenderman.gfx[3]=loadgfx("MyCCelf/slenderman3.png") setmidhandle(zj.slenderman.gfx[3]) -------------------------------------------------------------------------------- -- Object: Slenderman -------------------------------------------------------------------------------- zj.slenderman.id=addobject("zj.slenderman",zj.slenderman.gfx[0]) -- Add Object function zj.slenderman.setup(id,parameter) if objects==nil then objects={} end objects[id]={} objects[id].sy=0 objects[id].frame=0 objects[id].frametimer=10 objects[id].move=1 objects[id].ptmr={} local ptbl=playertable(0,0) for p=1,#ptbl do objects[id].ptmr[ptbl[p]]=100 end end function zj.slenderman.draw(id,x,y) -- Setup draw mode setblend(blend_alpha) setalpha(1) setcolor(255,255,255) setrotation(0) if getplayerx(playercurrent())>=x then setscale(1,1.1) elseif getplayerhealth(playercurrent())>0 then setscale(-1,1.1) else setscale(1,1.1) end if math.abs(objects[id].sy)>1.5 then drawimage(zj.slenderman.gfx[3],x,y-3) elseif (collision(colplayer,x+1,y,1,1,1,-1,id)==0 or collision(colplayer,x-1,y,1,1,1,-1,id)==0 or collision(colplayer,x+1,y-1,1,1,1,-1,id)==0 or collision(colplayer,x-1,y-1,1,1,1,-1,id)==0 or collision(colplayer,x+1,y-2,1,1,1,-1,id)==0 or collision(colplayer,x-1,y-2,1,1,1,-1,id)==0 or collision(colplayer,x+1,y-3,1,1,1,-1,id)==0 or collision(colplayer,x-1,y-3,1,1,1,-1,id)==0) and (getplayerhealth(playercurrent())>0) and (objects[id].move==1) then if math.abs(getplayerx(playercurrent())-x)>2 then drawimage(zj.slenderman.gfx[objects[id].frame],x,y-3) else drawimage(zj.slenderman.gfx[3],x,y-3) end else drawimage(zj.slenderman.gfx[0],x,y-3) end end function zj.slenderman.update(id,x,y) if objects[id].frametimer==0 then objects[id].frametimer=10 if objects[id].frame==0 then objects[id].frame=1 elseif objects[id].frame==1 then objects[id].frame=2 elseif objects[id].frame==2 then objects[id].frame=0 end elseif objects[id].frametimer>0 then objects[id].frametimer=objects[id].frametimer-1 end -- Fall objects[id].sy=objects[id].sy+getgravity() -- Move (in substep loop for optimal collision precision) msubt=math.ceil(math.abs(objects[id].sy)/15) msuby=objects[id].sy/msubt for i=1,msubt,1 do y=y+msuby -- Collision if collision(colplayer,x,y,1,1,1,-1,id)==1 then y=y-msuby objects[id].sy=-objects[id].sy*0.05 msuby=-msuby*0.05 end -- Water if y>getwatery()+5 then -- Effects particle(p_waterhit,x,y) playsound(sfx_hitwater1) -- Remove removeobject(id) break end end -- Walk if getplayerx(playercurrent())>x and getplayerhealth(playercurrent())>0 and objects[id].move==1 then if collision(colplayer,x+1,y,1,1,1,-1,id)==0 then x=x+0.3 elseif collision(colplayer,x+1,y-1,1,1,1,-1,id)==0 then x=x+0.3 y=y-1 elseif collision(colplayer,x+1,y-2,1,1,1,-1,id)==0 then x=x+0.3 y=y-2 elseif collision(colplayer,x+1,y-3,1,1,1,-1,id)==0 then x=x+0.3 y=y-3 else objects[id].sy=-3 end elseif getplayerx(playercurrent())<x and getplayerhealth(playercurrent())>0 and objects[id].move==1 then if collision(colplayer,x-1,y,1,1,1,-1,id)==0 then x=x-0.3 elseif collision(colplayer,x-1,y-1,1,1,1,-1,id)==0 then x=x-0.3 y=y-1 elseif collision(colplayer,x-1,y-2,1,1,1,-1,id)==0 then x=x-0.3 y=y-2 elseif collision(colplayer,x-1,y-3,1,1,1,-1,id)==0 then x=x-0.3 y=y-3 else objects[id].sy=-3 end end objectposition(id,x,y) -- Kill Players local players=playertable(0,0) for i=1,#players do if math.sqrt((x-getplayerx(players[i]))^2+(y-getplayery(players[i]))^2)<50 then if objects[id].ptmr[players[i]]<=0 then playerdamage(players[i],1000000) objects[id].move=1 elseif objects[id].ptmr[players[i]]>0 then objects[id].ptmr[players[i]]=objects[id].ptmr[players[i]]-1 objects[id].move=0 end end end end function zj.slenderman.damage(id,damage) end
Always says "EXCEPTION_ACCESS_VIOLATION".
I pretty sure that this part is the problem.
More 

1
2
3
4
5
6
7
8
9
10
11
12
13
2
3
4
5
6
7
8
9
10
11
12
13
-- Kill Players local players=playertable(0,0) for i=1,#players do if math.sqrt((x-getplayerx(players[i]))^2+(y-getplayery(players[i]))^2)<50 then if objects[id].ptmr[players[i]]<=0 then playerdamage(players[i],1000000) objects[id].move=1 elseif objects[id].ptmr[players[i]]>0 then objects[id].ptmr[players[i]]=objects[id].ptmr[players[i]]-1 objects[id].move=0 end end end