AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   (CS) Drawing Spray (https://forums.alliedmods.net/showthread.php?t=232459)

Phant 12-30-2013 17:21

(CS) Drawing Spray
 
I have this screenshot:
http://firepic.org/thumbs/2013-12/31/p8hxad9e5f6s.png

And use this code for collect bullet hits coordinates (X/Y):
PHP Code:

public fw_TraceAttack(victimattackerFloat:damageFloat:direction[3], trdamage_type)
{
    new 
Float:endPos[3];
    
get_tr2(trTR_vecEndPosendPos);
    
client_print(0print_console"%f %f"endPos[1], endPos[2]);


After I add dots on screenshot by this coordinates:
http://firepic.org/thumbs/2013-12/31/pd8f30p361wl.png

It's okay, but I want add dot of crosshair (actually pev_v_angles look at 0 0 coordinates, but I want draw pev_punchangle). I change code on this:
PHP Code:

public fw_TraceAttack(victimattackerFloat:damageFloat:direction[3], trdamage_type)
{
    new 
Float:rvec[3];
    
pev(attackerpev_punchanglervec);
    
client_print(0print_console"%f %f"rvec[0], rvec[1]);


Collect coordinates, and got:
http://firepic.org/thumbs/2013-12/31/xz8k9ng08o9w.png
Why punch coordinates so small?

If I multiply coordinates on 12, this seems better:
http://firepic.org/thumbs/2013-12/31/48wi75xmwnod.png
But why 12? How I can calculate correct multiply value for punch?

ConnorMcLeod 12-31-2013 01:36

Re: (CS) Drawing Spray
 
Because you take in account distance to wall ?

Look at fm_get_aim_origin and just add punchangle to v_angle and see if you got same results.


Following stock is fm_get_user_origin with less native calls, but using trace_line make it automatically use IGNORE_MONSTER if you pass an index (DONT_IGNORE_MONSTER when you pass -1 as index), so if you want to pass index + DONT_IGNORE_MONSTER you need to use engfunc(), but i don't think you care about players in what you are doing.

PHP Code:

get_aim_origin(idFloat:origin[3])
{
    new 
Float:dest[3];

    
entity_get_vector(idEV_VEC_v_angleorigin);
    
entity_get_vector(idEV_VEC_punchangledest);
    
xs_vec_add(origindestdest);

    
angle_vector(destANGLEVECTOR_FORWARDdest);
    
xs_vec_mul_scalar(dest9999.0dest); // you may adjust this according to weapon, as cs does
    
xs_vec_add(origindestdest);

    
entity_get_vector(idEV_VEC_originorigin);
    
origin[2] += entity_get_int(idEV_INT_flags) & FL_DUCKING 12.0 18.0;

    
trace_line(idorigindestorigin);



Phant 12-31-2013 05:10

Re: (CS) Drawing Spray
 
Quote:

Originally Posted by ConnorMcLeod (Post 2078847)
Because you take in account distance to wall ?

Distance from player to wall — 320 units (resolution 640x480, 640/2 = 320).

Thanks for stock. I use it (hope correct):
PHP Code:

public fw_TraceAttack(victimattackerFloat:damageFloat:direction[3], trdamage_type)
{
    new 
Float:rvec[3];
    
pev(attackerpev_v_anglervec);
    
get_aim_origin(attackerrvec);
    
client_print(0print_console"%f %f"rvec[1], rvec[2]);


And first shot got:
PHP Code:

5.581364 0.999273 

Strange why not 0 0, but with this code I got:
http://5.firepic.org/5/images/2013-1...nk1dkfkewk.png
Think is not bad result.

ConnorMcLeod 12-31-2013 10:46

Re: (CS) Drawing Spray
 
get_aim_origin returns the origin where player is aiming at, i don't understand why you think it y and z axes would return 0, and why you don't print x origin, and also why you have let line "pev(attacker, pev_v_angle, rvec);"

May be you are confused with punchangle that is not the same thing, punchangle should be 0 on 1st shot, and punchangle is relative to player, not to world.


All times are GMT -4. The time now is 10:07.

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