Jump to content
DARKARENA ROMANIA
Start up DARKARENA ROMANIA
Comunitatea DARKARENA isi deschide portile pentru intreg publicul.
Va asteptam cu un cont pe forum si sa va alaturati comunitatii noastre!
TICKRATE HOSTING [www.tickrate.ro]
"Suntem o firma noua de hosting pe piata din Romania si de la bun inceput, incercam sa oferim cele mai bune si avantajoase servicii.
Noi incercam sa facem ca ofertele noastre sa fie pe placul dvs, nu ezitati sa ne contactati.
Pentru serverele de jocuri detinem un panou de control de ultima generatie, pentru o administrare usoara si simpla, a serviciilor."
SERVERBOARD PANEL [www.serverboard.ro]
Putem spune, un nou mod de a iti administra serviciile gazduite de firma noastra [www.tickrate.ro].
Panel-ul realizat de catre tehnicienii nostrii, este un tablou de control din care poti efectua comenzi foarte simplu si usor, catre serviciile tale active pe contul de client.

Sign in to follow this  
SneaX

plugin go [Plugin] Flashlight

Recommended Posts

Posted (edited)

Numele plugin-ului: Flashlight

Cvar-uri:

Sursa:

 

 


#pragma semicolon 1
#include <sdktools>
#define PVERSION "1.3.63"

new Handle:gH_Enabled = INVALID_HANDLE;
new Handle:gH_LAW = INVALID_HANDLE;
new Handle:gH_Return = INVALID_HANDLE;
new Handle:gH_Sound = INVALID_HANDLE;
new Handle:gH_SoundAll = INVALID_HANDLE;

new bool:bEnabled = true;
new bool:bLAW = true;
new bool:bRtn = false;
new bool:bSnd = false;
new bool:bSndAll = true;

new String:zsSnd[255];

public Plugin:myinfo =
{
	name = "Flashlight",
	author = "Mitch",
	description = "Replaces +lookatweapon with a toggleable flashlight. Also adds the command: sm_flashlight",
	version = PVERSION,
	url = "https://forums.alliedmods.net/showthread.php?t=227224"
};

public OnPluginStart()
{
	gH_Enabled = CreateConVar("sm_flashlight_enabled", "0", 
					"0 = Disables flashlight; 1 = Enables flashlight", 		FCVAR_PLUGIN, true, 0.0, true, 1.0);
	gH_LAW = CreateConVar("sm_flashlight_lookatweapon", "0", 
					"0 = Doesn't use +lookatweapon; 1 = hooks +lookatweapon", 		FCVAR_PLUGIN, true, 0.0, true, 1.0);
	gH_Return = CreateConVar("sm_flashlight_return", "1", 
					"0 = Doesn't return blocking +look at weapon; 1 = Does return", FCVAR_PLUGIN, true, 0.0, true, 1.0);
	gH_Sound = CreateConVar("sm_flashlight_sound", "items/flashlight1.wav", 
					"Sound path to use when a player uses the flash light.", FCVAR_PLUGIN);
	gH_SoundAll = CreateConVar("sm_flashlight_sound_all", "1", 
					"Play the sound to all players, or just to the activator?", FCVAR_PLUGIN);
	UpdateSound();
	HookConVarChange(gH_Sound, ConVarChanged);
	HookConVarChange(gH_Enabled, ConVarChanged);
	HookConVarChange(gH_LAW, ConVarChanged);
	HookConVarChange(gH_Return, ConVarChanged);
	HookConVarChange(gH_SoundAll, ConVarChanged);
	AutoExecConfig();

	CreateConVar("sm_flashlight_version", PVERSION, "CsGoFlashlight Version", FCVAR_DONTRECORD|FCVAR_NOTIFY);

	AddCommandListener(Command_LAW, "+strafe");	//Hooks cs:go's flashlight replacement 'look at weapon'.
	RegConsoleCmd("sm_flashlight", Command_FlashLight); 	//Bindable Flashlight command
}

public ConVarChanged(Handle:cvar, const String:oldVal[], const String:newVal[])
{
	if(cvar == gH_Enabled)
		bEnabled = bool:StringToInt(newVal);
	if(cvar == gH_LAW)
		bLAW = bool:StringToInt(newVal);
	if(cvar == gH_Return)
		bRtn = bool:StringToInt(newVal);
	if(cvar == gH_SoundAll)
		bSndAll = bool:StringToInt(newVal);
	if(cvar == gH_Sound) {
		UpdateSound();
	}
}

public UpdateSound() {
	decl String:formatedSound[256];
	GetConVarString(gH_Sound, formatedSound, sizeof(formatedSound));
	if(StrEqual(formatedSound, "") || StrEqual(formatedSound, "0")) {
		bSnd = false;
	} else {
		strcopy(zsSnd, sizeof(zsSnd), formatedSound);
		bSnd = true;
		PrecacheSound(zsSnd);
		if(!StrEqual(formatedSound, "items/flashlight1.wav")) {
			Format(formatedSound, sizeof(formatedSound), "sound/%s", formatedSound);
			AddFileToDownloadsTable(formatedSound);
		}
	}
}

public OnMapStart() {
	if(bSnd) {
		PrecacheSound(zsSnd, true);
	}
}

public Action:Command_LAW(client, const String:command[], argc)
{
	if(!bLAW || !bEnabled) //Enable this hook?
		return Plugin_Continue;

	if(!IsClientInGame(client)) //If player is not in-game then ignore!
		return Plugin_Continue;

	if(!IsPlayerAlive(client)) //If player is not alive then continue the command.
		return Plugin_Continue;	

	ToggleFlashlight(client);

	return (bRtn) ? Plugin_Continue : Plugin_Handled;
}

public Action:Command_FlashLight(client, args)
{
	if(!bEnabled)
		return Plugin_Handled;

	if (IsClientInGame(client) && IsPlayerAlive(client)) {
		ToggleFlashlight(client);
	}
	return Plugin_Handled;
}

ToggleFlashlight(client) {
	SetEntProp(client, Prop_Send, "m_fEffects", GetEntProp(client, Prop_Send, "m_fEffects") ^ 4);
	if(bSnd) {
		if(bSndAll) {
			EmitSoundToAll(zsSnd, client);
		} else {
			EmitSoundToClient(client, zsSnd);
		}
	}
}

 

Autor: - 

Link Download: Girlshare  Mega

Imagini(optional): -

Mod instalare: Va adauga flashlight(ca pe 1.6/source) pe server folosind: bind tasta sm_flashlight sau editand mai jos anumite randuri pentru a functiona pe tasta de inspect

Edited by SneaX

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...