Raised This Month: $ Target: $400
 0% 

Backblast effect


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jballou
Member
Join Date: Jul 2013
Old 01-20-2015 , 03:41   Backblast effect
Reply With Quote #1

Hi everyone,
I am trying to create a backblast effect for rocket launchers. I'm having great difficulty getting the angles and calculations right. At this time, I'm just debug printing the values to the console to try to figure out how to do it. Basically what I want to do is get all players in a 90 degree cone behind the player who fires the rocket, and do some damage and effects based on distance. I'll post my code below, feel free to hack and redo anything to get it working. Any help is appreciated, this is driving me nuts. Thanks!
Code:
public DoBackblast(client)
{
        new Float:senderOrigin[3];
        GetClientEyePosition(client, senderOrigin);

        new Float:targetOrigin[3];
        new Float:distance;
        new Float:dist;
        new Float:vecPoints[3];
        new Float:vecAngles[3];
        new Float:senderAngles[3];
        new String:name[32];

        GetClientAbsAngles(client, senderAngles);
        for(new target=0;target<= GetMaxEntities() ;target++)
        {
                if(!IsValidEntity(target))
                {
                        continue;
                }
                if(GetEdictClassname(target, name, sizeof(name)))
                {
                        if (StrContains(name,"player") > -1)
                        {
                                if (!IsFakeClient(target))
                                {

                                GetClientAbsOrigin(target, targetOrigin);
                                distance = GetVectorDistance(targetOrigin, senderOrigin);
                                dist = distance * 0.01905;
                                MakeVectorFromPoints(senderOrigin, targetOrigin, vecPoints);
                                GetVectorAngles(vecPoints, vecAngles);
                                new Float:diff = senderAngles[1] - vecAngles[1];
                                if (diff < -180)
                                {
                                        diff = 360 + diff;
                                }
                                if (diff > 180)
                                {
                                        diff = 360 - diff;
                                }
                                PrintToServer("[BACKBLAST] Player %N backblast found %N distance %f dist %f direction %f",client,target,distance,dist,diff);
                                if (diff >= 112.5 || diff < -112.5)
                                {
                                        PrintToServer("[BACKBLAST] whoa this should be good");
                                }
                                }
                        }
                }
        }
}
jballou 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 10:53.


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