Raised This Month: $ Target: $400
 0% 

User aiming?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
[X]-RayCat
Senior Member
Join Date: Sep 2006
Old 09-02-2008 , 13:10   User aiming?
Reply With Quote #1

Im trying to make plugin which creates ".mdl" (in example) in the location where you're aiming at.

Any explanation how to do this or maybe code?
[X]-RayCat is offline
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 09-02-2008 , 13:15   Re: User aiming?
Reply With Quote #2

Use this stock:
PHP Code:
stock fm_get_aimorigin(indexFloat:origin[3])
{
    new 
Float:start[3], Float:view_ofs[3];
    
pev(indexpev_originstart);
    
pev(indexpev_view_ofsview_ofs);
    
xs_vec_add(startview_ofsstart);
    
    new 
Float:dest[3];
    
pev(indexpev_v_angledest);
    
engfunc(EngFunc_MakeVectorsdest);
    
global_get(glb_v_forwarddest);
    
xs_vec_mul_scalar(dest9999.0dest);
    
xs_vec_add(startdestdest);
    
    
engfunc(EngFunc_TraceLinestartdest0index0);
    
get_tr2(0TR_vecEndPosorigin);
    
    return 
1;

And do like this:
PHP Code:
if((engfunc(EngFunc_PointContentsfAimOrigin) != CONTENTS_SKY) && (engfunc(EngFunc_PointContentsfAimOrigin) != CONTENTS_SOLID))
    {
        static 
iEnt;
        
iEnt engfunc(EngFunc_CreateNamedEntityengfunc(EngFunc_AllocString"info_target"));
        
        if(!
iEnt)
            return 
0;
        
        
engfunc(EngFunc_SetOriginiEntfAimOrigin);
        
        static 
Float:fMaxs[3] = { 16.016.038.0 };
        static 
Float:fMins[3] = { -16.0, -16.0, -38.0 };
        
        
engfunc(EngFunc_SetModeliEnt"models/model.mdl");
        
set_pev(iEnt,pev_classname"classname");
        
        
dllfunc(DLLFunc_SpawniEnt);
        
set_pev(iEntpev_solidSOLID_BBOX);
        
engfunc(EngFunc_SetSizeiEntfMinsfMaxs);
        
    } 
__________________

anakin_cstrike is offline
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 09-02-2008 , 13:35   Re: User aiming?
Reply With Quote #3

Isn't this a lot better to use??
PHP Code:
get_user_origin(idorigin3); 
Quote:
Originally Posted By Funcwiki

If mode is passed, the origin changes:
0 - current position (Default)
1 - Position from eyes (weapon aiming)
2 - End position from player position
3 - End position from eyes (hit point for weapon)
4 - Position from last bullet hit (only CS)
__________________

Last edited by atomen; 09-02-2008 at 14:18.
atomen is offline
Send a message via MSN to atomen
[X]-RayCat
Senior Member
Join Date: Sep 2006
Old 09-02-2008 , 13:50   Re: User aiming?
Reply With Quote #4

What if i want to add sprite to that location?

edit:
Lets say i wanna make implosion:
Code:
 message_begin(MSG_PVS, SVC_TEMPENTITY, origin);  write_byte(TE_IMPLOSION);  write_coord(origin[0]);  write_coord(origin[1]);  write_coord(origin[2]);  write_byte(64);  // radius  write_byte(100); // count  write_byte(6);  // life  message_end();

Last edited by [X]-RayCat; 09-02-2008 at 14:08.
[X]-RayCat is offline
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 09-02-2008 , 13:57   Re: User aiming?
Reply With Quote #5

pev_model works with sprites too.

For your message:
PHP Code:
new origin[3];
get_user_origin(idorigin3);

message_begin(MSG_PVSSVC_TEMPENTITYorigin);
write_byte(TE_IMPLOSION);
write_coord(origin[0]);
write_coord(origin[1]);
write_coord(origin[2]);
write_byte(64);  // radius
write_byte(100); // count
write_byte(6);  // life
message_end(); 
__________________

Last edited by atomen; 09-02-2008 at 14:25.
atomen is offline
Send a message via MSN to atomen
[X]-RayCat
Senior Member
Join Date: Sep 2006
Old 09-02-2008 , 14:19   Re: User aiming?
Reply With Quote #6

Quote:
Originally Posted by atomen View Post
pev_model works with sprites too.
PHP Code:
new origin[3];
get_user_origin(idorigin3);
 
message_begin(MSG_PVSSVC_TEMPENTITYorigin);
write_byte(TE_IMPLOSION);
write_coord(origin[0]);
write_coord(origin[1]);
write_coord(origin[2]);
write_byte(64);  // radius
write_byte(100); // count
write_byte(6);  // life
message_end(); 
I already know how to use that. >.<

I tried to set it before with fm aim origin, but it was never created.
[X]-RayCat is offline
atomen
Veteran Member
Join Date: Oct 2006
Location: Stockholm, Sweden
Old 09-02-2008 , 14:28   Re: User aiming?
Reply With Quote #7

Test this:
PHP Code:
new origin[3];
get_user_origin(idorigin3);

message_begin(MSG_PVSSVC_TEMPENTITYorigin);
write_byte(TE_IMPLOSION);
write_coord(origin[0] + random_num ( -7575 ));
write_coord(origin[1] + random_num ( -7575 ));
write_coord(origin[2] + random_num ( -2525 ));
write_byte(64);  // radius
write_byte(100); // count
write_byte(6);  // life
message_end(); 
__________________
atomen is offline
Send a message via MSN to atomen
[X]-RayCat
Senior Member
Join Date: Sep 2006
Old 09-02-2008 , 17:04   Re: User aiming?
Reply With Quote #8

Haven't got it to work... >.<
[X]-RayCat is offline
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 09-02-2008 , 18:13   Re: User aiming?
Reply With Quote #9

Try changing MSG_PVS to MSG_BROADCAST
danielkza is offline
Emp`
AMX Mod X Plugin Approver
Join Date: Aug 2005
Location: Decapod 10
Old 09-03-2008 , 03:31   Re: User aiming?
Reply With Quote #10

Quote:
Originally Posted by [X]-RayCat View Post
I tried to set it before with fm aim origin, but it was never created.
because "fm aim origin" returns a Float vector. if you were to use it, you would need to do:
Code:
message_begin(MSG_PVS, SVC_TEMPENTITY, origin);
write_byte(TE_IMPLOSION);
write_coord( floatround(origin[0]) );
write_coord( floatround(origin[1]) );
write_coord( floatround(origin[2]) );
write_byte(64);  // radius
write_byte(100); // count
write_byte(6);  // life
message_end();
Emp` is offline
Send a message via AIM to Emp` Send a message via MSN to Emp` Send a message via Yahoo to Emp` Send a message via Skype™ to Emp`
Reply



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 03:04.


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