| fiendshard |
10-08-2010 19:17 |
[HELP] With the user origin
Hello people, i was wondering if someone may help with this piece of code. It doesn't compile and I am not sure why. Here it is:
Code:
#include <amxmodx>
new light
public plugin_init()
{
register_plugin("Storm","1.0","fiend")
register_clcmd("say /storm", "makestorm");
}
public plugin_precache()
{
light = precache_model("sprites/lgtning.spr")
}
public makestorm(id)
{
{
new xy[2]
xy[0] = random_num(0,2200)
xy[1] = random_num(0,2200)
set_task(0.5,"lightning",1324,xy,10,"a", 60)
set_task(1.0,"lightning1",1325,xy,10,"a", 60)
set_task(1.5,"lightning2",1326,xy,10,"a", 60)
set_task(2.0,"lightning3",1327,xy,10,"a", 60)
set_task(2.5,"lightning4",1328,xy,10,"a", 60)
set_task(3.0,"lightning5",1329,xy,10,"a", 60)
}
return PLUGIN_HANDLED
}
public lightning(xy[])
{
xy[0] = random_num(-2000,2200)
xy[1] = random_num(-2000,2200)
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(0)
write_coord(xy[0])
write_coord(xy[1])
write_coord(4000)
write_coord(xy[0])
write_coord(xy[1])
write_coord(-2000)
write_short(light)
write_byte(1) // framestart
write_byte(5) // framerate
write_byte(2) // life
write_byte(200) // width
write_byte(10) // noise
write_byte(0) // r, g, b
write_byte(255) // r, g, b
write_byte(0) // r, g, b
write_byte(200) // brightness
write_byte(200) //
message_end()
}
public lightning1(xy[])
{
xy[0] = random_num(-2000,2200)
xy[1] = random_num(-2000,2200)
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(0)
write_coord(xy[0])
write_coord(xy[1])
write_coord(4000)
write_coord(xy[0])
write_coord(xy[1])
write_coord(-2000)
write_short(light)
write_byte(1) // framestart
write_byte(5) // framerate
write_byte(2) // life
write_byte(200) // width
write_byte(10) // noise
write_byte(0) // r, g, b
write_byte(255) // r, g, b
write_byte(0) // r, g, b
write_byte(200) // brightness
write_byte(200) //
message_end()
}
public lightning2(xy[])
{
xy[0] = random_num(-2000,2200)
xy[1] = random_num(-2000,2200)
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(0)
write_coord(xy[0])
write_coord(xy[1])
write_coord(4000)
write_coord(xy[0])
write_coord(xy[1])
write_coord(-2000)
write_short(light)
write_byte(1) // framestart
write_byte(5) // framerate
write_byte(2) // life
write_byte(200) // width
write_byte(10) // noise
write_byte(0) // r, g, b
write_byte(255) // r, g, b
write_byte(0) // r, g, b
write_byte(200) // brightness
write_byte(200) //
message_end()
}
public lightning3(xy[])
{
xy[0] = random_num(-2000,2200)
xy[1] = random_num(-2000,2200)
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(0)
write_coord(xy[0])
write_coord(xy[1])
write_coord(4000)
write_coord(xy[0])
write_coord(xy[1])
write_coord(-2000)
write_short(light)
write_byte(1) // framestart
write_byte(5) // framerate
write_byte(2) // life
write_byte(200) // width
write_byte(10) // noise
write_byte(0) // r, g, b
write_byte(255) // r, g, b
write_byte(0) // r, g, b
write_byte(200) // brightness
write_byte(200) //
message_end()
}
public lightning4(xy[])
{
xy[0] = random_num(-2000,2200)
xy[1] = random_num(-2000,2200)
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(0)
write_coord(xy[0])
write_coord(xy[1])
write_coord(4000)
write_coord(xy[0])
write_coord(xy[1])
write_coord(-2000)
write_short(light)
write_byte(1) // framestart
write_byte(5) // framerate
write_byte(2) // life
write_byte(200) // width
write_byte(10) // noise
write_byte(0) // r, g, b
write_byte(255) // r, g, b
write_byte(0) // r, g, b
write_byte(200) // brightness
write_byte(200) //
message_end()
}
public lightning5(xy[], id)
{
xy[0] = random_num(-2000,2200)
xy[1] = random_num(-2000,2200)
message_begin(MSG_BROADCAST,SVC_TEMPENTITY)
write_byte(0)
write_coord(xy[0])
write_coord(xy[1])
write_coord(4000)
write_coord(xy[0])
write_coord(xy[1])
write_coord(-2000)
write_short(light)
write_byte(1) // framestart
write_byte(5) // framerate
write_byte(2) // life
write_byte(200) // width
write_byte(10) // noise
write_byte(0) // r, g, b
write_byte(255) // r, g, b
write_byte(0) // r, g, b
write_byte(200) // brightness
write_byte(200) //
message_end()
if(get_user_origin(id) == (xy[1]))
user_kill(id)
if(get_user_origin(id) == (xy[0]))
user_kill(id)
}
Problem is with last two chunks of code.
Also would like to ask if it is possible to get user origin when origin is randomized?
Other than this, how can i make action when sprite used in this code collide with player? That would solve the problem.
Thank you
|