#pragma semicolon 1
#include <sourcemod>
#define PLUGIN_DESCRIPTION "Sprintelés."
#define PLUGIN_VERSION "0.0.1a"
#define YELLOW 0x01
#define NAME_TEAMCOLOR 0x02
#define TEAMCOLOR 0x03
#define GREEN 0x04
new Handle:sm_sprintsource_enabled;
new Handle:sm_sprintsource_time;
new Handle:sm_sprintsource_cooldown;
new Handle:sm_sprintsource_sprintspeed;
new bool:client_connected[MAXPLAYERS+1];
new bool:client_sprintusing[MAXPLAYERS+1];
new bool:client_sprintcool[MAXPLAYERS+1];
public Plugin:myinfo =
{
name = "Sprint: Source Plugin",
author = "Alican 'AlicanC' Çubukçuoğlu",
description = PLUGIN_DESCRIPTION,
version = PLUGIN_VERSION,
url = "http://www.sourcemod.net/"
}
public OnPluginStart()
{
LoadTranslations("plugin.sprintsource.base");
CreateConVar("sprintsource_version", PLUGIN_VERSION, "Sprint: Source Version", FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
sm_sprintsource_enabled= CreateConVar("sm_sprintsource_enable", "1", "Kikapcs./bekapcsolás", FCVAR_PLUGIN|FCVAR_NOTIFY);
sm_sprintsource_time= CreateConVar("sm_sprintsource_time", "3", "Sprint Idő", FCVAR_PLUGIN|FCVAR_NOTIFY);
sm_sprintsource_cooldown= CreateConVar("sm_sprintsource_cooldown", "10", "lefagyás ideje", FCVAR_PLUGIN|FCVAR_NOTIFY);
sm_sprintsource_sprintspeed= CreateConVar("sm_sprintsource_sprintspeed", "2", "Sprint sebessége", FCVAR_PLUGIN|FCVAR_NOTIFY);
HookEvent("round_start", Event_RoundStart);
//RegAdminCmd("sm_sprint_take", Cmd_TakeSprint, ADMFLAG_GENERIC);
//RegAdminCmd("sm_sprint_give", Cmd_GiveSprint, ADMFLAG_GENERIC);
RegConsoleCmd("ss_sprint", Cmd_StartSprint);
}
public OnClientPutInServer(client)
{
if(!GetConVarBool(sm_sprintsource_enabled))
return;
//
client_connected[client]= true;
//
Skill_Sprint_Reset(client);
//
PrintToChat(client, "%c[Sprint]%c %t", GREEN, YELLOW, "SprintSource Running", PLUGIN_VERSION);
PrintToChat(client, "%c[Sprint]%c %t", GREEN, YELLOW, "SprintSource Command");
//
return;
}
public Event_RoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
if(!GetConVarBool(sm_sprintsource_enabled))
return;
//Get clients
new clients= GetMaxClients();
//
for(new client= 1; client<=clients; client++)
{
//
if(IsClientInGame(client))
{
Skill_Sprint_Reset(client);
PrintToChat(client, "%c[Sprint]%c %t", GREEN, YELLOW, "SprintSource Command");
}
}
}
public Skill_Sprint_Reset(client)
{
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", 1.0);
client_sprintusing[client]=false;
client_sprintcool[client]=true;
}
public Action:Cmd_StartSprint(client, args)
{
if(!GetConVarBool(sm_sprintsource_enabled))
return;
if(client_sprintusing[client])
{
return;
}
if(!client_sprintcool[client])
{
return;
}
client_sprintusing[client]=true;
client_sprintcool[client]=false;
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", GetConVarFloat(sm_sprintsource_sprintspeed));
PrintToChat(client, "%c[Sprint]%c %t", GREEN, YELLOW, "SprintSource Start");
CreateTimer(GetConVarFloat(sm_sprintsource_time), Timer_SprintEnd, client);
}
public Action:Timer_SprintEnd(Handle:timer, any:client)
{
SetEntPropFloat(client, Prop_Data, "m_flLaggedMovementValue", 1.0);
if(!client_sprintusing[client])
{
return;
}
client_sprintusing[client]=false;
PrintToChat(client, "%c[Sprint]%c %t", GREEN, YELLOW, "SprintSource End");
CreateTimer(GetConVarFloat(sm_sprintsource_cooldown), Timer_SprintCooldown, client);
}
public Action:Timer_SprintCooldown(Handle:timer, any:client)
{
if(client_sprintcool[client])
{
return;
}
client_sprintcool[client]=true;
PrintToChat(client, "%c[Sprint]%c %t", GREEN, YELLOW, "SprintSource Cool");
}