diff --git a/Warden/plugins/warden.smx b/Warden/plugins/warden.smx index 3ecffd1..6989ce1 100644 Binary files a/Warden/plugins/warden.smx and b/Warden/plugins/warden.smx differ diff --git a/Warden/scripting/includes/warden.inc b/Warden/scripting/include/warden.inc similarity index 100% rename from Warden/scripting/includes/warden.inc rename to Warden/scripting/include/warden.inc diff --git a/Warden/scripting/warden.sp b/Warden/scripting/warden.sp index 9dd9152..24890ef 100644 --- a/Warden/scripting/warden.sp +++ b/Warden/scripting/warden.sp @@ -1,22 +1,25 @@ #include #include -#define PLUGIN_VERSION "3.0.1" +#define PLUGIN_VERSION "3.0.2" -new Warden = -1; -new Handle:g_cVar_mnotes = INVALID_HANDLE; -new Handle:g_fward_onBecome = INVALID_HANDLE; -new Handle:g_fward_onRemove = INVALID_HANDLE; +#pragma semicolon 1 +#pragma newdecls required -public Plugin:myinfo = { - name = "Jailbreak Warden", - author = "ecca", - description = "Jailbreak Warden script", - version = PLUGIN_VERSION, +int Warden = -1; +ConVar g_cVar_mnotes = null, g_cvar_remove_death = null, g_cvar_remove_startround = null; +Handle g_fward_onBecome = null, g_fward_onRemoved = null, g_fward_onDeath = null, g_fward_onRemove = null; + +public Plugin myinfo = +{ + name = "Jailbreak Warden", + author = "ecca, ByDexter", + description = "Jailbreak Warden script", + version = PLUGIN_VERSION, url = "ffac.eu" }; -public OnPluginStart() +public void OnPluginStart() { // Initialize our phrases LoadTranslations("warden.phrases"); @@ -35,34 +38,38 @@ public OnPluginStart() RegAdminCmd("sm_rw", RemoveWarden, ADMFLAG_GENERIC); RegAdminCmd("sm_rc", RemoveWarden, ADMFLAG_GENERIC); - // Hooking the events - HookEvent("round_start", roundStart); // For the round start - HookEvent("player_death", playerDeath); // To check when our warden dies :) - // For our warden to look some extra cool AddCommandListener(HookPlayerChat, "say"); + // Hook + HookEvent("round_start", RoundStart); + HookEvent("player_death", OnClientDead); + // May not touch this line - CreateConVar("sm_warden_version", PLUGIN_VERSION, "The version of the SourceMod plugin JailBreak Warden, by ecca", FCVAR_REPLICATED|FCVAR_SPONLY|FCVAR_PLUGIN|FCVAR_NOTIFY|FCVAR_DONTRECORD); - g_cVar_mnotes = CreateConVar("sm_warden_better_notifications", "0", "0 - disabled, 1 - Will use hint and center text", FCVAR_PLUGIN, true, 0.0, true, 1.0); + CreateConVar("sm_warden_version", PLUGIN_VERSION, "The version of the SourceMod plugin JailBreak Warden, by ecca", FCVAR_REPLICATED | FCVAR_SPONLY | FCVAR_NOTIFY | FCVAR_DONTRECORD); + g_cVar_mnotes = CreateConVar("sm_better_warden_message", "0", "0 - Off, 1 - Center and Hint Text", FCVAR_NOTIFY, true, 0.0, true, 1.0); + g_cvar_remove_death = CreateConVar("sm_warden_death_remove", "1", "0 - Off, 1 - On", FCVAR_NOTIFY, true, 0.0, true, 1.0); + g_cvar_remove_startround = CreateConVar("sm_warden_roundstart_remove", "1", "0 - Off, 1 - On", FCVAR_NOTIFY, true, 0.0, true, 1.0); g_fward_onBecome = CreateGlobalForward("warden_OnWardenCreated", ET_Ignore, Param_Cell); - g_fward_onRemove = CreateGlobalForward("warden_OnWardenRemoved", ET_Ignore, Param_Cell); + g_fward_onRemoved = CreateGlobalForward("warden_OnWardenRemoved", ET_Ignore, Param_Cell); + g_fward_onRemove = CreateGlobalForward("warden_OnWardenRemove", ET_Ignore, Param_Cell); + g_fward_onDeath = CreateGlobalForward("wardeN_OnWardenDeath", ET_Ignore, Param_Cell); } -public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max) +public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max) { CreateNative("warden_exist", Native_ExistWarden); CreateNative("warden_iswarden", Native_IsWarden); CreateNative("warden_set", Native_SetWarden); CreateNative("warden_remove", Native_RemoveWarden); - + RegPluginLibrary("warden"); return APLRes_Success; } -public Action:BecomeWarden(client, args) +public Action BecomeWarden(int client, int args) { if (Warden == -1) // There is no warden , so lets proceed { @@ -71,201 +78,218 @@ public Action:BecomeWarden(client, args) if (IsPlayerAlive(client)) // A dead warden would be worthless >_< { SetTheWarden(client); + return Plugin_Handled; } else // Grr he is not alive -.- { - PrintToChat(client, "Warden ~ %t", "warden_playerdead"); + PrintToChat(client, "[SM] %t", "warden_playerdead"); + return Plugin_Handled; } } else // Would be wierd if an terrorist would run the prison wouldn't it :p { - PrintToChat(client, "Warden ~ %t", "warden_ctsonly"); + PrintToChat(client, "[SM] %t", "warden_ctsonly"); + return Plugin_Handled; } } else // The warden already exist so there is no point setting a new one { - PrintToChat(client, "Warden ~ %t", "warden_exist", Warden); + PrintToChat(client, "[SM] %t", "warden_exist", Warden); + return Plugin_Handled; } } -public Action:ExitWarden(client, args) +public Action ExitWarden(int client, int args) { - if(client == Warden) // The client is actually the current warden so lets proceed + if (client == Warden) // The client is actually the current warden so lets proceed { - PrintToChatAll("Warden ~ %t", "warden_retire", client); - if(GetConVarBool(g_cVar_mnotes)) + PrintToChatAll("[SM] %t", "warden_retire", client); + if (g_cVar_mnotes.BoolValue) { - PrintCenterTextAll("Warden ~ %t", "warden_retire", client); - PrintHintTextToAll("Warden ~ %t", "warden_retire", client); + PrintCenterTextAll("%t", "warden_retire", client); + PrintHintTextToAll("%t", "warden_retire", client); } Warden = -1; // Open for a new warden + Forward_OnWardenRemove(client); SetEntityRenderColor(client, 255, 255, 255, 255); // Lets remove the awesome color + return Plugin_Handled; } else // Fake dude! { - PrintToChat(client, "Warden ~ %t", "warden_notwarden"); - } -} - -public Action:roundStart(Handle:event, const String:name[], bool:dontBroadcast) -{ - Warden = -1; // Lets remove the current warden if he exist -} - -public Action:playerDeath(Handle:event, const String:name[], bool:dontBroadcast) -{ - new client = GetClientOfUserId(GetEventInt(event, "userid")); // Get the dead clients id - - if(client == Warden) // Aww damn , he is the warden - { - PrintToChatAll("Warden ~ %t", "warden_dead", client); - if(GetConVarBool(g_cVar_mnotes)) - { - PrintCenterTextAll("Warden ~ %t", "warden_dead", client); - PrintHintTextToAll("Warden ~ %t", "warden_dead", client); - } - SetEntityRenderColor(client, 255, 255, 255, 255); // Lets give him the standard color back - Warden = -1; // Lets open for a new warden + PrintToChat(client, "[SM] %t", "warden_notwarden"); + return Plugin_Handled; } } -public OnClientDisconnect(client) +public void OnClientDisconnect(int client) { - if(client == Warden) // The warden disconnected, action! + if (client == Warden) // The warden disconnected, action! { - PrintToChatAll("Warden ~ %t", "warden_disconnected"); - if(GetConVarBool(g_cVar_mnotes)) + PrintToChatAll("[SM] %t", "warden_disconnected"); + if (g_cVar_mnotes.BoolValue) { - PrintCenterTextAll("Warden ~ %t", "warden_disconnected", client); - PrintHintTextToAll("Warden ~ %t", "warden_disconnected", client); + PrintCenterTextAll("%t", "warden_disconnected", client); + PrintHintTextToAll("%t", "warden_disconnected", client); } Warden = -1; // Lets open for a new warden + Forward_OnWardenRemoved(client); } } -public Action:RemoveWarden(client, args) +public Action RemoveWarden(int client, int args) { - if(Warden != -1) // Is there an warden at the moment ? + if (Warden != -1) // Is there an warden at the moment ? { RemoveTheWarden(client); + return Plugin_Handled; } else { - PrintToChatAll("Warden ~ %t", "warden_noexist"); + PrintToChatAll("[SM] %t", "warden_noexist"); + return Plugin_Handled; } +} - return Plugin_Handled; // Prevent sourcemod from typing "unknown command" in console +public Action RoundStart(Event event, const char[] name, bool dontBroadcast) +{ + if (g_cvar_remove_startround.BoolValue && Warden != -1) + Warden = -1; } -public Action:HookPlayerChat(client, const String:command[], args) +public Action OnClientDead(Event event, const char[] name, bool dontBroadcast) { - if(Warden == client && client != 0) // Check so the player typing is warden and also checking so the client isn't console! + if (Warden != -1) { - new String:szText[256]; + int client = GetClientOfUserId(event.GetInt("userid")); + if (client == Warden) + { + Forward_OnWardenDeath(client); + if (g_cvar_remove_death.BoolValue) + { + Warden = -1; + PrintToChatAll("[SM] %t", "warden_dead"); + if (g_cVar_mnotes.BoolValue) + { + PrintCenterTextAll("%t", "warden_dead"); + PrintHintTextToAll("%t", "warden_dead"); + } + } + } + } +} + +public Action HookPlayerChat(int client, const char[] command, int argc) +{ + if (Warden == client && client != 0) // Check so the player typing is warden and also checking so the client isn't console! + { + char szText[256]; GetCmdArg(1, szText, sizeof(szText)); - - if(szText[0] == '/' || szText[0] == '@' || IsChatTrigger()) // Prevent unwanted text to be displayed. + if (IsPlayerAlive(client)) // Typing warden is alive and his team is Counter-Terrorist { + PrintToChatAll(" \x0B[Warden] \x10%N : \x04%s", client, szText); return Plugin_Handled; } - - if(IsClientInGame(client) && IsPlayerAlive(client) && GetClientTeam(client) == 3) // Typing warden is alive and his team is Counter-Terrorist + else { - PrintToChatAll("[Warden] %N : %s", client, szText); + PrintToChatAll(" \x02*DEAD* \x0B[Warden] \x10%N : \x04%s", client, szText); return Plugin_Handled; } } - return Plugin_Continue; } -public SetTheWarden(client) +void SetTheWarden(int client) { - PrintToChatAll("Warden ~ %t", "warden_new", client); + PrintToChatAll("[SM] %t", "warden_new", client); - if(GetConVarBool(g_cVar_mnotes)) + if (g_cVar_mnotes.BoolValue) { - PrintCenterTextAll("Warden ~ %t", "warden_new", client); - PrintHintTextToAll("Warden ~ %t", "warden_new", client); + PrintCenterTextAll("%t", "warden_new", client); + PrintHintTextToAll("%t", "warden_new", client); } Warden = client; - SetEntityRenderColor(client, 0, 0, 255, 255); + SetEntityRenderColor(client, 0, 175, 255, 255); SetClientListeningFlags(client, VOICE_NORMAL); - Forward_OnWardenCreation(client); } -public RemoveTheWarden(client) +void RemoveTheWarden(int client) { - PrintToChatAll("Warden ~ %t", "warden_removed", client, Warden); - if(GetConVarBool(g_cVar_mnotes)) + PrintToChatAll("[SM] %t", "warden_removed", client, Warden); + if (g_cVar_mnotes.BoolValue) { - PrintCenterTextAll("Warden ~ %t", "warden_removed", client); - PrintHintTextToAll("Warden ~ %t", "warden_removed", client); + PrintCenterTextAll("%t", "warden_removed", client); + PrintHintTextToAll("%t", "warden_removed", client); } SetEntityRenderColor(Warden, 255, 255, 255, 255); Warden = -1; - Forward_OnWardenRemoved(client); } -public Native_ExistWarden(Handle:plugin, numParams) +public int Native_ExistWarden(Handle plugin, int numParams) { - if(Warden != -1) + if (Warden != -1) return true; return false; } -public Native_IsWarden(Handle:plugin, numParams) +public int Native_IsWarden(Handle plugin, int numParams) { - new client = GetNativeCell(1); - - if(!IsClientInGame(client) && !IsClientConnected(client)) + int client = GetNativeCell(1); + if (!IsClientInGame(client) && !IsClientConnected(client)) ThrowNativeError(SP_ERROR_INDEX, "Client index %i is invalid", client); - if(client == Warden) + if (client == Warden) return true; return false; } -public Native_SetWarden(Handle:plugin, numParams) +public int Native_SetWarden(Handle plugin, int numParams) { - new client = GetNativeCell(1); - + int client = GetNativeCell(1); if (!IsClientInGame(client) && !IsClientConnected(client)) ThrowNativeError(SP_ERROR_INDEX, "Client index %i is invalid", client); - if(Warden == -1) - { + if (Warden == -1) SetTheWarden(client); - } } -public Native_RemoveWarden(Handle:plugin, numParams) +public int Native_RemoveWarden(Handle plugin, int numParams) { - new client = GetNativeCell(1); - + int client = GetNativeCell(1); if (!IsClientInGame(client) && !IsClientConnected(client)) ThrowNativeError(SP_ERROR_INDEX, "Client index %i is invalid", client); - if(client == Warden) - { + if (client == Warden) RemoveTheWarden(client); - } } -public Forward_OnWardenCreation(client) +public void Forward_OnWardenCreation(int client) { Call_StartForward(g_fward_onBecome); Call_PushCell(client); Call_Finish(); } -public Forward_OnWardenRemoved(client) +public void Forward_OnWardenDeath(int client) +{ + Call_StartForward(g_fward_onDeath); + Call_PushCell(client); + Call_Finish(); +} + +public void Forward_OnWardenRemoved(int client) +{ + Call_StartForward(g_fward_onRemoved); + Call_PushCell(client); + Call_Finish(); +} + +public void Forward_OnWardenRemove(int client) { Call_StartForward(g_fward_onRemove); Call_PushCell(client); Call_Finish(); -} \ No newline at end of file +} \ No newline at end of file diff --git a/Warden/translations/es/warden.phrases.txt b/Warden/translations/es/warden.phrases.txt new file mode 100644 index 0000000..b3e84f9 --- /dev/null +++ b/Warden/translations/es/warden.phrases.txt @@ -0,0 +1,56 @@ +"Phrases" +{ + "warden_new" + { + "#format" "{1:N}" + "es" "{1} Es ahora el Alcáide de esta Prisión." + } + + "warden_playerdead" + { + "es" "Sólo los jugadores vivos, pueden ser el Alcáide." + } + + "warden_ctsonly" + { + "es" "Sólo los Anti-Terroristas pueden ser el Alcáide." + } + + "warden_exist" + { + "#format" "{1:N}" + "es" "Alcáide Actual: {1}" + } + + "warden_retire" + { + "#format" "{1:N}" + "es" "{1} ha decidido jubilarse. Ahora toca elegir uno nuevo." + } + + "warden_notwarden" + { + "es" "No eres el Alcáide, y no puedes jubilarte." + } + + "warden_dead" + { + "es" "El Alcáide ha muerto! Ahora toca elegir uno juevo." + } + + "warden_disconnected" + { + "es" "El Alcáide ha desertado. Ahora toca elegir uno nuevo." + } + + "warden_removed" + { + "#format" "{1:N},{2:N}" + "es" "Administrador: {1} ha prejubilado al Alcáide: {2}" + } + + "warden_noexist" + { + "es" "Actualmente no existe ningún Alcáide en la prisión." + } +} \ No newline at end of file diff --git a/Warden/translations/pt/warden.phrases.txt b/Warden/translations/pt/warden.phrases.txt new file mode 100644 index 0000000..5e3b22f --- /dev/null +++ b/Warden/translations/pt/warden.phrases.txt @@ -0,0 +1,56 @@ +"Phrases" +{ + "warden_new" + { + "#format" "{1:N}" + "pt" "{1} Agora, o diretor da prisão.." + } + + "warden_playerdead" + { + "pt" "Apenas os jogadores podem viver o diretor.." + } + + "warden_ctsonly" + { + "pt" "Apenas o diretor pode ser AntiTerrorista." + } + + "warden_exist" + { + "#format" "{1:N}" + "pt" "Atual diretor: {1}" + } + + "warden_retire" + { + "#format" "{1:N}" + "pt" "{1} o atual diretor, decidiu se aposentar. Agora começa a escolher um novo.." + } + + "warden_notwarden" + { + "pt" "Você não é o diretor, e você não pode se aposentar.." + } + + "warden_dead" + { + "pt" "O diretor está morto, agora começa a escolher um novo." + } + + "warden_disconnected" + { + "pt" "O diretor deixou o jogo. Agora começa a escolher um novo." + } + + "warden_removed" + { + "#format" "{1:N},{2:N}" + "pt" "O Administrador do: {1} o diretor se aposentou cedo: {2}" + } + + "warden_noexist" + { + "pt" "Atualmente não há carcereiro na prisão." + } +} \ No newline at end of file diff --git a/Warden/translations/sv/warden.phrases.txt b/Warden/translations/sv/warden.phrases.txt new file mode 100644 index 0000000..f9b84f6 --- /dev/null +++ b/Warden/translations/sv/warden.phrases.txt @@ -0,0 +1,56 @@ +"Phrases" +{ + "warden_new" + { + "#format" "{1:N}" + "sv" "{1} har blivit fängelsedirektör över detta fängelse." + } + + "warden_playerdead" + { + "sv" "Endast levande spelare kan bli fängelsedirektör." + } + + "warden_ctsonly" + { + "sv" "Endast Anti-Terrorister kan bli fängelsedirektör." + } + + "warden_exist" + { + "#format" "{1:N}" + "sv" "nuvarande fängelsedirektör är: {1}" + } + + "warden_retire" + { + "#format" "{1:N}" + "sv" "{1} har bestämt sig för att avgå. Ni bör nu välja en ny." + } + + "warden_notwarden" + { + "sv" "du är inte fängelsedirektören och kan därför inte avgå." + } + + "warden_dead" + { + "sv" "fängelsedirektören är död. Ni bör nu välja en ny." + } + + "warden_disconnected" + { + "sv" "fängelsedirektören har lämnat. Ni bör nu välja en ny." + } + + "warden_removed" + { + "#format" "{1:N},{2:N}" + "sv" "Admin: {1} avskedade Fängelsedirektören: {2}" + } + + "warden_noexist" + { + "sv" "det fanns ingen fängelsedirektör att avskeda." + } +} \ No newline at end of file diff --git a/Warden/translations/tr/warden.phrases.txt b/Warden/translations/tr/warden.phrases.txt new file mode 100644 index 0000000..3c7365c --- /dev/null +++ b/Warden/translations/tr/warden.phrases.txt @@ -0,0 +1,56 @@ +"Phrases" +{ + "warden_new" + { + "#format" "{1:N}" + "tr" "{1} adlı oyuncu komutçu oldu." + } + + "warden_playerdead" + { + "tr" "sadece canlı oyuncular gardiyan olabilir." + } + + "warden_ctsonly" + { + "tr" "sadece Anti-Terörist takımı komutçu olabilir." + } + + "warden_exist" + { + "#format" "{1:N}" + "tr" "Zaten komutçu var: {1}" + } + + "warden_retire" + { + "#format" "{1:N}" + "tr" "{1} emekli olmaya karar verdi. Şimdi yeni bir tane seçebilirsiniz." + } + + "warden_notwarden" + { + "tr" "sen komutçu değilsin ve bu yüzden emekli olamazsın." + } + + "warden_dead" + { + "tr" "komutçu artık öldü. Şimdi yeni bir tane seçebilirsiniz." + } + + "warden_disconnected" + { + "tr" "komutçunun bağlantısı kesildi. Şimdi yeni bir tane seçebilirsiniz." + } + + "warden_removed" + { + "#format" "{1:N},{2:N}" + "tr" "{1} adlı yönetici {2} adlı komutçuyu kovdu!" + } + + "warden_noexist" + { + "tr" "ateş edecek gardiyan yoktu." + } +} \ No newline at end of file diff --git a/Warden/translations/warden.phrases.txt b/Warden/translations/warden.phrases.txt index 5142287..fb77d98 100644 --- a/Warden/translations/warden.phrases.txt +++ b/Warden/translations/warden.phrases.txt @@ -4,89 +4,53 @@ { "#format" "{1:N}" "en" "{1} has become the warden of this prison." - "es" "{1} Es ahora el Alcáide de esta Prisión." - "pt" "{1} Agora, o diretor da prisão.." - "sv" "{1} har blivit fängelsedirektör över detta fängelse." } "warden_playerdead" { - "#format" "" "en" "only alive players may become warden." - "es" "Sólo los jugadores vivos, pueden ser el Alcáide." - "pt" "Apenas os jogadores podem viver o diretor.." - "sv" "Endast levande spelare kan bli fängelsedirektör." } "warden_ctsonly" { - "#format" "" "en" "only Counter-Terrorists may become warden." - "es" "Sólo los Anti-Terroristas pueden ser el Alcáide." - "pt" "Apenas o diretor pode ser AntiTerrorista." - "sv" "Endast Anti-Terrorister kan bli fängelsedirektör." } "warden_exist" { "#format" "{1:N}" "en" "current warden is: {1}" - "es" "Alcáide Actual: {1}" - "pt" "Atual diretor: {1}" - "sv" "nuvarande fängelsedirektör är: {1}" } "warden_retire" { "#format" "{1:N}" "en" "{1} has decided to retire. You may now choose a new one." - "es" "{1} ha decidido jubilarse. Ahora toca elegir uno nuevo." - "pt" "{1} o atual diretor, decidiu se aposentar. Agora começa a escolher um novo.." - "sv" "{1} har bestämt sig för att avgå. Ni bör nu välja en ny." } "warden_notwarden" { - "#format" "" "en" "you are not the warden and therefore may not retire." - "es" "No eres el Alcáide, y no puedes jubilarte." - "pt" "Você não é o diretor, e você não pode se aposentar.." - "sv" "du är inte fängelsedirektören och kan därför inte avgå." } "warden_dead" { - "#format" "" "en" "the warden are now dead. You may now choose a new one." - "es" "El Alcáide ha muerto! Ahora toca elegir uno juevo." - "pt" "O diretor está morto, agora começa a escolher um novo." - "sv" "fängelsedirektören är död. Ni bör nu välja en ny." } "warden_disconnected" { - "#format" "" "en" "the warden has disconnected. You may now choose a new one." - "es" "El Alcáide ha desertado. Ahora toca elegir uno nuevo." - "pt" "O diretor deixou o jogo. Agora começa a escolher um novo." - "sv" "fängelsedirektören har lämnat. Ni bör nu välja en ny." } "warden_removed" { "#format" "{1:N},{2:N}" "en" "Admin: {1} fired Warden: {2}" - "es" "Administrador: {1} ha prejubilado al Alcáide: {2}" - "pt" "O Administrador do: {1} o diretor se aposentou cedo: {2}" - "sv" "Admin: {1} avskedade Fängelsedirektören: {2}" } "warden_noexist" { - "#format" "" "en" "there was no warden to fire." - "es" "Actualmente no existe ningún Alcáide en la prisión." - "pt" "Atualmente não há carcereiro na prisão." - "sv" "det fanns ingen fängelsedirektör att avskeda." } } \ No newline at end of file