Raised This Month: $ Target: $400
 0% 

Origin of an entity?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 03-01-2006 , 20:31   Origin of an entity?
Reply With Quote #1

I've been searching around and I can't seem to find it, but how can I get the origin of a non-player entity by entid?

Thanks
---
This is what I have so far:

Code:
public item_c4_detonator() {     new arg[32]     read_argv(1,arg,31)         new id = str_to_num(arg)         new entid = find_ent_by_owner(id,"info_target",id)         new Float:vector[3]     //entity_get_vector(entid,EV_VEC_origin,vector)     get_brush_entity_origin(entid,vector)         new origin[3]     format(origin,0,"%f",vector[0])     format(origin,1,"%f",vector[1])     format(origin,2,"%f",vector[2])     basic_explosion(origin)         return PLUGIN_HANDLED }
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
Des12
Senior Member
Join Date: Jan 2005
Old 03-01-2006 , 21:19  
Reply With Quote #2

Code:
new Float:origin[3]; entity_get_vector(entid, EV_VEC_origin, origin);

See if this works Remo, I do not know why you had it commented out
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 03-01-2006 , 21:43  
Reply With Quote #3

My origin cannot be a float, and it keeps giving me errors when I try to use float_to_str.

Code:
public item_c4_detonator() {     new arg[32]     read_argv(1,arg,31)         new id = str_to_num(arg)         for(new i=0;i<4;i++) {         new entid = find_ent_by_owner(id,"info_target",id)                 new Float:origin[3]         entity_get_vector(entid,EV_VEC_origin,origin)         //get_brush_entity_origin(entid,vector)             new norigin[3]         float_to_str(Float:origin,norigin,3)             basic_explosion(norigin)     }     //format(origin,0,"%f",vector[0])     //format(origin,1,"%f",vector[1])     //format(origin,2,"%f",vector[2])         return PLUGIN_HANDLED }
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
Kraugh
Senior Member
Join Date: Jan 2006
Location: barrington, ri
Old 03-01-2006 , 22:02  
Reply With Quote #4

Code:
new origin[3], Float:originF[3]; entity_get_vector(ent,EV_VEC_origin,originF); FVecIVec(originF,origin);
__________________
"You can not restrain a fool from speaking, but nothing obliges you to listen."
Kraugh is offline
Send a message via AIM to Kraugh
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 03-01-2006 , 22:13  
Reply With Quote #5

Ok, I think this is wrong....keeps returning 0.

Code:
new entid = find_ent_by_owner(id,"info_target",id)

Code:
public item_c4_detonator() {     new arg[32]     read_argv(1,arg,31)         new id = str_to_num(arg)         for(new i=0;i<4;i++) {         new entid = find_ent_by_owner(id,"info_target",id)                 //new Float:origin[3]         //entity_get_vector(entid,EV_VEC_origin,origin)         //get_brush_entity_origin(entid,vector)             //new norigin[3]         //float_to_str(origin,norigin,3)                 new origin[3], Float:originF[3];         entity_get_vector(entid,EV_VEC_origin,originF);         FVecIVec(originF,origin);               basic_explosion(origin)         client_print(id,print_chat,"[ItemMod] C4 Successfully Exploded!")     }         //format(origin,0,"%f",vector[0])     //format(origin,1,"%f",vector[1])     //format(origin,2,"%f",vector[2])         return PLUGIN_HANDLED }
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-01-2006 , 22:54  
Reply With Quote #6

No clue as to what you're trying to do.

My guess:
Code:
public item_c4_detonator() {     new arg[32]     read_argv(1,arg,31)     new id = cmd_target(0 , arg , 0);     if(!id) return PLUGIN_HANDLED;         new entid = find_ent_by_owner(-1,"info_target",id)             while(entid != 0) {         new origin[3], Float:originF[3];         entity_get_vector(entid,EV_VEC_origin,originF);         FVecIVec(originF,origin);               basic_explosion(origin)         client_print(id,print_chat,"[ItemMod] C4 Successfully Exploded!")     }     return PLUGIN_HANDLED }
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 03-01-2006 , 23:54  
Reply With Quote #7

hmm, didn't work, said the player was not found with the cmd_target.
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
Kraugh
Senior Member
Join Date: Jan 2006
Location: barrington, ri
Old 03-01-2006 , 23:55  
Reply With Quote #8

cmd_target does not function correctly with an id of 0. just use the function that it is built around:

Code:
new id = find_player("bl",arg);

[edit]
this won't fix the problem of the player not being found
__________________
"You can not restrain a fool from speaking, but nothing obliges you to listen."
Kraugh is offline
Send a message via AIM to Kraugh
mysticssjgoku4
Veteran Member
Join Date: Jan 2005
Location: Chicago Heights, IL
Old 03-02-2006 , 00:05  
Reply With Quote #9

Fixed it, I forgot to add the remove_ent.

Alright, How do I make it so that all of them are exploded at the same time. My FOR loop didn't work.

Code:
public item_c4det() {     new arg[32]     read_argv(1,arg,31)     new id = str_to_num(arg)     if(!id) {         client_print(id,print_chat,"[ItemMod] ID1: %i",id)         return PLUGIN_HANDLED     }         client_print(id,print_chat,"[ItemMod] ID2: %i",id)         for(new i = 0; i < 4; i++) {                 new entid = find_ent_by_owner(id,"item_c4",id)         //new entid2 = find_ent_by_owner(id,"item_c4",id)             client_print(id,print_chat,"[ItemMod] EntId: %i",entid)         //client_print(id,print_chat,"[ItemMod] EntId2: %i",entid2)                   while(entid != 0) {             new origin[3], Float:originF[3];               entity_get_vector(entid,EV_VEC_origin,originF);               FVecIVec(originF,origin);                     basic_explosion_c4(origin)             client_print(id,print_chat,"[ItemMod] C4 Successfully Exploded!")             remove_entity(entid)             c4limit[id] -= 1             radius_damage(originF,300,200)         }     }     return PLUGIN_HANDLED }

Also, what does each one of these lines represent, I seen another topic with a description of these, but the lines didn't match up, so I was confused.

Code:
// A Basic Explosion stock basic_explosion_c4(origin[3])     {     message_begin( MSG_BROADCAST,SVC_TEMPENTITY)     write_byte( 12 )     write_coord(origin[0]) //coord, coord, coord (start)     write_coord(origin[1])     write_coord(origin[2])     write_byte( 200 ) // byte (scale in 0.1's) 188     write_byte( 10 ) // byte (framerate)     message_end()         message_begin( MSG_BROADCAST,SVC_TEMPENTITY)     write_byte( 3 )     write_coord(origin[0]) //coord, coord, coord (start)     write_coord(origin[1])     write_coord(origin[2])     write_short( fire )     write_byte( 60 )     write_byte( 10 )     write_byte( 0 )     message_end()     return PLUGIN_HANDLED }
__________________

mysticssjgoku4 is offline
Send a message via AIM to mysticssjgoku4 Send a message via MSN to mysticssjgoku4
Des12
Senior Member
Join Date: Jan 2005
Old 03-02-2006 , 22:03  
Reply With Quote #10

I would suggest making an global variable such as

Code:
new g_c4count[33]; new g_c4store[33][5]; // . . . public item_c4det() {     new arg[32]     read_argv(1,arg,31)     new id = str_to_num(arg)     if(!id) {         client_print(id,print_chat,"[ItemMod] ID1: %i",id)         return PLUGIN_HANDLED     }         client_print(id,print_chat,"[ItemMod] ID2: %i",id)        for( new i = 0; i < g_c4count[id]; i++) {                 new entid = g_c4store[id][i];         //new entid2 = find_ent_by_owner(id,"item_c4",id)             client_print(id,print_chat,"[ItemMod] EntId: %i",entid)         //client_print(id,print_chat,"[ItemMod] EntId2: %i",entid2)                   while(entid != 0) {             new origin[3], Float:originF[3];               entity_get_vector(entid,EV_VEC_origin,originF);               FVecIVec(originF,origin);                     basic_explosion_c4(origin)             client_print(id,print_chat,"[ItemMod] C4 Successfully Exploded!")             remove_entity(entid)             c4limit[id] -= 1             radius_damage(originF,300,200)         }     }     return PLUGIN_HANDLED }
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 20:17.


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