AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Solved Vector distance and TE_SetupBeamRingPoint (https://forums.alliedmods.net/showthread.php?t=317380)

KoreanPeople 07-10-2019 06:00

Vector distance and TE_SetupBeamRingPoint
 
this code is used skill client rayfilterpos radius 300.0 healing survivor

Code:

public Action NanoHealMachineTimer(Handle timer, any client) {
        static float checkDuration = 0.0;
        decl Float:pos[3];
       
        if(GetClientTeam(client) == TEAM_SURVIVOR && !IsFakeClient(client) && IsPlayerAlive(client)) {
                if(checkDuration < 10.0) {
                        for(new i = 1; i <= MaxClients; i++) {
                                if(GetClientTeam(i) == TEAM_SURVIVOR && !IsFakeClient(i) && IsPlayerAlive(i) && IsClientInGame(i)) {
                                        GetClientEyePosition(i, pos);
                                        if(GetVectorDistance(pos, trsPos[client]) < 300.0) {
                                                if(GetEntProp(i, Prop_Data, "m_iHealth") < GetEntProp(i, Prop_Data, "m_iMaxHealth")) {
                                                        SetEntProp(i, Prop_Data, "m_iHealth", GetEntProp(i, Prop_Data, "m_iHealth") + 1);
                                                } else {
                                                        SetEntProp(i, Prop_Data, "m_iHealth", GetEntProp(i, Prop_Data, "m_iMaxHealth"));
                                                }
                                        }
                                }
                        }
                        checkDuration += 1.0;
                        PrintToChat(client, "if & if %d", checkDuration);
                }
                else {
                        PrintToChat(client, "\x04Nano machine duration end");
                        checkDuration = 0.0;
                        return Plugin_Stop;
                }
                PrintToChat(client, "LAST %d", checkDuration);
        }
        return Plugin_Continue;
}

and this code create entity ring effect
but, ring radius and heal radius = not equal..

Code:

public Action MedicNanoHealMachineLingEffect1(Handle timer, any client) {
        decl Outlinecolor[4];
        Outlinecolor[0] = 0;
        Outlinecolor[1] = 255;
        Outlinecolor[2] = 0;
        Outlinecolor[3] = 255;
        decl CenterColor[4];
        CenterColor[0] = 0;
        CenterColor[1] = 255;
        CenterColor[2] = 0;
        CenterColor[3] = 255;
       
        float CenterLing[3];
        CenterLing[0] = trsPos[client][0];
        CenterLing[1] = trsPos[client][1];
        CenterLing[2] = trsPos[client][2];
        CenterLing[2] += 100;
        float OutlineLing[3];
        OutlineLing[0] = trsPos[client][0];
        OutlineLing[1] = trsPos[client][1];
        OutlineLing[2] = trsPos[client][2];
        OutlineLing[2] += 30;
       
        // Outline
        TE_SetupBeamRingPoint(OutlineLing, 299.0, 300.0, g_BeamSprite, g_HaloSprite, 0, 10, 10.0, 4.0, 0.0, Outlinecolor, 5, 0);
        TE_SendToAll();
        // Center
        TE_SetupBeamRingPoint(CenterLing, 10.0, 60.0, g_BeamSprite, g_HaloSprite, 0, 10, 10.0, 8.0, 3.0, CenterColor, 5, 0);
        TE_SendToAll();
       
        return Plugin_Continue;
}

public Action MedicNanoHealMachineLingEffect2(Handle timer, any client) {
        static int checkDuration = 0;
        decl InnerColor[4];
        InnerColor[0] = 255;
        InnerColor[1] = 255;
        InnerColor[2] = 0;
        InnerColor[3] = 255;
       
        float InnerlineLing[3];
        InnerlineLing[0] = trsPos[client][0];
        InnerlineLing[1] = trsPos[client][1];
        InnerlineLing[2] = trsPos[client][2];
        InnerlineLing[2] += 30;
       
        if(checkDuration < 10.0) {
                TE_SetupBeamRingPoint(InnerlineLing, 60.0, 300.0, g_BeamSprite, g_HaloSprite, 0, 10, 1.0, 2.0, 0.0, InnerColor, 10, 0);
                TE_SendToAll();
                checkDuration += 1;
        } else {
                checkDuration = 0;
                return Plugin_Stop;
        }
        return Plugin_Continue;
}

pls solved...


All times are GMT -4. The time now is 06:56.

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