Skip to content

Commit

Permalink
fix compiler warnings (#323)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lidbetter authored Nov 27, 2022
1 parent 47144eb commit 8cc75f1
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 12 deletions.
41 changes: 31 additions & 10 deletions scripting/retakes.sp
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ public void OnMapEnd() {
}
}

public int EnabledChanged(Handle cvar, const char[] oldValue, const char[] newValue) {
public void EnabledChanged(Handle cvar, const char[] oldValue, const char[] newValue) {
bool wasEnabled = !StrEqual(oldValue, "0");
g_Enabled = !StrEqual(newValue, "0");

Expand Down Expand Up @@ -327,6 +327,8 @@ public Action Command_ScrambleTeams(int client, int args) {
g_ScrambleSignal = true;
Retakes_MessageToAll("%t", "AdminScrambleTeams", client);
}

return Plugin_Continue;
}

public Action Command_Guns(int client, int args) {
Expand Down Expand Up @@ -459,11 +461,13 @@ public Action Event_PlayerTeam(Event event, const char[] name, bool dontBroadcas
*/
public Action Event_PlayerConnectFull(Event event, const char[] name, bool dontBroadcast) {
if (!g_Enabled) {
return;
return Plugin_Continue;
}

int client = GetClientOfUserId(event.GetInt("userid"));
SetEntPropFloat(client, Prop_Send, "m_fForceTeam", 3600.0);

return Plugin_Continue;
}

/**
Expand All @@ -472,12 +476,12 @@ public Action Event_PlayerConnectFull(Event event, const char[] name, bool dontB
*/
public Action Event_PlayerSpawn(Event event, const char[] name, bool dontBroadcast) {
if (!g_Enabled) {
return;
return Plugin_Continue;
}

int client = GetClientOfUserId(event.GetInt("userid"));
if (!IsValidClient(client) || !IsOnTeam(client) || g_EditMode || Retakes_InWarmup())
return;
return Plugin_Continue;

if (!g_RoundSpawnsDecided) {
if (IsPlayer(g_BombOwner)) {
Expand All @@ -493,14 +497,15 @@ public Action Event_PlayerSpawn(Event event, const char[] name, bool dontBroadca
}

SetupPlayer(client);
return Plugin_Continue;
}

/**
* Called when a player dies - gives points to killer, and does database stuff with the kill.
*/
public Action Event_PlayerDeath(Event event, const char[] name, bool dontBroadcast) {
if (!Retakes_Live()) {
return;
return Plugin_Continue;
}

int victim = GetClientOfUserId(event.GetInt("userid"));
Expand All @@ -516,6 +521,8 @@ public Action Event_PlayerDeath(Event event, const char[] name, bool dontBroadca
g_RoundPoints[attacker] -= POINTS_KILL;
}
}

return Plugin_Continue;
}

/**
Expand Down Expand Up @@ -543,25 +550,29 @@ public Action Event_DamageDealt(Event event, const char[] name, bool dontBroadca
*/
public Action Event_BombPlant(Event event, const char[] name, bool dontBroadcast) {
if (!g_Enabled) {
return;
return Plugin_Continue;
}

g_bombPlanted = true;
g_bombPlantSignal = false;

return Plugin_Continue;
}

/**
* Called when the bomb explodes or is defused, gives ponts to the one that planted/defused it.
*/
public Action Event_Bomb(Event event, const char[] name, bool dontBroadcast) {
if (!Retakes_Live()) {
return;
return Plugin_Continue;
}

int client = GetClientOfUserId(event.GetInt("userid"));
if (IsValidClient(client)) {
g_RoundPoints[client] += POINTS_BOMB;
}

return Plugin_Continue;
}

/**
Expand All @@ -570,7 +581,7 @@ public Action Event_Bomb(Event event, const char[] name, bool dontBroadcast) {
*/
public Action Event_RoundPreStart(Event event, const char[] name, bool dontBroadcast) {
if (!Retakes_Live()) {
return;
return Plugin_Continue;
}

g_RoundSpawnsDecided = false;
Expand All @@ -593,11 +604,13 @@ public Action Event_RoundPreStart(Event event, const char[] name, bool dontBroad
g_BombOwner = player;
}
delete ts;

return Plugin_Continue;
}

public Action Event_RoundPostStart(Event event, const char[] name, bool dontBroadcast) {
if (!Retakes_Live()) {
return;
return Plugin_Continue;
}

if (!g_EditMode) {
Expand All @@ -606,6 +619,8 @@ public Action Event_RoundPostStart(Event event, const char[] name, bool dontBroa
}

g_bombPlanted = false;

return Plugin_Continue;
}

/**
Expand All @@ -615,14 +630,16 @@ public Action Event_RoundFreezeEnd(Event event, const char[] name, bool dontBroa
for (int i = 1; i <= MaxClients; i++) {
g_RoundPoints[i] = 0;
}

return Plugin_Continue;
}

/**
* Round end event, calls the appropriate winner (T/CT) unction and sets the scores.
*/
public Action Event_RoundEnd(Event event, const char[] name, bool dontBroadcast) {
if (!Retakes_Live()) {
return;
return Plugin_Continue;
}

if (g_ActivePlayers >= 2) {
Expand Down Expand Up @@ -662,11 +679,15 @@ public Action Event_RoundEnd(Event event, const char[] name, bool dontBroadcast)
CounterTerroristsWon();
}
}

return Plugin_Continue;
}

public Action Event_HalfTime(Event event, const char[] name, bool dontBroadcast)
{
g_HalfTime = true;

return Plugin_Continue;
}

/***********************
Expand Down
4 changes: 4 additions & 0 deletions scripting/retakes/editor_menus.sp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ public int EditorMenuHandler(Menu menu, MenuAction action, int param1, int param
} else if (action == MenuAction_End) {
delete menu;
}

return 0;
}

public void GiveNewSpawnMenu(int client) {
Expand Down Expand Up @@ -123,6 +125,8 @@ public int GiveNewSpawnMenuHandler(Menu menu, MenuAction action, int param1, int
} else if (action == MenuAction_End) {
delete menu;
}

return 0;
}

public SpawnType NextSpawnType(SpawnType type) {
Expand Down
15 changes: 13 additions & 2 deletions scripting/retakes/natives.sp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public int Native_RetakeMessage(Handle plugin, int numParams) {
char prefix[64];

g_MessagePrefix.GetString(prefix, sizeof(prefix));
Format(finalMsg, sizeof(finalMsg), " %s %s", prefix, buffer);
int finalBytesWritten = Format(finalMsg, sizeof(finalMsg), " %s %s", prefix, buffer);

if (client == 0) {
Colorize(finalMsg, sizeof(finalMsg), true);
Expand All @@ -58,6 +58,7 @@ public int Native_RetakeMessage(Handle plugin, int numParams) {
PrintToChat(client, finalMsg);
}

return finalBytesWritten;
}

public int Native_RetakeMessageToAll(Handle plugin, int numParams) {
Expand All @@ -68,7 +69,7 @@ public int Native_RetakeMessageToAll(Handle plugin, int numParams) {

g_MessagePrefix.GetString(prefix, sizeof(prefix));
FormatNativeString(0, 1, 2, sizeof(buffer), bytesWritten, buffer);
Format(finalMsg, sizeof(finalMsg), " %s %s", prefix, buffer);
int finalBytesWritten = Format(finalMsg, sizeof(finalMsg), " %s %s", prefix, buffer);
Colorize(finalMsg, sizeof(finalMsg), true);
PrintToConsole(0, finalMsg);

Expand All @@ -81,6 +82,8 @@ public int Native_RetakeMessageToAll(Handle plugin, int numParams) {
PrintToChat(i, finalMsg);
}
}

return finalBytesWritten + sizeof(prefix) - 1;
}

public int Native_GetNumActiveTs(Handle plugin, int numParams) {
Expand Down Expand Up @@ -110,13 +113,17 @@ public int Native_SetRoundPoints(Handle plugin, int numParams) {
CHECK_CONNECTED(client);
int points = GetNativeCell(2);
g_RoundPoints[client] = points;

return 0;
}

public int Native_ChangeRoundPoints(Handle plugin, int numParams) {
int client = GetNativeCell(1);
CHECK_CONNECTED(client);
int dp = GetNativeCell(2);
g_RoundPoints[client] += dp;

return 0;
}

public int Native_GetPlayerInfo(Handle plugin, int numParams) {
Expand All @@ -130,6 +137,8 @@ public int Native_GetPlayerInfo(Handle plugin, int numParams) {
SetNativeCellRef(6, g_PlayerArmor[client]);
SetNativeCellRef(7, g_PlayerHelmet[client]);
SetNativeCellRef(8, g_PlayerKit[client]);

return 0;
}

public int Native_SetPlayerInfo(Handle plugin, int numParams) {
Expand All @@ -144,6 +153,8 @@ public int Native_SetPlayerInfo(Handle plugin, int numParams) {
g_PlayerArmor[client] = GetNativeCell(6);
g_PlayerHelmet[client] = GetNativeCell(7);
g_PlayerKit[client] = GetNativeCell(8);

return 0;
}

public int Native_GetRetakeRoundsPlayed(Handle plugin, int numParams) {
Expand Down
2 changes: 2 additions & 0 deletions scripting/retakes/spawns.sp
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ public Action Timer_StartPlant(Handle timer, int client) {
if (IsPlayer(client)) {
g_bombPlantSignal = true;
}

return Plugin_Continue;
}

public bool InsideBombSite(float vec[3]) {
Expand Down

0 comments on commit 8cc75f1

Please sign in to comment.