Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma semicolon 1
- #pragma newdecls required
- #define DEBUG
- #define PLUGIN_AUTHOR ""
- #define PLUGIN_VERSION "0.42"
- #include <sourcemod>
- #include <sdktools>
- #include <tf2>
- #include <tf2_stocks>
- #include <smlib>
- //#include <sdkhooks>
- public Plugin myinfo = {
- name = "frick",
- author = PLUGIN_AUTHOR,
- description = "",
- version = PLUGIN_VERSION,
- url = ""
- };
- public void OnPluginStart() {
- RegAdminCmd("sm_test", sm_test, ADMFLAG_SLAY);
- }
- public void OnMapStart() {
- PrecacheSound("meme/stadiumrave.mp3", true);
- //AddFileToDownloadsTable("sound/meme/stadiumrave.mp3");
- }
- bool TRFiltPlayer(int entity, int contentsMask, any data) {
- return (entity != data);
- }
- stock int CreateParticle(float vPos[3], char[] system, float time=0.0) {
- int particle = CreateEntityByName("info_particle_system");
- if (IsValidEdict(particle)) {
- TeleportEntity(particle, vPos, NULL_VECTOR, NULL_VECTOR);
- DispatchKeyValue(particle, "targetname", "_plParticle");
- DispatchKeyValue(particle, "effect_name", system);
- DispatchSpawn(particle);
- SetVariantString("_plParticle");
- ActivateEntity(particle);
- AcceptEntityInput(particle, "start");
- if (time != 0.0) {
- CreateTimer(time, DeleteParticle, particle);
- }
- }
- return particle;
- }
- public Action DeleteParticle(Handle timer, int particle) {
- if (IsValidEntity(particle)) {
- char class[64];
- GetEdictClassname(particle, class, sizeof(class));
- if (StrEqual(class, "info_particle_system", false)) {
- RemoveEdict(particle);
- }
- }
- }
- #define PARTICLE_CHOICES 4
- char particlechoices[PARTICLE_CHOICES][] = {
- "eyeboss_tp_vortex",
- "nucleus_core_steady",
- "mvm_emergency_light_glow_yellow",
- "mvm_emergencylight_glow_red"
- };
- bool g_running = false;
- public Action sm_test(int client, int args) {
- if (g_running) {
- PrintToChat(client, "Wait for the command to finish silly");
- }
- g_running = true;
- float vClientPos[3];
- Entity_GetAbsOrigin(client, vClientPos);
- for (int i = 0; i < 50; i++) {
- float angDir[3];
- Math_MakeVector(-Math_GetRandomFloat(35.0, 89.0), Math_GetRandomFloat(-180.0, 180.0), 0.0, angDir);
- PrintToServer("angDir: %f %f %f", angDir[0], angDir[1], angDir[2]);
- TR_TraceRayFilter(vClientPos, angDir, MASK_SOLID_BRUSHONLY, RayType_Infinite, TRFiltPlayer, client);
- float vPos[3];
- float vEnd[3];
- TR_GetEndPosition(vEnd);
- float vNormal[3]; // bounce it off
- TR_GetPlaneNormal(INVALID_HANDLE, vNormal);
- ScaleVector(vNormal, Math_GetRandomFloat(64.0, GetVectorDistance(vClientPos, vEnd)));
- PrintToServer("vNormal (scaled): %f %f %f", vNormal[0], vNormal[1], vNormal[2]);
- AddVectors(vEnd, vNormal, vPos);
- PrintToServer("vPos: %f %f %f", vPos[0], vPos[1], vPos[2]);
- CreateParticle(vPos, particlechoices[Math_GetRandomInt(0, PARTICLE_CHOICES - 1)], 30.0);
- }
- EmitSoundToAll("meme/stadiumrave.mp3");
- Handle handle = CreateTimer(0.1, ShakeAll, INVALID_HANDLE, TIMER_REPEAT);
- CreateTimer(30.0, ResetTheThing, handle);
- return Plugin_Handled;
- }
- public Action ResetTheThing(Handle timer, Handle aaaa) {
- g_running = false;
- KillTimer(aaaa);
- }
- public Action ShakeAll(Handle timer) {
- for (int nClient = 1; nClient < GetMaxClients(); nClient++) {
- if (IsValidEdict(nClient) && IsClientInGame(nClient)) {
- Client_Shake(nClient, SHAKE_START, 25.0, 150.0, 0.5);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement