Raised This Month: $51 Target: $400
 12% 

Kameha like goku or végéta


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
vegeta1241
AlliedModders Donor
Join Date: Apr 2017
Location: Switzerland
Old 12-09-2018 , 16:37   Kameha like goku or végéta
Reply With Quote #1

Hello, Eyal282 did this plugin for me, but we have a problem.
When player start kameha sometimes beam not appear, and when beam not appear sometimes make dommages sometimes no make dommages.

Do you have any idea how to fix this problem?

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
Helloà coder did this script for meto start kamehameha like goku or vegetaBut we have a problemsometimes sound is emitted but beam not appear and make damages sometimes when beam not appear sometimes no.

Do 
you have an idea to solve this plugin.
#include <cstrike>
#include <clientprefs>
 
new RingBeamModelRingHaloModel;
 
new 
Handle:TIMER_KAMEHAME[MAXPLAYERS+1] = INVALID_HANDLE;
new const 
String:PLUGIN_VERSION[] = "1.0";

new 
g_bNeedsFakePrecacheg_bCheckedEngine

new GlobalColor[MAXPLAYERS+1][4], String:GlobalSound[MAXPLAYERS+1][50], String:GlobalName[MAXPLAYERS+1][50]; 
public 
Plugin:myinfo =
{
    
name "Kamehame",
    
author "Eyal282",
    
description "HAAAAAAAAAAAAAAAAAA",
    
version PLUGIN_VERSION,
    
url "None."
}
 
new 
Float:NextKamehame[MAXPLAYERS+1];
new 
Float:NextKamehameSpamCheck[MAXPLAYERS+1];

public 
OnPluginStart()
{
    
HookEvent("player_spawn"Event_PlayerSpawnEventHookMode_Post);
}

public 
void round_start(Handle event, const char[] namebool dbc)   

    
CreateTimer(25.0RoundMsg); 
}

public 
Action:RoundMsg(Handle timer

    for(new 
i=1;<= MaxClients;i++)
    {
        if(!
IsClientInGame(i))
            continue;
            
        else if(!
IsPlayerAlive(i))
            continue;
            
        else if(!
IsKamehameModel(i))
            continue;
            
        
PrintCenterText(i"PRESS E + R TO UNLEASH %s !"GlobalName[i]);
    }
}                    
public 
Action:Event_PlayerSpawn(Handle:hEvent, const String:Name[], bool:dontBroadcast)
{
    new 
client GetClientOfUserId(GetEventInt(hEvent"userid"));
    
    if(
client == 0)
        return;
        
    
NextKamehame[client] = 0.0;
    
NextKamehameSpamCheck[client] = 0.0;
    if(
TIMER_KAMEHAME[client] != INVALID_HANDLE)
    {
        
CloseHandle(TIMER_KAMEHAME[client]);
        
TIMER_KAMEHAME[client] = INVALID_HANDLE;
    }
}

public 
OnClientDisconnected(client)
{
    if(
TIMER_KAMEHAME[client] != INVALID_HANDLE)
    {
        
CloseHandle(TIMER_KAMEHAME[client]);
        
TIMER_KAMEHAME[client] = INVALID_HANDLE;
    }
}
public 
Action:OnPlayerRunCmd(client, &buttons, &impulseFloat:vel[3], Float:angles[3], &weapon, &subtype, &cmdnum, &tickcount, &seedmouse[2])
{
    if(!(
buttons IN_USE))
        return 
Plugin_Continue;

    else if(!(
buttons IN_RELOAD))
        return 
Plugin_Continue;

    else if(!
IsPlayerAlive(client))
        return 
Plugin_Continue;

    else if(!
IsKamehameModel(client))
        return 
Plugin_Continue;

    else if(
TIMER_KAMEHAME[client] != INVALID_HANDLE)
        return 
Plugin_Continue;
        
    new 
Float:GamTime GetGameTime();
    if(
NextKamehame[client] > GamTime)
    {
        if(
NextKamehameSpamCheck[client] < GamTime)
        {
            
PrintToChat(client"[IDEAS] \x07 You can kamehameha in %.1f seconds"NextKamehame[client] - GamTime);
            
            
NextKamehameSpamCheck[client] = GamTime 5.0;
        }
        return 
Plugin_Continue;
    }
    
    
NextKamehame[client] = GamTime 300.0;
    
NextKamehameSpamCheck[client] = GamTime 3.0;
    
    new 
Float:Origin[3];
    
GetEntPropVector(clientProp_Data"m_vecOrigin"Origin);
    
EmitSoundToAllAny(GlobalSound[client], clientSNDCHAN_AUTO100_1.0100_Origin);
    
    
TIMER_KAMEHAME[client] = CreateTimer(3.0KamehameGetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
    
    
PrintToChatAll("[IDEAS] \x07 %N is gonna unleash %s in 3 seconds!!!"clientGlobalName[client]);
    return 
Plugin_Continue;
}

public 
OnMapStart()
{
    
RingBeamModel PrecacheModel("materials/sprites/laserbeam.vmt"true);
    
RingHaloModel PrecacheModel("materials/sprites/glow01.vmt"true);

    
PrecacheModel("models/error.mdl"true);    
    
    
PrecacheSoundAny("ideas/galickgun.mp3");
    
PrecacheSoundAny("ideas/kamehameha.mp3");
    
    for(new 
i=0;<= MAXPLAYERS;i++)
    {
        
TIMER_KAMEHAME[i] = INVALID_HANDLE;
    }
}

public 
Action:Kamehame(Handle:hTimerUserId)
{
    new 
client GetClientOfUserId(UserId);
    
    if(
client == 0)
        return 
Plugin_Continue;
    
    
TIMER_KAMEHAME[client] = INVALID_HANDLE;
    
    if(!
IsKamehameModel(client)) // Also sets global data.
        
return Plugin_Continue;
        
    new 
Float:Origin[3], Float:Angles[3], Float:EndOrigin[3], Float:CompareOrigin[3];
    
    
GetClientEyePosition(clientOrigin);
    
GetClientEyeAngles(clientAngles);
    
    
TR_TraceRayFilter(OriginAnglesMASK_SHOTRayType_InfiniteTrace_DontHitPlayers); //Start the trace 
    
    
TR_GetEndPosition(EndOrigin);
    
    new 
Handle:HitArray CreateArray(1);
    
    
PushArrayCell(HitArrayclient);
    
    new 
bool:NeverEndingLoop true;
    while(
NeverEndingLoop)
    {
        
TR_TraceHullFilter(OriginEndOriginFloat:{-30.0, -30.00.0}, Float:{30.030.00.0}, MASK_SHOTTrace_DontHitPlayersTwiceHitArray);
        
        
TR_GetEndPosition(CompareOrigin);
        
        new 
HitTarget TR_GetEntityIndex();
        
        if(
IsPlayer(HitTarget))
            
PushArrayCell(HitArrayHitTarget);

        else 
        {
            
TR_GetEndPosition(EndOrigin);
            break;
        }
    }
    new 
size GetArraySize(HitArray);
    
    for(new 
i=0;size;i++)
    {
        new 
target GetArrayCell(HitArrayi);
        
        if(
GetClientTeam(target) == GetClientTeam(client))
            
RemoveFromArray(HitArrayi);
    }
    
    
size GetArraySize(HitArray);
    new 
amountHurt size 1// Exclude caster.

    
    
new Float:BeamWidth 25.0;
    
    new 
Float:BeamLife 7.5;
    
TE_SetupBeamPoints(OriginEndOriginRingBeamModelRingHaloModel050BeamLifeBeamWidthBeamWidth-0.1120.0GlobalColor[client], 120);
    
TE_SendToAll();    

    
/*
    float fMiddle[3];
    int iEnt = CreateEntityByName("trigger_multiple");
    
    Call_StartForward(hOnZoneCreated);
    Call_PushString(sZoneName);
    Call_Finish();
    
    DispatchKeyValue(iEnt, "spawnflags", "64");
    Format(sZoneName, sizeof(sZoneName), "sm_devzone %s", sZoneName);
    DispatchKeyValue(iEnt, "targetname", sZoneName);
    DispatchKeyValue(iEnt, "wait", "0");
    
    DispatchSpawn(iEnt);
    ActivateEntity(iEnt);
    
    GetMiddleOfABox(fMins, fMaxs, fMiddle);
    
    TeleportEntity(iEnt, fMiddle, NULL_VECTOR, NULL_VECTOR);
    SetEntityModel(iEnt, sModel);
    
    
    // Have the mins always be negative
    fMins[0] = fMins[0] - fMiddle[0];
    if (fMins[0] > 0.0)
        fMins[0] *= -1.0;
    fMins[1] = fMins[1] - fMiddle[1];
    if (fMins[1] > 0.0)
        fMins[1] *= -1.0;
    fMins[2] = fMins[2] - fMiddle[2];
    if (fMins[2] > 0.0)
        fMins[2] *= -1.0;
    
    // And the maxs always be positive
    fMaxs[0] = fMaxs[0] - fMiddle[0];
    if (fMaxs[0] < 0.0)
        fMaxs[0] *= -1.0;
    fMaxs[1] = fMaxs[1] - fMiddle[1];
    if (fMaxs[1] < 0.0)
        fMaxs[1] *= -1.0;
    fMaxs[2] = fMaxs[2] - fMiddle[2];
    if (fMaxs[2] < 0.0)
        fMaxs[2] *= -1.0;
    
    SetEntPropVector(iEnt, Prop_Send, "m_vecMins", fMins);
    SetEntPropVector(iEnt, Prop_Send, "m_vecMaxs", fMaxs);
    SetEntProp(iEnt, Prop_Send, "m_nSolidType", 2);
    
    int iEffects = GetEntProp(iEnt, Prop_Send, "m_fEffects");
    iEffects |= 32;
    SetEntProp(iEnt, Prop_Send, "m_fEffects", iEffects);
    
    HookSingleEntityOutput(iEnt, "OnStartTouch", EntOut_OnStartTouch);
    HookSingleEntityOutput(iEnt, "OnEndTouch", EntOut_OnEndTouch);
    */
    
int ent2 CreateEntityByName("trigger_multiple"); 
        
    
DispatchKeyValue(ent2"spawnflags""64");
    
DispatchKeyValue(ent2"wait""0");
    
DispatchSpawn(ent2);
    
ActivateEntity(ent2);
    
    new 
String:iName[50];
    
Format(iNamesizeof(iName), "%s-#%d"GlobalName[client], GetClientUserId(client));
    
SetEntPropString(ent2Prop_Data"m_iName"iName);
    
    new 
Float:fMins[3], Float:fMaxs[3];
    
    
fMins[0] = Origin[0] - 30.0;
    
fMins[1] = Origin[1] - 30.0;
    
fMins[2] = Origin[2];// - 1.0;
    
    
fMaxs[0] = EndOrigin[0] + 30.0;
    
fMaxs[1] = EndOrigin[1] + 30.0;
    
fMaxs[2] = EndOrigin[2];// + 5.0;
    
    
new Float:fMiddle[3];
    
GetMiddleOfABox(fMinsfMaxsfMiddle);
    
TeleportEntity(ent2fMiddleNULL_VECTORNULL_VECTOR);
    
SetEntityModel(ent2"models/error.mdl");
    
    
fMins[0] = fMins[0] - fMiddle[0];
    if (
fMins[0] > 0.0)
        
fMins[0] *= -1.0;
    
fMins[1] = fMins[1] - fMiddle[1];
    if (
fMins[1] > 0.0)
        
fMins[1] *= -1.0;
    
fMins[2] = fMins[2] - fMiddle[2];
    if (
fMins[2] > 0.0)
        
fMins[2] *= -1.0;
    
    
// And the maxs always be positive
    
fMaxs[0] = fMaxs[0] - fMiddle[0];
    if (
fMaxs[0] < 0.0)
        
fMaxs[0] *= -1.0;
    
fMaxs[1] = fMaxs[1] - fMiddle[1];
    if (
fMaxs[1] < 0.0)
        
fMaxs[1] *= -1.0;
    
fMaxs[2] = fMaxs[2] - fMiddle[2];
    if (
fMaxs[2] < 0.0)
        
fMaxs[2] *= -1.0;
    
    
SetEntPropVector(ent2Prop_Send"m_vecMins"fMins);
    
SetEntPropVector(ent2Prop_Send"m_vecMaxs"fMaxs);
    
    
SetEntProp(ent2Prop_Send"m_nSolidType"2);
    
int iEffects GetEntProp(ent2Prop_Send"m_fEffects");
    
iEffects |= 32;
    
SetEntProp(ent2Prop_Send"m_fEffects"iEffects);
    
    
HookSingleEntityOutput(ent2"OnStartTouch"EntOut_OnStartTouch);

    
CreateTimer(BeamLifeKillTheBeamEntIndexToEntRef(ent2), TIMER_FLAG_NO_MAPCHANGE);
    
    if(
amountHurt == 0)
        
PrintToChat(client"[IDEAS] \x07 %s did not hit anybody initially"GlobalName[client]);

    for(new 
i=0;GetArraySize(HitArray);i++) // Ignores first value as it's the caster
    
{
        new 
target GetArrayCell(HitArrayi);
    
        
PrintToChatAll("[IDEAS] \x07 %N was hit by %N's %s"targetclientGlobalName[client]);
            
        
SDKHooks_TakeDamage(targetclientclient1000.0);
    }
    
    return 
Plugin_Continue;

}

public 
Action:KillTheBeam(Handle:hTimerRef)
{
    new 
entity EntRefToEntIndex(Ref);
    
    if(
Ref == INVALID_ENT_REFERENCE)
        return;
    
    
AcceptEntityInput(entity"Kill");
}
public 
void EntOut_OnStartTouch(const char[] outputint callerint activatorfloat delay) {

    if (
activator || activator MaxClients || !IsClientInGame(activator) || !IsPlayerAlive(activator))
        return;
    
    new 
String:iName[50];
    
GetEntPropString(callerProp_Data"m_iName"iNamesizeof(iName));
    
    new 
position StrContains(iName"#"false);
    
    if(
position == -1)
        return;
        
    
Format(iNamesizeof(iName), iName[position+1]);
    
    new 
client GetClientOfUserId(StringToInt(iName));
    
    if(
client == 0)
        return;
        
    else if(
GetClientTeam(activator) == GetClientTeam(client))
        return;
        
    
SDKHooks_TakeDamage(activatorclientclient1000.0);
    
    
PrintToChatAll("[IDEAS] \x07 %N was hit by %N's %s"activatorclientGlobalName[client]);
}
/*
public void EntOut_OnEndTouch(const char[] output, int caller, int activator, float delay) {

    PrintToChatAll("[IDEAS] \x07 Unepic gamer moment");
        if (activator < 1 || activator > MaxClients || !IsClientInGame(activator) || !IsPlayerAlive(activator))
        return;
    
    PrintToChat(activator, "[IDEAS] \x07 epic gamer moment"); 
}
*/
public bool:Trace_DontHitPlayers(entitycontentsMaskvictim

    return !
IsPlayer(entity); 
}  

public 
bool:Trace_DontHitPlayersTwice(entitycontentsMaskHandle:HitArray

    return (
IsPlayer(entity) && FindValueInArray(HitArrayentity) == -1); 
}  

stock bool:IsPlayer(entity)
{
    if(
entity MaxClients)
        return 
false;

    else if(
entity 1)
        return 
false;
        
    return 
true;
}

// [url]https://pastebin.com/CRPi91EC[/url]

stock TE_SetupBeamBall(const float vecLocation[3], const float vecAngle[3], const int colorA[4],float radiusfloat timeint steps)
{
    
float  xyvecView[3],vecTop[3] = {0,...}, angle 0.0;
    
float PI 3.1415926535897932384626433832795;
    
float pos1[3];
    
float pos2[3];
    
vecTop vecAngle;
    
vecView vecAngle;
    
vecTop[0] += 90.0;
    
vecView[0] += 90.0;
    
vecView[1] += 90.0;
    
GetAngleVectors(vecViewvecViewNULL_VECTORNULL_VECTOR);
    
NormalizeVector(vecView,vecView);  
    
ScaleVector(vecViewradius);
    
GetAngleVectors(vecTopvecTopNULL_VECTORNULL_VECTOR);
    
NormalizeVector(vecTop,vecTop);
    
ScaleVector(vecTopradius);  
    
//Create the start position for the first part of the beam
    
pos2[0] = vecLocation[0] + Cosine(angle) * vecView[0] + Sine(angle) * vecTop[0];
    
pos2[1] = vecLocation[1] + Cosine(angle) * vecView[1] + Sine(angle) * vecTop[1];
    
pos2[2] = vecLocation[2] + Cosine(angle) * vecView[2] + Sine(angle) * vecTop[2];
    
angle += PI steps;
    while (
angle <= PI)
    {            
        
pos1[0] = vecLocation[0] + Cosine(angle) * vecView[0] + Sine(angle) * vecTop[0];
        
pos1[1] = vecLocation[1] + Cosine(angle) * vecView[1] + Sine(angle) * vecTop[1];
        
pos1[2] = vecLocation[2] + Cosine(angle) * vecView[2] + Sine(angle) * vecTop[2];
 
        
TE_SetupBeamPoints(pos1pos2BeamSpriteCircleHaloSpriteCircle00time25.025.050.0,colorA3);
        
TE_SendToAll();
           
        
pos2[0] = pos1[0];
        
pos2[1] = pos1[1];
        
pos2[2] = pos1[2];
           
        
angle += PI steps;
    }
}

// Also gets global stuff.
stock IsKamehameModel(client)
{
    new 
String:ModelName[256];
    
GetEntityModel(clientModelNamesizeof(ModelName));
    
    for(new 
i=strlen(ModelName)-1;0;i--)
    {
        if(
ModelName[i] == '/')
        {
            
Format(ModelNamesizeof(ModelName), ModelName[i+1]);
            break;
        }
    }
    
    if(
StrEqual(ModelName"vegeta.mdl"))
    {
        
GlobalColor[client] = {24034220255};
        
GlobalSound[client] = "ideas/galickgun.mp3";
        
GlobalName[client] = "Galick Gun";
        return 
true;
    }
    else if(
StrEqual(ModelName"goku.mdl"))
    {
        
GlobalColor[client] = {117250243255};
        
GlobalSound[client] = "ideas/kamehameha.mp3";
        
GlobalName[client] = "Kamehame";
        return 
true;
    }
        
    return 
false;
}

stock GetEntityModel(entityString:Buffer[], length)
{
    
GetEntPropString(entityProp_Data"m_ModelName"Bufferlength);
}

// Emit sound any.

stock EmitSoundToAllAny(const String:sample[], 
                 
entity SOUND_FROM_PLAYER
                 
channel SNDCHAN_AUTO
                 
level SNDLEVEL_NORMAL
                 
flags SND_NOFLAGS
                 
Float:volume SNDVOL_NORMAL
                 
pitch SNDPITCH_NORMAL
                 
speakerentity = -1
                 const 
Float:origin[3] = NULL_VECTOR
                 const 
Float:dir[3] = NULL_VECTOR
                 
bool:updatePos true
                 
Float:soundtime 0.0)
{
    new 
clients[MaxClients];
    new 
total 0;
    
    for (new 
i=1i<=MaxClientsi++)
    {
        if (
IsClientInGame(i))
        {
            
clients[total++] = i;
        }
    }
    
    if (!
total)
    {
        return;
    }
    
    
EmitSoundAny(clientstotalsampleentitychannel
    
levelflagsvolumepitchspeakerentity,
    
origindirupdatePossoundtime);
}

stock bool:PrecacheSoundAny( const String:szPath[], bool:preload=false)
{
    
EmitSoundCheckEngineVersion();
    
    if (
g_bNeedsFakePrecache)
    {
        return 
FakePrecacheSoundEx(szPath);
    }
    else
    {
        return 
PrecacheSound(szPathpreload);
    }
}

stock static EmitSoundCheckEngineVersion()
{
    if (
g_bCheckedEngine)
    {
        return;
    }

    new 
EngineVersion:engVersion GetEngineVersion();
    
    if (
engVersion == Engine_CSGO || engVersion == Engine_DOTA)
    {
        
g_bNeedsFakePrecache true;
    }
    
g_bCheckedEngine true;
}

stock static bool:FakePrecacheSoundEx( const String:szPath[] )
{
    
decl String:szPathStar[PLATFORM_MAX_PATH];
    
Format(szPathStarsizeof(szPathStar), "*%s"szPath);
    
    
AddToStringTableFindStringTable"soundprecache" ), szPathStar );
    return 
true;
}

stock EmitSoundAny(const clients[], 
                 
numClients
                 const 
String:sample[], 
                 
entity SOUND_FROM_PLAYER
                 
channel SNDCHAN_AUTO
                 
level SNDLEVEL_NORMAL
                 
flags SND_NOFLAGS
                 
Float:volume SNDVOL_NORMAL
                 
pitch SNDPITCH_NORMAL
                 
speakerentity = -1
                 const 
Float:origin[3] = NULL_VECTOR
                 const 
Float:dir[3] = NULL_VECTOR
                 
bool:updatePos true
                 
Float:soundtime 0.0)
{
    
EmitSoundCheckEngineVersion();

    
decl String:szSound[PLATFORM_MAX_PATH];
    
    if (
g_bNeedsFakePrecache)
    {
        
Format(szSoundsizeof(szSound), "*%s"sample);
    }
    else
    {
        
strcopy(szSoundsizeof(szSound), sample);
    }
    
    
EmitSound(clientsnumClientsszSoundentitychannellevelflagsvolumepitchspeakerentityorigindirupdatePossoundtime);    
}

stock void GetMiddleOfABox(const float vec1[3], const float vec2[3], float buffer[3]) {
    
float mid[3];
    
MakeVectorFromPoints(vec1vec2mid);
    
mid[0] = mid[0] / 2.0;
    
mid[1] = mid[1] / 2.0;
    
mid[2] = mid[2] / 2.0;
    
AddVectors(vec1midbuffer);

__________________
IDEAS-GAMING.COM SERVERS ON CSGO :

- HIDE AND SEEK - SUPERHEROES
- BUNNY HOP
- KZ / CLIMB

---------------------------------------------------------------------
My steam link
Donate !

Last edited by vegeta1241; 12-09-2018 at 16:59.
vegeta1241 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 15:02.


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