AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Origin & Aimvecs (https://forums.alliedmods.net/showthread.php?t=46506)

stigma 10-28-2006 05:20

Origin & Aimvecs
 
Why wont this make a laserbeam, between the two clients..?

Code:
#include <amxmodx> #include <amxmisc> #define PLUGIN "New Plugin" #define VERSION "1.0" #define AUTHOR "Author" new laser public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     register_event("Damage","do_laser","a") } public plugin_precache() {     laser = precache_model("sprites/laserbeam.spr") } public do_laser() {         new id = read_data(1)     new kid = read_data(2)     new origin[32][3]     get_user_origin(id, origin[id],1)     get_user_origin(kid, origin[kid],1)             message_begin(MSG_BROADCAST,SVC_TEMPENTITY) // I get a warning at this line saying, loose identation.     write_byte (TE_BEAMPOINTS)     write_coord(origin[id][0])     write_coord(origin[id][1])     write_coord(origin[id][2])     write_coord(origin[kid][0])     write_coord(origin[kid][1])     write_coord(origin[kid][2])     write_short(laser);     write_byte(1) // framestart     write_byte(5) // framerate     write_byte(2) // life     write_byte(5) // width     write_byte(1) // noise     write_byte(100) // r, g, b (red)     write_byte(100) // r, g, b (green)     write_byte(255) // r, g, b (blue)     write_byte(127) // brightness     write_byte(1) // speed     message_end()     }

p3tsin 10-28-2006 05:50

Re: Origin & Aimvecs
 
coz
1) Damage is not a global event
2) theres no attacker id passed

Code:
register_event("Damage","do_laser","be") ... public do_laser(id) {     new kid = get_user_attacker(id)     new orig1[3], orig2[3]     get_user_origin(id, orig1,1)     get_user_origin(kid, orig2,1)     //tempentity event.. }

.. or u were supposed to use DeathMsg but somehow messed em up :)

schnitzelmaker 10-28-2006 06:00

Re: Origin & Aimvecs
 
Quote:

2) theres no attacker id passed
Not fully right,you can get the id with
Code:
new victim = read_data(0)

p3tsin 10-28-2006 13:28

Re: Origin & Aimvecs
 
Quote:

Originally Posted by schnitzelmaker (Post 396166)
Not fully right,you can get the id with
Code:
new victim = read_data(0)

umm, what?

schnitzelmaker 10-28-2006 17:48

Re: Origin & Aimvecs
 
On some events you can read the data.
As example on the damage event are there:
Code:
new damage = read_data(2);//the damage who the player get. new victim = read_data(0);//the playerid who get the damage.
And you get the attackerid with:
Code:
new attacker = get_user_attacker(victim,weapon,hitplace);
There are some more data but i dont know all.


All times are GMT -4. The time now is 04:51.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.