Skip to content

Commit

Permalink
Updated to v2.0.5
Browse files Browse the repository at this point in the history
- Added: New R8 weapon.
- Added: Hide radar for all players.
- Fixed: Incorrect ammo for shared weapon names.
- Fixed: Welcome message not working.
  • Loading branch information
Maxximou5 authored and Maxximou5 committed Dec 11, 2015
1 parent 9aec084 commit 15bc5b0
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 54 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
v2.0.5:
- Added: New R8 weapon.
- Added: Hide radar for all players.
- Fixed: Incorrect ammo for shared weapon names.
- Fixed: Welcome message not working.

v2.0.4d:
- Fixed: Chest armor not working if full armor wasn't selected, thanks to sk1ll.

Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### [CS:GO] Deathmatch (v2.0.4d, 2015-09-23)
### [CS:GO] Deathmatch (v2.0.5, 2015-12-11)
<a href="http://www.maxximou5.com/"><img src="http://maxximou5.com/sourcemod/assests/img/deathmatch_csgo.png" alt="csgo deathmatch plugin" width="600" /></a>
===============

Expand All @@ -17,6 +17,7 @@ Enables deathmatch style gameplay (respawning, gun selection, spawn protection,
- Spawn Editor and Menu
- Replenish Ammo & Clip
- Replenish Grenades
- Hide Radar for Players
- Kill Reward (HP/Ammo/Grenades)
- Line of Sight Spawning
- 3rd Party Knife Plugin Support
Expand Down Expand Up @@ -47,6 +48,7 @@ Enables deathmatch style gameplay (respawning, gun selection, spawn protection,
- dm_enabled - (Default) 1 - Enable deathmatch.
- dm_welcomemsg (Default) 1 - Display a message saying that your server is running Deathmatch.
- dm_free_for_all - (Default) 0 - Free for all mode.
- dm_hide_radar - (Default) 0 - Hides the radar from players.
- dm_display_panel - (Default) 0 - Display a panel showing health of the victim.
- dm_display_panel_damage - (Default) 0 - Display a panel showing damage done to a player.
- dm_headshot_only - (Default) 0 - Headshot Only mode.
Expand Down Expand Up @@ -90,7 +92,7 @@ Enables deathmatch style gameplay (respawning, gun selection, spawn protection,

This plugin is tested on the following Sourcemod & Metamod Versions.

- <a href="http://www.sourcemod.net/snapshots.php">Sourcemod 1.6.3+</a>
- <a href="http://www.sourcemod.net/snapshots.php">Sourcemod 1.7.3+</a>
- <a href="http://www.sourcemm.net/snapshots">Metamod 1.10.4+</a>

### Requirements
Expand Down
6 changes: 6 additions & 0 deletions configs/deathmatch/deathmatch.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
// Default: no
"dm_free_for_all" "no"

// Hides the radar from players.
// --
// Default: no
"dm_hide_radar" "no"

// Display a panel showing health of the victim.
// --
// Default: "no"
Expand Down Expand Up @@ -209,6 +214,7 @@
"weapon_usp_silencer" "-1"
"weapon_fiveseven" "-1"
"weapon_deagle" "-1"
"weapon_revolver" "-1"
"weapon_elite" "-1"
"weapon_tec9" "-1"
"weapon_hkp2000" "-1"
Expand Down
Binary file modified deathmatch.zip
Binary file not shown.
Binary file modified plugins/deathmatch.smx
Binary file not shown.
93 changes: 54 additions & 39 deletions scripting/deathmatch.sp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#undef REQUIRE_PLUGIN
#include <updater>

#define PLUGIN_VERSION "2.0.4d"
#define PLUGIN_VERSION "2.0.5"
#define PLUGIN_NAME "Deathmatch"
#define UPDATE_URL "http://www.maxximou5.com/sourcemod/deathmatch/update.txt"

Expand Down Expand Up @@ -79,6 +79,7 @@ new backup_ammo_grenade_limit_total;
new Handle:cvar_dm_enabled;
new Handle:cvar_dm_welcomemsg;
new Handle:cvar_dm_free_for_all;
new Handle:cvar_dm_hide_radar;
new Handle:cvar_dm_display_panel;
new Handle:cvar_dm_display_panel_damage;
new Handle:cvar_dm_headshot_only;
Expand Down Expand Up @@ -121,6 +122,7 @@ new Handle:cvar_dm_nades_smoke;
new bool:enabled = false;
new bool:welcomemsg;
new bool:ffa;
new bool:hideradar;
new bool:displayPanel;
new bool:displayPanelDamage;
new bool:hsOnly;
Expand Down Expand Up @@ -194,6 +196,7 @@ new lastEditorSpawnPoint[MAXPLAYERS + 1] = { -1, ... };
new String:primaryWeapon[MAXPLAYERS + 1][24];
new String:secondaryWeapon[MAXPLAYERS + 1][24];
new infoMessageCount[MAXPLAYERS + 1] = { 3, ... };
new bool:WelcomeMsgd[MAXPLAYERS + 1] = { false, ... };
new bool:firstWeaponSelection[MAXPLAYERS + 1] = { true, ... };
new bool:weaponsGivenThisRound[MAXPLAYERS + 1] = { false, ... };
new bool:newWeaponsSelected[MAXPLAYERS + 1] = { false, ... };
Expand Down Expand Up @@ -282,6 +285,7 @@ public OnPluginStart()
cvar_dm_enabled = CreateConVar("dm_enabled", "1", "Enable Deathmatch.");
cvar_dm_welcomemsg = CreateConVar("dm_welcomemsg", "1", "Display a message saying that your server is running Deathmatch.");
cvar_dm_free_for_all = CreateConVar("dm_free_for_all", "0", "Free for all mode.");
cvar_dm_hide_radar = CreateConVar("dm_hide_radar", "0", "Hides the radar from players.");
cvar_dm_display_panel = CreateConVar("dm_display_panel", "0", "Display a panel showing health of the victim.");
cvar_dm_display_panel_damage = CreateConVar("dm_display_panel_damage", "0", "Display a panel showing damage done to a player.");
cvar_dm_headshot_only = CreateConVar("dm_headshot_only", "0", "Headshot only mode.");
Expand Down Expand Up @@ -334,6 +338,7 @@ public OnPluginStart()
HookConVarChange(cvar_dm_enabled, Event_CvarChange);
HookConVarChange(cvar_dm_welcomemsg, Event_CvarChange);
HookConVarChange(cvar_dm_free_for_all, Event_CvarChange);
HookConVarChange(cvar_dm_hide_radar, Event_CvarChange);
HookConVarChange(cvar_dm_display_panel, Event_CvarChange);
HookConVarChange(cvar_dm_display_panel_damage, Event_CvarChange);
HookConVarChange(cvar_dm_headshot_only, Event_CvarChange);
Expand Down Expand Up @@ -505,22 +510,17 @@ public OnClientPostAdminCheck(client)
{
if (enabled)
{
if (welcomemsg)
{
CreateTimer(10.0, Timer_WelcomeMsg, GetClientUserId(client));
}
ResetClientSettings(client);
}
}

public Action:Timer_WelcomeMsg(Handle:timer, any:client)
{
if (IsClientInGame(client) && !IsFakeClient(client))
if (IsClientValid(client) && !IsFakeClient(client))
{
PrintHintText(client, "This server is running:\n <font color='#FF0000'>Deathmatch</font> Version <font color='#00FF00'>%s</font>", PLUGIN_VERSION);
//CPrintToChat(client, "[\x04WELCOME\x01] This server is running \x04Deathmatch \x01v%s, PLUGIN_VERSION");
PrintHintText(client, "This server is running:\n <font color='#00FF00'>Deathmatch</font> v%s", PLUGIN_VERSION);
CPrintToChat(client, "[\x04DM\x01] This server is running \x04Deathmatch \x01v%s", PLUGIN_VERSION);
}
return Plugin_Stop;
}

public OnClientDisconnect(client)
Expand Down Expand Up @@ -618,6 +618,10 @@ LoadConfig()
value = (StrEqual(value, "yes")) ? "1" : "0";
SetConVarString(cvar_dm_free_for_all, value);

KvGetString(keyValues, "dm_hide_radar", value, sizeof(value), "no");
value = (StrEqual(value, "yes")) ? "1" : "0";
SetConVarString(cvar_dm_hide_radar, value);

KvGetString(keyValues, "dm_display_panel", value, sizeof(value), "no");
value = (StrEqual(value, "yes")) ? "1" : "0";
SetConVarString(cvar_dm_display_panel, value);
Expand Down Expand Up @@ -811,6 +815,7 @@ UpdateState()
enabled = GetConVarBool(cvar_dm_enabled);
welcomemsg = GetConVarBool(cvar_dm_welcomemsg);
ffa = GetConVarBool(cvar_dm_free_for_all);
hideradar = GetConVarBool(cvar_dm_hide_radar);
displayPanel = GetConVarBool(cvar_dm_display_panel);
displayPanelDamage = GetConVarBool(cvar_dm_display_panel_damage);
hsOnly = GetConVarBool(cvar_dm_headshot_only);
Expand Down Expand Up @@ -1128,6 +1133,7 @@ BuildWeaponMenuNames()
SetTrieString(weaponMenuNames, "weapon_usp_silencer", "USP-S");
SetTrieString(weaponMenuNames, "weapon_fiveseven", "Five-SeveN");
SetTrieString(weaponMenuNames, "weapon_deagle", "Desert Eagle");
SetTrieString(weaponMenuNames, "weapon_revolver", "R8");
SetTrieString(weaponMenuNames, "weapon_elite", "Dual Berettas");
SetTrieString(weaponMenuNames, "weapon_tec9", "Tec-9");
SetTrieString(weaponMenuNames, "weapon_hkp2000", "P2000");
Expand Down Expand Up @@ -1202,8 +1208,13 @@ public Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)

if (Teams:GetClientTeam(client) > TeamSpectator)
{
if (welcomemsg && WelcomeMsgd[client] == false)
{
CreateTimer(2.0, Timer_WelcomeMsg, client);
WelcomeMsgd[client] = true;
}
// Hide radar.
if (ffa)
if (ffa || hideradar)
{
CreateTimer(0.0, RemoveRadar, client);
}
Expand Down Expand Up @@ -1807,22 +1818,20 @@ DoClipRefillAmmo(weaponRef, any:client)
if (IsValidEdict(weaponEntity))
{
decl String:weaponName[35];
GetEntityClassname(weaponEntity, weaponName, sizeof(weaponName));

decl String:clipSize;
decl String:maxAmmoCount;
new ammoType = GetEntData(weaponEntity, ammoTypeOffset);

// TODO: Not sure how to avoid this hack considering the game thinks the
// cz is a weapon_p250 and both the m4a4 and m4a1 are weapon_m4a1.
if (ammoType == 4 && StrEqual(weaponName, "weapon_m4a1"))
{
clipSize = 20;
}
else
if (GetEntityClassname(weaponEntity, weaponName, sizeof(weaponName)))
{
clipSize = GetWeaponAmmoCount(weaponName, true);
maxAmmoCount = GetWeaponAmmoCount(weaponName, false);
switch (GetEntProp(weaponRef, Prop_Send, "m_iItemDefinitionIndex"))
{
case 60: clipSize = 20;
case 61: clipSize = 12;
case 63: clipSize = 12;
case 64: clipSize = 8;
}
}

SetEntData(client, ammoOffset, maxAmmoCount, true);
Expand All @@ -1837,20 +1846,19 @@ DoResRefillAmmo(weaponRef, any:client)
if (IsValidEdict(weaponEntity))
{
decl String:weaponName[35];
GetEntityClassname(weaponEntity, weaponName, sizeof(weaponName));

decl String:maxAmmoCount;
new ammoType = GetEntData(weaponEntity, ammoTypeOffset);

// TODO: Not sure how to avoid this hack considering the game thinks the
// cz is a weapon_p250 and both the m4a4 and m4a1 are weapon_m4a1.
if (ammoType == 4 && StrEqual(weaponName, "weapon_m4a1"))
{
maxAmmoCount = 40;
}
else
if (GetEntityClassname(weaponEntity, weaponName, sizeof(weaponName)))
{
maxAmmoCount = GetWeaponAmmoCount(weaponName, false);
switch (GetEntProp(weaponRef, Prop_Send, "m_iItemDefinitionIndex"))
{
case 60: maxAmmoCount = 40;
case 61: maxAmmoCount = 24;
case 63: maxAmmoCount = 12;
case 64: maxAmmoCount = 8;
}
}

SetEntData(client, ammoOffset + (ammoType * 4), maxAmmoCount, true);
Expand All @@ -1864,23 +1872,21 @@ DoFullRefillAmmo(weaponRef, any:client)
if (IsValidEdict(weaponEntity))
{
decl String:weaponName[35];
GetEntityClassname(weaponEntity, weaponName, sizeof(weaponName));

decl String:clipSize;
decl String:maxAmmoCount;
new ammoType = GetEntData(weaponEntity, ammoTypeOffset);

// TODO: Not sure how to avoid this hack considering the game thinks the
// The m4a4 and m4a1 are weapon_m4a1.
if (ammoType == 4 && StrEqual(weaponName, "weapon_m4a1"))
{
clipSize = 20;
maxAmmoCount = 40;
}
else
if (GetEntityClassname(weaponEntity, weaponName, sizeof(weaponName)))
{
clipSize = GetWeaponAmmoCount(weaponName, true);
maxAmmoCount = GetWeaponAmmoCount(weaponName, false);
switch (GetEntProp(weaponRef, Prop_Send, "m_iItemDefinitionIndex"))
{
case 60: { clipSize = 20;maxAmmoCount = 40; }
case 61: { clipSize = 12;maxAmmoCount = 24; }
case 63: { clipSize = 12;maxAmmoCount = 12; }
case 64: { clipSize = 8;maxAmmoCount = 8; }
}
}

SetEntData(client, ammoOffset + (ammoType * 4), maxAmmoCount, true);
Expand Down Expand Up @@ -1943,6 +1949,8 @@ stock GetWeaponAmmoCount(String:weaponName[], bool:currentClip)
return currentClip ? 20 : 100;
else if (StrEqual(weaponName, "weapon_deagle"))
return currentClip ? 7 : 35;
else if (StrEqual(weaponName, "weapon_revolver"))
return currentClip ? 8 : 8;
else if (StrEqual(weaponName, "weapon_hkp2000"))
return currentClip ? 13 : 52;
else if (StrEqual(weaponName, "weapon_usp_silencer"))
Expand Down Expand Up @@ -2182,6 +2190,12 @@ GiveSavedWeapons(client, bool:primary, bool:secondary)
{
if (!StrEqual(secondaryWeapon[client], "none"))
{
new entityIndex = GetPlayerWeaponSlot(client, _:SlotKnife);
if (entityIndex != -1)
{
RemovePlayerItem(client, entityIndex);
AcceptEntityInput(entityIndex, "Kill");
}
if (StrEqual(secondaryWeapon[client], "random"))
{
// Select random menu item (excluding "Random" option)
Expand All @@ -2194,6 +2208,7 @@ GiveSavedWeapons(client, bool:primary, bool:secondary)
{
GivePlayerItem(client, secondaryWeapon[client]);
}
GivePlayerItem(client, "weapon_knife");
}
if (zeus)
GivePlayerItem(client, "weapon_taser");
Expand Down
20 changes: 7 additions & 13 deletions update.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,19 @@
{
"Version"
{
"Latest" "2.0.4d"
"Previous" "2.0.4c"
"Latest" "2.0.5"
"Previous" "2.0.4d"
}

"Notes" "Changes in 2.0.4d:"
"Notes" "Fixed: Chest armor not working if full armor wasn't selected, thanks to sk1ll."
"Notes" "Changes in 2.0.5:"
"Notes" "Added: New R8 weapon."
"Notes" "Added: Hide radar for all players."
"Notes" "Fixed: Incorrect ammo for shared weapon names."
"Notes" "Fixed: Welcome message not working."
}

"Files"
{

"Patch"
{
"Plugin" "Path_SM/plugins/deathmatch.smx"
"Plugin" "Path_SM/translations/deathmatch.phrases.txt"

"Source" "Path_SM/scripting/deathmatch.sp"
}

"Plugin" "Path_SM/plugins/deathmatch.smx"
"Plugin" "Path_SM/configs/deathmatch/deathmatch.ini"
"Plugin" "Path_SM/translations/deathmatch.phrases.txt"
Expand Down

0 comments on commit 15bc5b0

Please sign in to comment.