Skip to content

Commit

Permalink
1.2.3 (006)
Browse files Browse the repository at this point in the history
Fixed issues with beacon during player freeday.
Added a info-box during HnS.

Not including french translation.
  • Loading branch information
jonteohr committed Jul 6, 2017
1 parent d4a6702 commit 0e06dd3
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 10 deletions.
Binary file modified addons/sourcemod/plugins/cmenu.smx
Binary file not shown.
38 changes: 29 additions & 9 deletions addons/sourcemod/scripting/cmenu.sp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <eskojbwarden>
#undef REQUIRE_PLUGIN

#define VERSION "1.2.2 (015)"
#define VERSION "1.2.3 (006)"

#define CHOICE1 "#choice1"
#define CHOICE2 "#choice2"
Expand Down Expand Up @@ -128,8 +128,6 @@ public OnPluginStart() {

noblock = FindConVar("mp_solid_teammates");

// CSetPrefix("[{blue}WardenMenu{default}]"); ## To be tested later on ##

RegAdminCmd("sm_abortgames", sm_abortgames, ADMFLAG_BAN);
RegConsoleCmd("sm_cmenu", sm_cmenu);
RegConsoleCmd("sm_wmenu", sm_cmenu);
Expand Down Expand Up @@ -200,7 +198,7 @@ public void OnRoundStart(Event event, const char[] name, bool dontBroadcast) {
aliveTerrorists = 0;
for(new i = 1; i <= MaxClients; i++) {
if(ClientHasFreeday(i)) {
RemoveClientFreeday(i);
RemoveClientFreeday(i, false);
}
if(IsClientInGame(i)) {
if(GetClientTeam(i) == CS_TEAM_T && IsPlayerAlive(i)) {
Expand All @@ -214,7 +212,7 @@ public void OnMapStart() {
abortGames();
for(new i = 1; i <= MaxClients; i++) {
if(ClientHasFreeday(i)) {
RemoveClientFreeday(i);
RemoveClientFreeday(i, false);
}
if(IsClientInGame(i)) {
if(GetClientTeam(i) == CS_TEAM_T && IsPlayerAlive(i)) {
Expand Down Expand Up @@ -457,7 +455,7 @@ public int playerFreedayHandler(Menu menu, MenuAction action, int client, int pa
GiveClientFreeday(target);
CPrintToChatAll("%s %t", cmenuPrefix, "Player Freeday Announce", target);
} else {
RemoveClientFreeday(target);
RemoveClientFreeday(target, true);
CPrintToChatAll("%s %t", cmenuPrefix, "Player Freeday Removed", target);
}

Expand Down Expand Up @@ -880,32 +878,51 @@ public void abortGames() {
public void initHns(int client, int winners) {
if(hnsWinners != 0 || hnsWinners <= 2) {
if(cvHnSTimes.IntValue == 0) {
PrintHintTextToAll("%t", "HnS Begun");
CPrintToChatAll("{blue}-----------------------------------------------------");
CPrintToChatAll("%s %t", cmenuPrefix, "HnS Begun");
CPrintToChatAll("%s %t", cmenuPrefix, "Amount of Winners", hnsWinners);
CPrintToChatAll("{blue}-----------------------------------------------------");
hnsActive = 1;
IsGameActive = true;
CreateTimer(0.5, HnSInfo, _, TIMER_REPEAT);
} else if(cvHnSTimes.IntValue != 0 && hnsTimes >= cvHnSTimes.IntValue) {

CPrintToChat(client, "%s %t", cmenuPrefix, "Too many hns", hnsTimes, cvHnSTimes.IntValue);

} else if(cvHnSTimes.IntValue != 0 && hnsTimes < cvHnSTimes.IntValue) {
PrintHintTextToAll("%t", "HnS Begun");
CPrintToChatAll("{blue}-----------------------------------------------------");
CPrintToChatAll("%s %t", cmenuPrefix, "HnS Begun");
CPrintToChatAll("%s %t", cmenuPrefix, "Amount of Winners", hnsWinners);
CPrintToChatAll("{blue}-----------------------------------------------------");
hnsActive = 1;
IsGameActive = true;
hnsTimes++;
CreateTimer(0.5, HnSInfo, _, TIMER_REPEAT);
}
} else {
CPrintToChat(client, "%s {red}%t", cmenuPrefix, "No Winners Selected");
}
}

public void OnHnsOver() {
PrintHintTextToAll("%t", "Small HNS Over");
}

public Action HnSInfo(Handle timer) {
if(IsHnsActive()) {
char msg1[64];
Format(msg1, sizeof(msg1), "%t", "Contesters Left", aliveTerrorists);

char msg2[64];
Format(msg2, sizeof(msg2), "%t", "HnS Winners Info", hnsWinners);

PrintHintTextToAll("%s\n%s", msg1, msg2);
return Plugin_Continue;
}

return Plugin_Continue;
}

public void initFreeday(int client) {

/*
Expand Down Expand Up @@ -1138,10 +1155,13 @@ public int Native_GiveClientFreeday(Handle plugin, int numParams) {

public int Native_RemoveClientFreeday(Handle plugin, int numParams) {
int client = GetNativeCell(1);
bool beacon = GetNativeCell(2);

if(IsClientInGame(client)) {
clientFreeday[client] = 0;
ServerCommand("sm_beacon %N", client);
if(beacon) {
ServerCommand("sm_beacon %N", client);
}
return true;
}

Expand Down
3 changes: 2 additions & 1 deletion addons/sourcemod/scripting/include/cmenu.inc
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ native bool GiveClientFreeday(int client);
* Remove a client's freeday
*
* @param client index
* @param set a beacon
* @return true if successful
*/
native bool RemoveClientFreeday(int client);
native bool RemoveClientFreeday(int client, bool beacon);
23 changes: 23 additions & 0 deletions addons/sourcemod/translations/cmenu.phrases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -375,4 +375,27 @@
"fr" "Il reste {1} joueurs dans la compétition"
}

"Contesters Left"
{
"#format" "{1:d}"
"en" "<font color='#41A0F4'><i>Contesters left:</i></font> {1}"
"sv" "<font color='#41A0F4'><i>Deltagare kvar:</i></font> {1}"
"fr" ""
}

"HnS Winners Info"
{
"#format" "{1:d}"
"en" "<font color='#BA80F0'><b>{1} winners</b></font>"
"sv" "<font color='#BA80F0'><b>{1} vinnare</b></font>"
"fr" ""
}

"Small HNS Over"
{
"en" "<font color='#42f456'><b>HnS is over!</b></font>"
"sv" "<font color='#42f456'><b>HnS är över!</b></font>"
"fr" ""
}

}

0 comments on commit 0e06dd3

Please sign in to comment.