Raised This Month: $ Target: $400
 0% 

(Solved) GetClientAbsAngles problem


Post New Thread Reply   
 
Thread Tools Display Modes
runonce
Junior Member
Join Date: Jan 2010
Old 01-30-2010 , 16:24   Re: (Solved) GetClientAbsAngles problem
Reply With Quote #11

Let's say you want to active it with right-click instead of a console command. Any tips for that?

Thanks!
runonce is offline
=MaTi=
Member
Join Date: Jan 2008
Old 01-30-2010 , 19:43   Re: (Solved) GetClientAbsAngles problem
Reply With Quote #12

This should work, as long as you have the alternative fire bound to mouse2 button, which is like that by default:

PHP Code:
public Action:OnPlayerRunCmd(client, &buttons, &impulseFloat:vel[3], Float:angles[3], &weapon)
{
    if(
buttons IN_ATTACK2)
    {
        
//spawn your stuff
    
}
    return 
Plugin_Continue;

EDIT:
I made a mistake in calculating the Z position on the previous page. It's corrected now. Sorry!

Last edited by =MaTi=; 01-30-2010 at 20:50.
=MaTi= is offline
runonce
Junior Member
Join Date: Jan 2010
Old 01-31-2010 , 20:00   Re: (Solved) GetClientAbsAngles problem
Reply With Quote #13

Thank you, that worked well! But for some reason is spawning multiple barrels at once. I'll try to figure out why that later.

Code:
public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
{
    if(buttons & IN_ATTACK2)
    {
	    new Float:location[3];
	    GetClientEyePosition(client, location);
	    new Float:ang[3];
	    GetClientEyeAngles(client, ang);
	    new Float:location2[3];
	    location2[0] = (location[0]+(100*((Cosine(DegToRad(ang[1]))) * (Cosine(DegToRad(ang[0]))))));
	    location2[1] = (location[1]+(100*((Sine(DegToRad(ang[1]))) * (Cosine(DegToRad(ang[0]))))));
	    ang[0] -= (2*ang[0]);
	    location2[2] = (location[2]+(100*(Sine(DegToRad(ang[0])))));
	    PrintToChat(client,"Location1: %f, %f, %f", location[0], location[1], location[2]);
	    PrintToChat(client,"Location2: %f, %f, %f", location2[0], location2[1], location2[2]);
	    PrintToChat(client,"Angles: %f, %f, %f", ang[0], ang[1], ang[2]); 
	    new EntitySpawnIndex = CreateEntityByName("prop_physics");
	    SetEntityModel(EntitySpawnIndex,"models/props_c17/oildrum001_explosive.mdl");
	    DispatchSpawn(EntitySpawnIndex);
	    SetEntityMoveType(EntitySpawnIndex, MOVETYPE_VPHYSICS);
	    SetEntProp(EntitySpawnIndex, Prop_Data, "m_CollisionGroup", 5);
	    SetEntProp(EntitySpawnIndex, Prop_Data, "m_nSolidType", 6);
	    TeleportEntity(EntitySpawnIndex, location2, NULL_VECTOR, NULL_VECTOR);
    }
    return Plugin_Continue;
}

Last edited by runonce; 01-31-2010 at 20:08.
runonce is offline
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:55.


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