Veteran Member
Join Date: Aug 2010
Location: Canada is my city
|
03-23-2019
, 13:48
Re: CS:GO -> MOHAA Freeze-Tag
|
#9
|
Quote:
Originally Posted by SOBgaming
Is it on github?
|
No but I can give the source, I don't really have time to work on it atm if you wish to finish it.
PHP Code:
#pragma semicolon 1 #include <sourcemod> #include <sdktools> #pragma newdecls required
char g_sSprites[] = "sprites/purplelaser1.vmt"; int g_iBeamModelIndex;
enum struct IFreezeBeam { int entity; int color[4]; float position[3]; }
IFreezeBeam gFreezeBeams[MAXPLAYERS + 1][3];
public Plugin myinfo = { name = "Freezetag", author = "Mathias", description = "this meme is not dead", version = "0.0.1", url = "https://www.youtube.com/watch?v=2wGCqNZM7eA" };
public void OnPluginStart() { RegConsoleCmd("beam_test", BeamTest, "");
HookEvent("player_death", OnPlayerDeath); }
public void OnPlayerDeath(Event event, const char[] name, bool dontBroadcast) { int userid = event.GetInt("userid"); int client = GetClientOfUserId(userid);
/*TE_SetupBeamPoints(position, end, g_iBeamModelIndex, 0, 0, 0, 2.0, 20.0, 20.0, 0, 0.0, color, 0); TE_SendToAll(0.0);*/
CreateFakePlayer(client); CreateFreezeBeams(client);
RequestFrame(RemoveRagdoll, userid); }
void CreateFakePlayer(int client) { char model[256]; GetClientModel(client, model, 256);
float position[3], angle[3]; GetClientAbsOrigin(client, position); GetClientAbsAngles(client, angle); position[2] -= 65.0;
int entity = CreateEntityByName("prop_dynamic"); DispatchKeyValue(entity, "model", model); DispatchKeyValue(entity, "solid", "0"); SetEntityModel(entity, model); TeleportEntity(entity, position, angle, NULL_VECTOR); DispatchSpawn(entity); }
void CreateFreezeBeams(int client) { CreateFreezeBeam(client, 0); CreateFreezeBeam(client, 1); CreateFreezeBeam(client, 2); }
void CreateFreezeBeam(int client, int index) { //int color[4] = { 0, 255, 255, 255 };
int team = GetClientTeam(client);
float start[3], end[3]; GetClientAbsOrigin(client, start);
if (index == 0) { start[0] += 25.0; start[1] -= 15.0; } else if (index == 1) { start[0] -= 15.0; start[1] += 25.0; } else { start[0] -= 25.0; start[1] -= 25.0; } // set the heigh to the floor start[2] -= 70.0;
end[0] = start[0]; end[1] = start[1]; end[2] = start[2] + 105.0;
int tar = CreateEntityByName("env_sprite"); DispatchSpawn(tar); TeleportEntity(tar, end, NULL_VECTOR, NULL_VECTOR);
int beam = CreateEntityByName("env_beam"); SetEntityModel(beam, g_sSprites); DispatchKeyValue(beam, "renderamt", "100"); DispatchKeyValue(beam, "rendermode", "0"); if (team == 3) { DispatchKeyValue(beam, "rendercolor", "0, 102, 255"); } else if (team == 2) { DispatchKeyValue(beam, "rendercolor", "204, 51, 0"); } DispatchKeyValue(beam, "life", "0"); TeleportEntity(beam, start, NULL_VECTOR, NULL_VECTOR);
DispatchSpawn(beam); SetEntPropEnt(beam, Prop_Send, "m_hAttachEntity", EntIndexToEntRef(beam)); SetEntPropEnt(beam, Prop_Send, "m_hAttachEntity", EntIndexToEntRef(tar), 1); SetEntProp(beam, Prop_Send, "m_nNumBeamEnts", 2); SetEntProp(beam, Prop_Send, "m_nBeamType", 2); SetEntPropFloat(beam, Prop_Data, "m_fWidth", 20.0); SetEntPropFloat(beam, Prop_Data, "m_fEndWidth", 20.0); AcceptEntityInput(beam, "TurnOn"); }
public void RemoveRagdoll(int userid) { int client = GetClientOfUserId(userid); if (!client) return;
int ragdoll = GetEntPropEnt(client, Prop_Send, "m_hRagdoll"); if (ragdoll < 0) { PrintToServer("Couldn't find the ragdoll of %N.", client); return; }
AcceptEntityInput(ragdoll, "kill"); }
public Action OnPlayerRunCmd(int client, int& buttons, int& impulse, float vel[3], float angles[3], int& weapon, int& subtype, int& cmdnum, int& tickcount, int& seed, int mouse[2]) { if(buttons & IN_USE) { TraceTest(client); } return Plugin_Continue; }
void TraceTest(int client) { float pos[3], angles[3]; GetClientEyePosition(client, pos); GetClientEyeAngles(client, angles);
Handle trace = TR_TraceRayFilterEx(pos, angles, MASK_ALL, RayType_Infinite, TraceFilter, client);
int target = TR_GetEntityIndex(trace); if( target >= 0 ) { char model[128]; GetEntPropString(target, Prop_Data, "m_ModelName", model, 128); PrintHintText(client, "You have are looking at %s", model); } else { PrintHintText(client, "You have are looking at nothing"); } }
bool TraceFilter(int entity, int contentsMask, int client) { if (entity == client) return false;
return true; }
public Action BeamTest(int client, int args) { float start[3] = { -1168.0, -812.0, 160.0 }; float end[3] = { -1168.0, -812.0, 220.0 }; int color[4] = { 0, 255, 255, 255 }; TE_SetupBeamPoints(start, end, g_iBeamModelIndex, 0, 0, 0, 2.0, 20.0, 20.0, 0, 0.0, color, 0); TE_SendToAll(0.0); return Plugin_Handled; }
public void OnMapStart() { g_iBeamModelIndex = PrecacheModel(g_sSprites); }
The entities are not attach to a variable atm you will need to destroy them when needed, my struct is not really used and you need to store 2 entities for the beams, not just one + the fake player. The trace ray is not working on none solid entities so that why I recommend to do the unfeeze from an AOE for the moment until someone find a solution for it.
BeamTest can be deleted is not used anymore, TE doesn't allow you enough controls.
EDIT: credits to this snippet to help me with creating the beam properly https://forums.alliedmods.net/showthread.php?t=237402.
Last edited by Mathias.; 03-23-2019 at 13:52.
|
|