Raised This Month: $ Target: $400
 0% 

Beacon?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
NiceAndSimple
Member
Join Date: Jan 2012
Old 07-16-2012 , 00:28   Beacon?
Reply With Quote #1

Can someone please take the beacon from sourcemod and place it into a separate plugin so when a player types !bc or !beacon it will give him/her a beacon.
NiceAndSimple is offline
Sreaper
髪を用心
Join Date: Nov 2009
Old 07-16-2012 , 01:06   Re: Beacon?
Reply With Quote #2

I'm certain you can achieve what you want by using this plugin. http://forums.alliedmods.net/showthread.php?t=67098
Sreaper is offline
Snach
Member
Join Date: Jul 2012
Old 07-16-2012 , 20:08   Re: Beacon?
Reply With Quote #3

PHP Code:
#include <sourcemod>
#include <sdktools>

#pragma semicolon 1

#define SOUND_BLIP        "buttons/blip1.wav"
#define DEFAULT_TIMER_FLAGS TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE

new g_BeamSprite= -1;
new 
g_HaloSprite= -1;

new 
redColor[4]        = {2557575255};
new 
greenColor[4]    = {7525575255};
new 
blueColor[4]    = {7575255255};
new 
greyColor[4]    = {128128128255};

new 
g_BeaconSerial[MAXPLAYERS+1] = { 0, ... };

new 
g_Serial_Gen 0;

new 
Handle:g_Cvar_BeaconRadius INVALID_HANDLE;

public 
Plugin:myinfo 
{
    
name "Beacon",
    
author "AlliedModders LLC",
    
description "Toggle self beacon",
    
version "1.0",
    
url "http://www.sourcemod.net/"
}

public 
OnPluginStart()
{
    
g_Cvar_BeaconRadius CreateConVar("sm_beacon_rad""375""Sets the radius for beacon's light rings."0true50.0true1500.0);
    
RegConsoleCmd("sm_bc"Command_Beacon"Toggles beacon");
    
HookEvents();
    
AutoExecConfig(true,"sm_bc");
}

public 
OnMapStart()
{
    
PrecacheSound(SOUND_BLIPtrue);
    
    new 
sdkversion GuessSDKVersion();
    if (
sdkversion == SOURCE_SDK_LEFT4DEAD || sdkversion == SOURCE_SDK_LEFT4DEAD2)
    {
        
g_BeamSprite PrecacheModel("materials/sprites/laserbeam.vmt");
        
g_HaloSprite PrecacheModel("materials/sprites/glow01.vmt");
    }
    else
    {
        
g_BeamSprite PrecacheModel("materials/sprites/laser.vmt");
        
g_HaloSprite PrecacheModel("materials/sprites/halo01.vmt");
    }
}

HookEvents( )
{
    
decl String:folder[64];
    
GetGameFolderName(foldersizeof(folder));

    if (
strcmp(folder"tf") == 0)
    {
        
HookEvent("teamplay_win_panel"Event_RoundEndEventHookMode_PostNoCopy);
        
HookEvent("teamplay_restart_round"Event_RoundEndEventHookMode_PostNoCopy);
        
HookEvent("arena_win_panel"Event_RoundEndEventHookMode_PostNoCopy);
    }
    else if (
strcmp(folder"nucleardawn") == 0)
    {
        
HookEvent("round_win"Event_RoundEndEventHookMode_PostNoCopy);
    }
    else
    {
        
HookEvent("round_end"Event_RoundEndEventHookMode_PostNoCopy);
    }    
}

public 
OnMapEnd()
{
    
KillAllBeacons( );
}

public 
Action:Event_RoundEnd(Handle:event,const String:name[],bool:dontBroadcast)
{
    
KillAllBeacons( );
}

CreateBeacon(client)
{
    
g_BeaconSerial[client] = ++g_Serial_Gen;
    
CreateTimer(1.0Timer_Beaconclient | (g_Serial_Gen << 7), DEFAULT_TIMER_FLAGS);    
}

KillBeacon(client)
{
    
g_BeaconSerial[client] = 0;

    if (
IsClientInGame(client))
    {
        
SetEntityRenderColor(client255255255255);
    }
}

KillAllBeacons()
{
    for (new 
1<= MaxClientsi++)
    {
        
KillBeacon(i);
    }
}

PerformBeacon(client)
{
    if (
g_BeaconSerial[client] == 0)
    {
        
CreateBeacon(client);
        
LogAction(clientclient"\"%L\" set a beacon on himself"client);
    }
    else
    {
        
KillBeacon(client);
        
LogAction(clientclient"\"%L\" removed a beacon on himself"client);
    }
}

public 
Action:Timer_Beacon(Handle:timerany:value)
{
    new 
client value 0x7f;
    new 
serial value >> 7;

    if (!
IsClientInGame(client)
        || !
IsPlayerAlive(client)
        || 
g_BeaconSerial[client] != serial)
    {
        
KillBeacon(client);
        return 
Plugin_Stop;
    }
    
    new 
team GetClientTeam(client);

    new 
Float:vec[3];
    
GetClientAbsOrigin(clientvec);
    
vec[2] += 10;

    
TE_SetupBeamRingPoint(vec10.0GetConVarFloat(g_Cvar_BeaconRadius), g_BeamSpriteg_HaloSprite0150.55.00.0greyColor100);
    
TE_SendToAll();
    
    if (
team == 2)
    {
        
TE_SetupBeamRingPoint(vec10.0GetConVarFloat(g_Cvar_BeaconRadius), g_BeamSpriteg_HaloSprite0100.610.00.5redColor100);
    }
    else if (
team == 3)
    {
        
TE_SetupBeamRingPoint(vec10.0GetConVarFloat(g_Cvar_BeaconRadius), g_BeamSpriteg_HaloSprite0100.610.00.5blueColor100);
    }
    else
    {
        
TE_SetupBeamRingPoint(vec10.0GetConVarFloat(g_Cvar_BeaconRadius), g_BeamSpriteg_HaloSprite0100.610.00.5greenColor100);
    }
    
    
TE_SendToAll();
        
    
GetClientEyePosition(clientvec);
    
EmitAmbientSound(SOUND_BLIPvecclientSNDLEVEL_RAIDSIREN);    
        
    return 
Plugin_Continue;
}

public 
Action:Command_Beacon(clientargs)
{
    if(
client>0&&IsPlayerAlive(client))
        
PerformBeacon(client);
    
    return 
Plugin_Handled;

Snach 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 23:42.


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