mirror of
https://github.com/Jackzmc/sourcemod-plugins.git
synced 2025-05-06 12:03:20 +00:00
Changes
This commit is contained in:
parent
46444c8693
commit
c14b20b07a
4 changed files with 26 additions and 12 deletions
|
@ -31,6 +31,7 @@ ConVar cvar_gamemode; char gamemode[32];
|
||||||
char currentMap[64];
|
char currentMap[64];
|
||||||
int numberOfPlayers = 0;
|
int numberOfPlayers = 0;
|
||||||
int lastSuccessTime;
|
int lastSuccessTime;
|
||||||
|
int campaignStartTime;
|
||||||
int lastErrorCode;
|
int lastErrorCode;
|
||||||
int uptime;
|
int uptime;
|
||||||
bool fastUpdateMode = false;
|
bool fastUpdateMode = false;
|
||||||
|
@ -59,6 +60,7 @@ public void OnPluginStart()
|
||||||
cvar_gamemode.AddChangeHook(OnCvarChanged);
|
cvar_gamemode.AddChangeHook(OnCvarChanged);
|
||||||
cvar_gamemode.GetString(gamemode, sizeof(gamemode));
|
cvar_gamemode.GetString(gamemode, sizeof(gamemode));
|
||||||
|
|
||||||
|
HookEvent("game_init", Event_GameStart);
|
||||||
HookEvent("heal_success", Event_HealStop);
|
HookEvent("heal_success", Event_HealStop);
|
||||||
HookEvent("heal_interrupted", Event_HealStop);
|
HookEvent("heal_interrupted", Event_HealStop);
|
||||||
HookEvent("player_first_spawn", Event_PlayerFirstSpawn);
|
HookEvent("player_first_spawn", Event_PlayerFirstSpawn);
|
||||||
|
@ -101,16 +103,21 @@ void TryStartTimer(bool fast = true) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Event_HealStart(Event event, const char[] name, bool dontBroadcast) {
|
|
||||||
|
void Event_GameStart(Event event, const char[] name, bool dontBroadcast) {
|
||||||
|
campaignStartTime = GetTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Event_HealStart(Event event, const char[] name, bool dontBroadcast) {
|
||||||
int healing = GetClientOfUserId(event.GetInt("subject"));
|
int healing = GetClientOfUserId(event.GetInt("subject"));
|
||||||
g_icBeingHealed[healing] = true;
|
g_icBeingHealed[healing] = true;
|
||||||
}
|
}
|
||||||
public void Event_HealStop(Event event, const char[] name, bool dontBroadcast) {
|
void Event_HealStop(Event event, const char[] name, bool dontBroadcast) {
|
||||||
int healing = GetClientOfUserId(event.GetInt("subject"));
|
int healing = GetClientOfUserId(event.GetInt("subject"));
|
||||||
g_icBeingHealed[healing] = false;
|
g_icBeingHealed[healing] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Event_PlayerFirstSpawn(Event event, const char[] name, bool dontBroadcast) {
|
void Event_PlayerFirstSpawn(Event event, const char[] name, bool dontBroadcast) {
|
||||||
int client = GetClientOfUserId(event.GetInt("userid"));
|
int client = GetClientOfUserId(event.GetInt("userid"));
|
||||||
playerJoinTime[client] = GetTime();
|
playerJoinTime[client] = GetTime();
|
||||||
RecalculatePlayerCount();
|
RecalculatePlayerCount();
|
||||||
|
@ -143,7 +150,7 @@ public void OnClientPutInServer(int client) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnClientDisconnect_Post(int client) {
|
public void OnClientDisconnect(int client) {
|
||||||
steamidCache[client][0] = '\0';
|
steamidCache[client][0] = '\0';
|
||||||
nameCache[client][0] = '\0';
|
nameCache[client][0] = '\0';
|
||||||
if(!IsFakeClient(client)) {
|
if(!IsFakeClient(client)) {
|
||||||
|
@ -248,6 +255,7 @@ JSONObject GetObject() {
|
||||||
delete players;
|
delete players;
|
||||||
obj.SetFloat("refreshInterval", UPDATE_INTERVAL);
|
obj.SetFloat("refreshInterval", UPDATE_INTERVAL);
|
||||||
obj.SetInt("lastUpdateTime", GetTime());
|
obj.SetInt("lastUpdateTime", GetTime());
|
||||||
|
obj.SetInt("campaignStartTime", campaignStartTime);
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,6 +359,7 @@ JSONObject GetPlayer(int client) {
|
||||||
int team = GetClientTeam(client);
|
int team = GetClientTeam(client);
|
||||||
JSONObject player = new JSONObject();
|
JSONObject player = new JSONObject();
|
||||||
player.SetString("steamid", steamidCache[client]);
|
player.SetString("steamid", steamidCache[client]);
|
||||||
|
player.SetInt("userId", GetClientUserId(client));
|
||||||
player.SetString("name", nameCache[client]);
|
player.SetString("name", nameCache[client]);
|
||||||
player.SetInt("team", team);
|
player.SetInt("team", team);
|
||||||
player.SetBool("isAlive", IsPlayerAlive(client));
|
player.SetBool("isAlive", IsPlayerAlive(client));
|
||||||
|
|
|
@ -254,9 +254,9 @@ public void DB_OnConnectCheck(Database db, DBResultSet results, const char[] err
|
||||||
|
|
||||||
if(hKickType.IntValue > 0) {
|
if(hKickType.IntValue > 0) {
|
||||||
if(public_message[0] != '\0')
|
if(public_message[0] != '\0')
|
||||||
KickClient(client, "You have been banned:\n%s\n\nAppeal at jackz.me/apl/%d", public_message, id);
|
KickClient(client, "Banned:\n%s\nAppeal at jackz.me/apl/%d", public_message, id);
|
||||||
else
|
else
|
||||||
KickClient(client, "You have been banned from this server.\n\nAppeal at jackz.me/apl/%d", id);
|
KickClient(client, "You have been banned from this server.\nAppeal at jackz.me/apl/%d", id);
|
||||||
static char query[128];
|
static char query[128];
|
||||||
g_db.Format(query, sizeof(query), "UPDATE bans SET times_tried=times_tried+1 WHERE steamid = '%s'", steamid);
|
g_db.Format(query, sizeof(query), "UPDATE bans SET times_tried=times_tried+1 WHERE steamid = '%s'", steamid);
|
||||||
g_db.Query(DB_GenericCallback, query);
|
g_db.Query(DB_GenericCallback, query);
|
||||||
|
|
|
@ -357,8 +357,13 @@ void ApplyTroll(int victim, const char[] name, int activator, trollModifier modi
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(flags > -1 && Trolls[trollIndex].timerInterval > 0.0) {
|
// Clear troll specific timer:
|
||||||
CreateTimer(Trolls[trollIndex].timerInterval, Trolls[trollIndex].timerFunction, victim, TIMER_REPEAT);
|
if(Trolls[trollIndex].timerInterval > 0.0) {
|
||||||
|
if(flags > -1)
|
||||||
|
Trolls[trollIndex].timerHandles[victim] = CreateTimer(Trolls[trollIndex].timerInterval, Trolls[trollIndex].timerFunction, victim, TIMER_REPEAT);
|
||||||
|
else if(Trolls[trollIndex].timerHandles[victim] != null) {
|
||||||
|
delete Trolls[trollIndex].timerHandles[victim];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!silent && SilentMenuSelected[activator]) silent = true;
|
if(!silent && SilentMenuSelected[activator]) silent = true;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue