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

[Any?] Spy Mode Game Mode Development


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 10-11-2016 , 08:51   [Any?] Spy Mode Game Mode Development
Reply With Quote #1

Hiya everyone, this idea has been locked up in my mind and kept bothering me until now. Anyone of you know the game Crossfire? If so, I was wondering if you guys want to play Spy Mode.

DESCRIPTION:
Spy Mode is a game mode where 1 player in each team gets selected as a spy in the enemy team, meaning the enemies won't be able to tell if one of their allies is a spy or not.

HOW IT WORKS:
  • 1 player in each team gets selected randomly as spies.
  • The selected spies switch places and also changes all players' names to something else, meaning no one will be able to figure out who are those chosen spies. (i.e Snoopy in CT team and Crane in T team get chosen as the spies, therefore they will switch teams and all players' names will change from their original name to something like CT00, CT01, T00, T01)
  • The game mode will not start unless there are 3 or more players in both teams.
  • The chosen spies will be able to know each other, notifying them through their chat.
  • Disadvantage for the spies is that any weapons, either primary or secondary, they acquired through buying will have no ammo (reserved or current) and instead will be only carrying melee weapons and grenades only.
  • Advantage of the spies is that they can loot the other player's weapons with ammo (either died or exchange)
  • Spies can't plant or defuse C4 for fairness but will have cloaks so they won't be easy targets.
  • Once the round ends, all their replaced names will revert back to their original ones.

PROBLEMS:
  • Many events and functions will be involved and I can't do this all by myself, therefore I will need your help.
  • Any type of coder (from beginner to expert) is welcome to help.

So, I hope this will help to make you enjoy your games further especially for Counter Strike games.

EDIT: Here's the improved source code. I know it's still not enough since I know little about CS:GO but I know you guys can improve it.
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>

#define PLUGIN_VERSION "1.0"

#define TEAM_T 2
#define TEAM_CT 3

enum()
{
        
firstSpy,
        
secondSpy
}

public 
Plugin myinfo =
{
    
name "Spy Mode",
    
author "cravenge",
    
description "A new challenging game mode.",
    
version PLUGIN_VERSION,
    
url ""
};

bool isSpy[MAXPLAYERS+1] = false;
bool isDetectedSpy[MAXPLAYERS+1] = false;
ConVar cSpyModeOn;
new 
String:clientModel[MAXPLAYERS+1][2][64];

public 
void OnPluginStart()
{
    
CreateConVar("spy_mode_version"PLUGIN_VERSION"Spy Mode Version"FCVAR_NOTIFY);
    
cSpyModeOn CreateConVar("spy_mode_enabled""1""Enable/Disable Plugin"FCVAR_NOTIFY);
    
    
HookEvent("round_start"OnRoundStart);
    
HookEvent("weapon_fire"OnWeaponFire);
}

public 
Action OnRoundStart(Handle event, const char[] namebool dontBroadcast)
{
    
CreateTimer(5.0ChooseSpies);
}

public 
Action:ChooseSpies(Handle:timer)
{
        
decl Float:spy1[3], Float:spy2[3];
        
    
int TSpy SelectRandomSpy(TEAM_T);
    
isSpy[TSpy] = true;
        
int CTSpy SelectRandomSpy(TEAM_CT);
    
isSpy[CTSpy] = true;
        
    
GetClientModel(TSpyclientModel[TSpy][firstSpy], 64);
    
GetClientModel(CTSpyclientModel[CTSpy][secondSpy], 64);
        
        
GetEntPropVector(TSpyProp_Send"m_vecOrigin"spy1);
        
GetEntPropVector(CTSpyProp_Send"m_vecOrigin"spy2);
        
    
SetEntityModel(TSpyclientModel[CTSpy][secondSpy]);
        
SetEntityModel(CTSpyclientModel[TSpy][firstSpy]);
        
        
TeleportEntity(TSpyspy1NULL_VECTORNULL_VECTOR);
        
TeleportEntity(CTSpyspy2NULL_VECTORNULL_VECTOR);
        
    return 
Plugin_Stop;
}

public 
Action OnWeaponFire(Handle event, const char[] namebool dontBroadcast)
{
    
int firer GetClientOfUserId(GetEventInt(event"userid"));
    if (!
IsValidClient(firer) || !isSpy[firer] || isDetectedSpy[firer])
    {
        return 
Plugin_Continue;
    }
    
    
PrintToChatAll("\x04[\x03Spy Mode\x04]\x01 A spy has been detected! Watch out!");
    
        
decl String:firerModel[64];
    
GetEntPropString(firerProp_Data"m_ModelName"firerModel64);
    
    if (
StrEqual(firerModelclientModel[firer][secondSpy], false))
    {
        
SetEntityModel(firerclientModel[firer][firstSpy]);
                
isDetectedSpy[firer] = true;
    }
    else if (
StrEqual(firerModelclientModel[firer][firstSpy], false))
    {
        
SetEntityModel(firerclientModel[firer][secondSpy]);
                
isDetectedSpy[firer] = true;
    }
    
    return 
Plugin_Continue;
}

stock SelectRandomSpy(team)
{
    
int clients[MAXPLAYERS+1], clientCount;
    for (
int i 1<= MaxClientsi++)
    {
        if (
IsClientInGame(i) && GetClientTeam(i) == team && IsPlayerAlive(i) && !IsFakeClient(i))
        {
            
clients[clientCount++] = i;
        }
    }
    
    return (
clientCount == 0) ? -clients[GetRandomInt(0clientCount 1)];
}

stock bool:IsValidClient(client)
{
    return (
client && client <= MaxClients && IsClientInGame(client) && !IsFakeClient);


Last edited by cravenge; 10-15-2016 at 02:08.
cravenge is offline
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 10-11-2016 , 10:50   Re: [Any?] Spy Mode Game Mode Development
Reply With Quote #2

Always is funny coding in team. Unfortunaly I am really busy this 3 moths (job, etc, etc) but you can add me and maybe I will help you if I have time.

You will release this gamemode, right?
__________________
Veteran Coder -> Activity channel
Coding on CS2 and taking paid and free jobs.

Contact: Steam, Telegram or discord ( franug ).

You like my work? +Rep in my steam profile comments or donate.

Franc1sco is offline
Send a message via MSN to Franc1sco
Arkarr
Veteran Member
Join Date: Sep 2012
Location: Just behind my PC screen
Old 10-11-2016 , 11:10   Re: [Any?] Spy Mode Game Mode Development
Reply With Quote #3

Could be fun, count me in.
__________________
Want to check my plugins ?
Arkarr is offline
Mayor Gamer
Senior Member
Join Date: Nov 2012
Location: GetLocationOfUser(me);
Old 10-11-2016 , 11:51   Re: [Any?] Spy Mode Game Mode Development
Reply With Quote #4

I could help in some things, why not? Seems a fun project ;D
__________________
Mayor Gamer is offline
shanapu
Veteran Member
Join Date: Apr 2015
Location: .de
Old 10-11-2016 , 16:39   Re: [Any?] Spy Mode Game Mode Development
Reply With Quote #5

When you develop this on a public git, I could help with some pull requests.
__________________
coding & free software
shanapu is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 10-12-2016 , 07:00   Re: [Any?] Spy Mode Game Mode Development
Reply With Quote #6

Quote:
Originally Posted by Franc1sco View Post
Always is funny coding in team. Unfortunaly I am really busy this 3 moths (job, etc, etc) but you can add me and maybe I will help you if I have time.

You will release this gamemode, right?
Sure, if the plugin is fully developed and ready for public use.

Also, thanks for everyone who wants to support this plugin.
cravenge is offline
kaeming
Senior Member
Join Date: Nov 2015
Old 10-12-2016 , 23:46   Re: [Any?] Spy Mode Game Mode Development
Reply With Quote #7

Seems like TTT to me with modified perks ahah
__________________
Add me up HERE if you have inquiries regarding server related stuff!
CS:GO Multimod & Jailbreak Servers > I am selling my entire ready to play server, add me up on steam to discuss.
kaeming is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 10-13-2016 , 06:48   Re: [Any?] Spy Mode Game Mode Development
Reply With Quote #8

Quote:
Originally Posted by kaeming View Post
Seems like TTT to me with modified perks ahah
Hmmm, not one bit though. This game mode is like the default one but with spies (well I guess you can call them Traitors but not everyone will fight against them)
cravenge is offline
zyox123cc
Senior Member
Join Date: Jul 2016
Location: spycrab
Old 10-14-2016 , 22:38   Re: [Any?] Spy Mode Game Mode Development
Reply With Quote #9

If the player has been trying to change the name?
zyox123cc is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 10-15-2016 , 01:44   Re: [Any?] Spy Mode Game Mode Development
Reply With Quote #10

Quote:
Originally Posted by zyox123cc View Post
If the player has been trying to change the name?
Don't worry, a repeating timer will be able to prevent that from happening.
cravenge is offline
Reply



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 23:15.


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