Raised This Month: $12 Target: $400
 3% 

DoD:S GunGame 0.4 (Updated 08/05)


Post New Thread Reply   
 
Thread Tools Display Modes
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 07-26-2008 , 15:55   Re: DoD:S GunGame (Updated 07/26)
Reply With Quote #21

Well, I just updated it. Mostly bug fixes, so can't really be bothered to list everything. Still working on being able to disable Turbo mode, almost done
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.
DJ Tsunami is offline
menotyou
Member
Join Date: Jul 2008
Old 07-26-2008 , 16:19   Re: DoD:S GunGame (Updated 07/26)
Reply With Quote #22

on it any way to make the round end when top level is reached.
__________________
menotyou is offline
DJ Tsunami
DJ Post Spammer
Join Date: Feb 2008
Location: The Netherlands
Old 07-26-2008 , 16:39   Re: DoD:S GunGame (Updated 07/26)
Reply With Quote #23

It already ends the map when someone wins. Anyway, I just played this version, but it seems it sometimes removes the wrong weapons leaving you with only a shovel. Can anyone else confirm this? It also doesn't count suicides anymore, but I already fixed that in my local version.

Edit: ok, probably fixed now.
__________________
Advertisements | REST in Pawn - HTTP client for JSON REST APIs
Please do not PM me with questions. Post in the plugin thread.

Last edited by DJ Tsunami; 07-26-2008 at 17:51.
DJ Tsunami is offline
bulletsponge
Junior Member
Join Date: Jul 2008
Old 07-26-2008 , 17:58   Re: DoD:S GunGame (Updated 07/26)
Reply With Quote #24

Quote:
Originally Posted by menotyou View Post
on it any way to make the round end when top level is reached.
I have the same problem, when someone gets to the top level they run around with no weapons. Would changing any of the cvar settings fix this?

sm_gungame_enabled 1
sm_gungame_handicap 1
sm_gungame_spade 1
sm_gungame_spadepro 1

Also, if you guys have dod_equip.smx loaded you may want to unload it because additional weapons and ammo will become available in gun game when you reach the class you selected.

You can add the following to a gungame.cfg file to save sometime...

sm plugins unload dod_equip.smx
bulletsponge is offline
link1305
New Member
Join Date: May 2008
Old 07-26-2008 , 18:02   Re: DoD:S GunGame (Updated 07/26)
Reply With Quote #25

I get this error when I spawn:

Code:
L 07/26/2008 - 18:00:32: [SM] Plugin encountered error 4: Invalid parameter or p
arameter type
L 07/26/2008 - 18:00:32: [SM] Native "PrintToChat" reported: Language phrase "We
apon Level" not found
L 07/26/2008 - 18:00:32: [SM] Displaying call stack trace for plugin "dod_gungam
e.smx":
L 07/26/2008 - 18:00:32: [SM]   [0]  Line 227, D:\Games\Steam\steamapps\erikmine
kus\source 2007 dedicated server\tf\addons\sourcemod\scripting\dod_gungame.sp::G
iveWeapon()
L 07/26/2008 - 18:00:32: [SM]   [1]  Line 184, D:\Games\Steam\steamapps\erikmine
kus\source 2007 dedicated server\tf\addons\sourcemod\scripting\dod_gungame.sp::T
imer_GiveWeapon()
I've tried it with sourcemod 1.0.3 and 1.0.4b. I spawn with the correct gun, but nothing is printed to the chat.

Last edited by link1305; 07-26-2008 at 18:04.
link1305 is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 07-26-2008 , 18:14   Re: DoD:S GunGame (Updated 07/26)
Reply With Quote #26

Did you upload the translation file to your server?
bl4nk is offline
link1305
New Member
Join Date: May 2008
Old 07-26-2008 , 20:22   Re: DoD:S GunGame (Updated 07/26)
Reply With Quote #27

Yes, all 3 files are there.
link1305 is offline
dirtyjob
Senior Member
Join Date: Jul 2007
Location: Boston,MA
Old 07-27-2008 , 00:40   Re: DoD:S GunGame (Updated 07/26)
Reply With Quote #28

with the latest version:

Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#define PL_VERSION "0.2"
public Plugin:myinfo = {
 name        = "DoD:S GunGame",
 author      = "Tsunami",
 description = "DoD:S GunGame for SourceMod",
 version     = PL_VERSION,
 url         = "http://www.tsunami-productions.nl"
}
new g_iAmmo[MAXPLAYERS + 1];
new g_iAmount[MAXPLAYERS + 1];
new g_iClip;
new g_iLevel[MAXPLAYERS + 1]    = {1, ...};
new g_iLevels;
new g_iMaxClients;
new g_iOldLevel[MAXPLAYERS + 1] = {1, ...};
new g_iWeapon[MAXPLAYERS + 1];
new bool:g_bEnabled             = true;
new Float:g_fPosition[MAXPLAYERS + 1][3];
new Handle:g_hEnabled;
new Handle:g_hHandicap;
new Handle:g_hNextMap;
new Handle:g_hSpade;
new Handle:g_hSpadePro;
new Handle:g_hTurbo;
new String:g_sPrefix[24]        = "\x01[\x04GunGame\x01] ";
new String:g_sSoundJoin[PLATFORM_MAX_PATH];
new String:g_sSoundLevelUp[PLATFORM_MAX_PATH];
new String:g_sSoundLevelDown[PLATFORM_MAX_PATH];
new String:g_sSoundLevelSteal[PLATFORM_MAX_PATH];
new String:g_sSoundWin[PLATFORM_MAX_PATH];
new String:g_sWeapon[MAXPLAYERS + 1][24];
public OnPluginStart() {
 CreateConVar("sm_gungame_version", PL_VERSION, "DoD:S GunGame for SourceMod", FCVAR_PLUGIN|FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY);
 g_hEnabled  = CreateConVar("sm_gungame_enabled",  "1", "Enable/disable DoD:S GunGame.",                   FCVAR_PLUGIN);
 g_hHandicap = CreateConVar("sm_gungame_handicap", "1", "Enable/disable Handicap mode in DoD:S GunGame.",  FCVAR_PLUGIN);
 g_hSpade    = CreateConVar("sm_gungame_spade",    "1", "Enable/disable spades in DoD:S GunGame.",         FCVAR_PLUGIN);
 g_hSpadePro = CreateConVar("sm_gungame_spadepro", "1", "Enable/disable Spade Pro mode in DoD:S GunGame.", FCVAR_PLUGIN);
 g_hTurbo    = CreateConVar("sm_gungame_turbo",    "1", "Enable/disable Turbo mode in DoD:S GunGame.",     FCVAR_PLUGIN);
 g_hNextMap  = FindConVar("sm_nextmap");
 g_iClip     = FindSendPropInfo("CBaseCombatWeapon", "m_iClip1");
 
 HookConVarChange(g_hEnabled, ConVarChange_Enabled);
 HookEvent("dod_round_start", Event_RoundStart);
 HookEvent("player_death",    Event_PlayerDeath);
 HookEvent("player_spawn",    Event_PlayerSpawn);
 RegConsoleCmd("drop",        Command_Drop, "Block weapons from being dropped in DoD:S GunGame.");
 RegConsoleCmd("slot1",       Command_Slot, "Switch weapon when Turbo mode is disabled in DoD:S GunGame.");
 LoadTranslations("gungame.phrases");
}
public OnMapStart() {
 g_iMaxClients  = GetMaxClients();
 
 LoadConfig();
}
public OnGameFrame() {
 if (g_bEnabled) {
  for (new i = 1, iAmmo, iAmount; i <= g_iMaxClients; i++) {
   if (IsClientInGame(i) && IsPlayerAlive(i)) {
    iAmmo     = g_iAmmo[GetLevel(i)], iAmount = g_iAmount[i];
    if (iAmmo > 0 && GetEntData(i, iAmmo) <= iAmount) {
     SetEntData(i, iAmmo, iAmount * 2, _, true);
    }
   }
  }
 }
}
public OnClientPostAdminCheck(client) {
 if (g_bEnabled && !StrEqual(g_sSoundJoin, "")) {
  EmitSoundToClient(client, g_sSoundJoin);
 }
 new iClients = GetTeamClientCount(2) + GetTeamClientCount(3), iLevel = 0;
 if (GetConVarBool(g_hHandicap) && iClients > 0) {
  for (new i   = 1; i <= g_iMaxClients; i++) {
   if (IsClientInGame(i) && GetClientTeam(i) > 1) {
    iLevel  += GetLevel(i);
   }
  }
  g_iLevel[client] = iLevel / iClients;
 } else {
  g_iLevel[client] = 1;
 }
 g_iWeapon[client]  = 0;
}
public ConVarChange_Enabled(Handle:convar, const String:oldValue[], const String:newValue[])  {
 g_bEnabled  = StrEqual(newValue, "1");
 
 for (new i = 1; i <= g_iMaxClients; i++) {
  if (IsClientInGame(i) && IsPlayerAlive(i)) {
   ForcePlayerSuicide(i);
  }
 }
}
public Action:Command_Drop(client, args) {
 return g_bEnabled ? Plugin_Handled : Plugin_Continue;
}
public Action:Command_Slot(client, args) {
 if (g_bEnabled && !GetConVarBool(g_hTurbo)) {
  GiveWeapon(client);
  
  return Plugin_Handled;
 } else {
  return Plugin_Continue;
 }
}
public Action:Event_PlayerDeath(Handle:event, const String:name[], bool:dontBroadcast) {
 if (g_bEnabled) {
  decl Float:fPosition[3], String:sWeapon[24];
  new iAttackerID = GetEventInt(event, "attacker"),
    iClientID   = GetEventInt(event, "userid"),
    iAttacker   = GetClientOfUserId(iAttackerID),
    iClient     = GetClientOfUserId(iClientID);
  GetClientAbsOrigin(iClient, fPosition);
  GetEventString(event, "weapon", sWeapon, sizeof(sWeapon));
  
  if (IsValidEntity(g_iWeapon[iClient]) && g_iWeapon[iClient] > 0) {
   RemoveWeapon(iClient, g_iWeapon[iClient]);
  }
  if (iAttacker == 0 || iAttacker == iClient)   {
   if (g_iLevel[iClient] > 1) {
    g_iLevel[iClient]--;
    PrintToChatAll("%s%t", g_sPrefix, "Suicide", 4, iClient, 1);
    LogEvent("gg_leveldown",    iClientID);
    
    if (!StrEqual(g_sSoundLevelDown,    "")) {
     EmitSoundToClient(iClient, g_sSoundLevelDown);
    }
   }
  } else if (GetClientTeam(iAttacker) != GetClientTeam(iClient)) {
   if (fPosition[0] == g_fPosition[iClient][0] &&
     fPosition[1] == g_fPosition[iClient][1]) {
    PrintHintText(iAttacker, "%t", "AFK", iClient);
   } else if (g_iLevel[iAttacker]++ < g_iLevels) {
    if (GetConVarBool(g_hSpade)    && GetConVarBool(g_hSpadePro) &&
      StrEqual(sWeapon, "spade") && g_iLevel[iClient] > 1) {
     g_iLevel[iClient]--;
     PrintToChatAll("%s%t", g_sPrefix, "Steal", 4, iAttacker, 1, 4, iClient, 1);
     LogEvent("gg_levelsteal", iAttackerID);
     LogEvent("gg_leveldown",  iClientID);
     
     if (!StrEqual(g_sSoundLevelSteal, "")) {
      EmitSoundToClient(iAttacker, g_sSoundLevelSteal);
     }
     if (!StrEqual(g_sSoundLevelDown,  "")) {
      EmitSoundToClient(iClient,   g_sSoundLevelDown);
     }
    } else {
     LogEvent("gg_levelup",    iAttackerID);
     
     if (!StrEqual(g_sSoundLevelUp,    "")) {
      EmitSoundToClient(iAttacker, g_sSoundLevelUp);
     }
    }
    
    new iLeader  = GetLeader(), iLevel = g_iLevel[iAttacker];
    if (IsPlayerAlive(iAttacker)) {
     PrintToChat(iAttacker,   "%s%t", g_sPrefix, "Weapon",     4, g_sWeapon[iLevel]);
    }
    if (iLeader == iAttacker) {
     PrintToChatAll("%s%t", g_sPrefix, "Leader", 4, iAttacker, 1, 4, iLevel, 1);
    } else {
     new iLead  = g_iLevel[iLeader] - iLevel;
     if (iLead  > 0) {
      PrintToChat(iAttacker, "%s%t", g_sPrefix, "Difference", 4, iLead,  1, iLead == 1 ? "" : "s");
     }
    }
    
    if (GetConVarBool(g_hTurbo)) {
     GiveWeapon(iAttacker);
    }
   } else {
    decl String:sNextMap[32];
    GetConVarString(g_hNextMap, sNextMap, sizeof(sNextMap));
    PrintToChatAll("%s%t",   g_sPrefix, "Win",   4, iAttacker, 1, 4, sNextMap);
    LogEvent("gg_win", iAttackerID);
    CreateTimer(4.5, Timer_EndGame);
    
    if (!StrEqual(g_sSoundWin,          "")) {
     EmitSoundToAll(g_sSoundWin);
    }
   }
  }
 }
}
public Action:Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast) {
 if (g_bEnabled) {
  new iClient = GetClientOfUserId(GetEventInt(event, "userid"));
  if (GetClientTeam(iClient) > 1) {
   GetClientAbsOrigin(iClient, g_fPosition[iClient]);
   CreateTimer(0.1, Timer_GiveWeapon, iClient);
  }
 }
}
public Action:Event_RoundStart(Handle:event,  const String:name[], bool:dontBroadcast) {
 new iCaptureArea = -1;
 while ((iCaptureArea = FindEntityByClassname(iCaptureArea, "dod_capture_area")) != -1) {
  AcceptEntityInput(iCaptureArea, "Disable");
 }
}
public Action:Timer_EndGame(Handle:timer) {
 new iGameEnd = FindEntityByClassname(-1, "game_end");
 if (iGameEnd == -1 && (iGameEnd = CreateEntityByName("game_end")) == -1) {
  LogError("Unable to create entity \"game_end\"!");
 } else {
  AcceptEntityInput(iGameEnd, "EndGame");
 }
}
public Action:Timer_GiveWeapon(Handle:timer, any:client) {
 for (new i = 0, s; i < 5; i++) {
  if ((s = GetPlayerWeaponSlot(client, i)) != -1) {
   RemoveWeapon(client, s);
  }
 }
 
 new iLevel        = g_iLevel[client];
 g_iWeapon[client] = 0;
 PrintToChat(client, "%s%t", g_sPrefix, "Level", 4, iLevel, 1, 4, g_sWeapon[iLevel]);
 GiveWeapon(client);
 if (GetConVarBool(g_hSpade) && !StrEqual(g_sWeapon[iLevel], "amerknife")
               && !StrEqual(g_sWeapon[iLevel], "spade")) {
  GivePlayerItem(client, "weapon_spade");
 }
}
GetLeader() {
 new iLeader = 0;
 for (new i  = 1; i <= g_iMaxClients; i++) {
  if (IsClientInGame(i) && g_iLevel[i] > g_iLevel[iLeader]) {
   iLeader = i;
  }
 }
 
 return iLeader;
}
GetLevel(iClient) {
 if (GetConVarBool(g_hTurbo)) {
  return g_iLevel[iClient];
 } else {
  return g_iOldLevel[iClient];
 }
}
GiveWeapon(iClient) {
 if (IsPlayerAlive(iClient)) {
  decl iWeapon, String:sWeapon[32];
  new iLevel = g_iOldLevel[iClient] = g_iLevel[iClient];
  Format(sWeapon, sizeof(sWeapon), "weapon_%s", g_sWeapon[iLevel]);
  
  if (IsValidEntity(g_iWeapon[iClient]) && g_iWeapon[iClient] > 0) {
   RemoveWeapon(iClient, g_iWeapon[iClient]);
  }
  if (GetConVarBool(g_hSpade) && (iWeapon = GetPlayerWeaponSlot(iClient, 2)) != -1 &&
    (StrEqual(g_sWeapon[iLevel], "amerknife") || StrEqual(g_sWeapon[iLevel], "spade"))) {
   RemoveWeapon(iClient, iWeapon);
  }
  g_iWeapon[iClient]      = GivePlayerItem(iClient, sWeapon);
  if ((g_iAmount[iClient] = GetEntData(g_iWeapon[iClient], g_iClip)) < 1) {
   g_iAmount[iClient]    = 1;
  }
  if (g_iAmmo[iLevel]     > 0) {
   SetEntData(iClient, g_iAmmo[iLevel], g_iAmount[iClient] * 2, _, true);
  }
 }
}
LoadConfig() {
 decl String:sLevel[4], String:sPath[PLATFORM_MAX_PATH], String:sWeapon[24];
 new iAmmo[MAXPLAYERS + 1]   = {0, ...},
   iLevel                  = 1,
   iOffset                 = FindSendPropInfo("CBasePlayer", "m_iAmmo"),
   iOffsets[20]            = { 4,  8, 12,
                 16, 20, 20,
                 24, 28, 32,
                 32, 32, 36,
                 40, 44, 48,
                 48, 52, 56,
                 68, 72},
   Handle:hConfig          = CreateKeyValues("GunGame"),
   String:sWeapons[20][24] = {"colt",      "p38",     "c96",
                 "garand",    "k98",     "k98_scoped",
                 "m1carbine", "spring",  "thompson",
                 "mp40",      "mp44",    "bar",
                 "30cal",     "mg42",    "bazooka",
                 "pschreck",  "frag_us", "frag_ger",
                 "smoke_us",  "smoke_ger"};
 BuildPath(Path_SM, sPath, sizeof(sPath), "configs/gungame.txt");
 
 if (FileExists(sPath)) {
  for (new i = 0; i < sizeof(g_sWeapon); i++) {
   g_sWeapon[i] = "";
  }
  
  FileToKeyValues(hConfig, sPath);
  KvJumpToKey(hConfig, "Levels");
  KvGetString(hConfig, "1", sWeapon, sizeof(sWeapon));
  
  while (!StrEqual(sWeapon, "")) {
   g_sWeapon[iLevel] = sWeapon;
   
   IntToString(++iLevel, sLevel, sizeof(sLevel));
   KvGetString(hConfig,  sLevel, sWeapon, sizeof(sWeapon));
  }
  
  KvRewind(hConfig);
  KvJumpToKey(hConfig, "Sounds");
  KvGetString(hConfig, "Join",       g_sSoundJoin,       PLATFORM_MAX_PATH);
  KvGetString(hConfig, "LevelUp",    g_sSoundLevelUp,    PLATFORM_MAX_PATH);
  KvGetString(hConfig, "LevelDown",  g_sSoundLevelDown,  PLATFORM_MAX_PATH);
  KvGetString(hConfig, "LevelSteal", g_sSoundLevelSteal, PLATFORM_MAX_PATH);
  KvGetString(hConfig, "Win",        g_sSoundWin,        PLATFORM_MAX_PATH);
  
  if (!StrEqual(g_sSoundJoin,       "")) {
   LoadSound(g_sSoundJoin);
  }
  if (!StrEqual(g_sSoundLevelUp,    "")) {
   LoadSound(g_sSoundLevelUp);
  }
  if (!StrEqual(g_sSoundLevelDown,  "")) {
   LoadSound(g_sSoundLevelDown);
  }
  if (!StrEqual(g_sSoundLevelSteal, "")) {
   LoadSound(g_sSoundLevelSteal);
  }
  if (!StrEqual(g_sSoundWin,        "")) {
   LoadSound(g_sSoundWin);
  }
  
  g_iAmmo    = iAmmo;
  g_iLevels  = --iLevel;
  for (new i = 1; i <= g_iLevels; i++) {
   for (new j = 0; j < sizeof(sWeapons); j++) {
    if (StrEqual(g_sWeapon[i], sWeapons[j])) {
     g_iAmmo[i] = iOffset + iOffsets[j];
     break;
    }
   }
  }
 } else {
  SetFailState("File Not Found: %s", sPath);
 }
}
LoadSound(String:sFile[PLATFORM_MAX_PATH]) {
 decl String:sPath[PLATFORM_MAX_PATH];
 Format(sPath, sizeof(sPath), "sound/%s", sFile);
 PrecacheSound(sFile, true);
 AddFileToDownloadsTable(sPath);
}
LogEvent(String:sName[32], iUserID) {
 new iClient = GetClientOfUserId(iUserID), String:sAuth[32];
 GetClientAuthString(iClient, sAuth, sizeof(sAuth));
 LogToGame("\"%N<%d><%s><GunGame>\" triggered \"%s\"", iClient, iUserID, sAuth, sName);
}
RemoveWeapon(iClient, iWeapon) {
 RemovePlayerItem(iClient, iWeapon);
 RemoveEdict(iWeapon);
}
this is the entire code thats posted.... the game never ends after a player has won.... the game goes on until maptimelimit is reached, other than that everything seems ok suicides brought our players back a level as it should and all our players were able to join and get the correct weapons.... did notice tk's did nothing like it used to bring players back now it does nothing at all but we could just set ff to off i guess so thats not a priority but the fact that the game never announces a winner and changes maps is a major bug that we saw.

thanks for your work on this and hope their will be a fix soon.
dirtyjob is offline
Send a message via AIM to dirtyjob
menotyou
Member
Join Date: Jul 2008
Old 07-27-2008 , 01:37   Re: DoD:S GunGame (Updated 07/26)
Reply With Quote #29

it seems to work ok so far but some time the player go in to a mode where the arms are out and thay cant fire. the player sees a warp like seen i have some pics if needed.. well i hope has anyone elts seen this?
And mine seems to change maps when a player get to top level.
MetaMod:Source v1.6.1.671V,
SourceMod v1.1.0.2393,
sm_gungame_version "0.2".
dod_medic_version "1.1",
sm_dod_ftb_version "1.0.101"
TEST IP NY,USA
74.69.142.249:27016 <MNU>Clan**GUN-GAME-Server**
__________________
menotyou is offline
bulletsponge
Junior Member
Join Date: Jul 2008
Old 07-27-2008 , 04:37   Re: DoD:S GunGame (Updated 07/26)
Reply With Quote #30

Great plugin!

I just updated to the 0.2 version and it was working fairly well for a couple rounds. Here are the errors I am experiencing...

Errors from the log...
Quote:
[SM] Plugin encountered error 4: Invalid parameter or parameter type
[SM] Native "PrintToChat" reported: Language phrase "Level" not found
Additionally, the plugin crashes on occasion but more importantly the plugin was preventing caps in normal game play. After playing gungame for a while, we switched back to normal game play and we were unable to cap flags.

The server.cfg file has sm_gungame_enabled set to 0. That wasn't working so I unloaded the gungame.smx plugin in console (sm plugins unload gungame.smx). I also tried to restart the server. The issue did not correct itself until I moved the gungame.smx file to another directory to disable it.

This error did not happen everytime, we were testing the mod throughout the day so we bounced back and forth from regular gameplay with no problems.

Our current plugins:

MetaMod:Source v1.6.1.671V, SourceMod v1.0.4-svn
bulletsponge is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:18.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode