works nice thanks
However I noticed that when someone goes idle, their character reverts back to default and the game seems to forget who you were and you are then unable to re-join and are stuck in spectator mode.
public Plugin:myinfo = { name = PLUGIN_NAME, author = "DeatChaos25", description = "Select a survivor character by typing their name into the chat.", version = PLUGIN_VERSION, }
public Action:NickUse(client, args) { SetEntProp(client, Prop_Send, "m_survivorCharacter", 0); SetEntityModel(client, "models/survivors/survivor_gambler.mdl");
}
public Action:EllisUse(client, args) { SetEntProp(client, Prop_Send, "m_survivorCharacter", 3); SetEntityModel(client, "models/survivors/survivor_mechanic.mdl");
}
public Action:CoachUse(client, args) { SetEntProp(client, Prop_Send, "m_survivorCharacter", 2); SetEntityModel(client, "models/survivors/survivor_coach.mdl");
}
public Action:RochelleUse(client, args) { SetEntProp(client, Prop_Send, "m_survivorCharacter", 1); SetEntityModel(client, "models/survivors/survivor_producer.mdl");
}
public Action:BillUse(client, args) { SetEntProp(client, Prop_Send, "m_survivorCharacter", 4); SetEntityModel(client, "models/survivors/survivor_namvet.mdl");
}
public Action:BikerUse(client, args) { SetEntProp(client, Prop_Send, "m_survivorCharacter", 6); SetEntityModel(client, "models/survivors/survivor_biker.mdl");
}
public Action:LouisUse(client, args) { SetEntProp(client, Prop_Send, "m_survivorCharacter", 7); SetEntityModel(client, "models/survivors/survivor_manager.mdl");
}
Just type your desired survivor into chat with a ! appended at the start, like,
!zoey for Zoey, !francis for Francis, !nick, etc...
I would also suggest using this cvar in your server.cfg
sm_cvar precache_all_survivors 1
Otherwise, you might get a crash if the desired character's model isn't prechached, I've also attached a precompiled version, because I'm nice like that ;p
just so you know, bill crashes on a linux server everytime, typing /bill in chat. However using character select menu, he does not crash the server.
Last edited by MasterMind420; 08-31-2014 at 15:03.
Reason: edit
yup funny thing is i put that into the server.cfg the first time i used your plugin, forgot i deleted it sorry.
If you're using my small plugin, I'd like for you to update since another user requested some things that I decided to add.
I added PreChaching into the plugin, meaning there should no longer be any crashes because of precache issues (Wndows users will still get a Crash with Zoey as this is another problem entirely)
I've added both requests from bazrael, I added a shortcut like !n for Nick or !c for Coach, !b for Bill, etc...
And I also copied the Admin Menu from csm that allows you to change other people's appareance, just use !csc like you would in csm. (meaning I did not code the menu, all credits for the csc menu go to Mi123456)
#define NICK 0
#define ROCHELLE 1
#define COACH 2
#define ELLIS 3
#define BILL 4
#define ZOEY 5
#define FRANCIS 6
#define LOUIS 7
static g_iSelectedClient
public Plugin:myinfo =
{
name = PLUGIN_NAME,
author = "DeatChaos25",
description = "Select a survivor character by typing their name into the chat.",
version = PLUGIN_VERSION,
}
public OnPluginStart()
{
RegConsoleCmd("sm_zoey", ZoeyUse, "Changes your survivor character into Zoey");
RegConsoleCmd("sm_nick", NickUse, "Changes your survivor character into Nick");
RegConsoleCmd("sm_ellis", EllisUse, "Changes your survivor character into Ellis");
RegConsoleCmd("sm_coach", CoachUse, "Changes your survivor character into Coach");
RegConsoleCmd("sm_rochelle", RochelleUse, "Changes your survivor character into Rochelle");
RegConsoleCmd("sm_bill", BillUse, "Changes your survivor character into Bill");
RegConsoleCmd("sm_francis", BikerUse, "Changes your survivor character into Francis");
RegConsoleCmd("sm_louis", LouisUse, "Changes your survivor character into Louis");
RegConsoleCmd("sm_z", ZoeyUse, "Changes your survivor character into Zoey");
RegConsoleCmd("sm_n", NickUse, "Changes your survivor character into Nick");
RegConsoleCmd("sm_e", EllisUse, "Changes your survivor character into Ellis");
RegConsoleCmd("sm_c", CoachUse, "Changes your survivor character into Coach");
RegConsoleCmd("sm_r", RochelleUse, "Changes your survivor character into Rochelle");
RegConsoleCmd("sm_b", BillUse, "Changes your survivor character into Bill");
RegConsoleCmd("sm_f", BikerUse, "Changes your survivor character into Francis");
RegConsoleCmd("sm_l", LouisUse, "Changes your survivor character into Louis");
RegAdminCmd("sm_csc", InitiateMenuAdmin, ADMFLAG_GENERIC, "Brings up a menu to select a client's character");
public OnMapStart()
{
SetConVarInt(FindConVar("precache_all_survivors"), 1);
if (!IsModelPrecached("models/survivors/survivor_teenangst.mdl")) PrecacheModel("models/survivors/survivor_teenangst.mdl", false);
if (!IsModelPrecached("models/survivors/survivor_biker.mdl")) PrecacheModel("models/survivors/survivor_biker.mdl", false);
if (!IsModelPrecached("models/survivors/survivor_manager.mdl")) PrecacheModel("models/survivors/survivor_manager.mdl", false);
if (!IsModelPrecached("models/survivors/survivor_namvet.mdl")) PrecacheModel("models/survivors/survivor_namvet.mdl", false);
if (!IsModelPrecached("models/survivors/survivor_gambler.mdl")) PrecacheModel("models/survivors/survivor_gambler.mdl", false);
if (!IsModelPrecached("models/survivors/survivor_coach.mdl")) PrecacheModel("models/survivors/survivor_coach.mdl", false);
if (!IsModelPrecached("models/survivors/survivor_mechanic.mdl")) PrecacheModel("models/survivors/survivor_mechanic.mdl", false);
if (!IsModelPrecached("models/survivors/survivor_producer.mdl")) PrecacheModel("models/survivors/survivor_producer.mdl", false);
}
/* This Admin Menu was taken from csm, all credits go to Mi123645 */
public Action:InitiateMenuAdmin(client, args)
{
if (client == 0)
{
ReplyToCommand(client, "Menu is in-game only.");
return;
}
public CharMenuAdmin(Handle:menu, MenuAction:action, param1, param2)
{
switch (action)
{
case MenuAction_Select:
{
decl String:item[8];
GetMenuItem(menu, param2, item, sizeof(item));
switch(StringToInt(item))
{
case NICK: { NickUse(g_iSelectedClient, NICK); }
case ROCHELLE: { RochelleUse(g_iSelectedClient, ROCHELLE); }
case COACH: { CoachUse(g_iSelectedClient, COACH); }
case ELLIS: { EllisUse(g_iSelectedClient, ELLIS); }
case BILL: { BillUse(g_iSelectedClient, BILL); }
case ZOEY: { ZoeyUse(g_iSelectedClient, ZOEY); }
case FRANCIS: { BikerUse(g_iSelectedClient, FRANCIS); }
case LOUIS: { LouisUse(g_iSelectedClient, LOUIS); }
}
}
case MenuAction_Cancel:
{
}
case MenuAction_End:
{
CloseHandle(menu);
}
}
}
Edit : The second pre-compiled plugin (the one named (ZoeyDisabled) is for Windows only, it limits selecting Zoey to admins only and even then, you'll only get Rochelle with Zoey's Character Model to prevent any possibility of crashes.
Last edited by DeathChaos25; 09-01-2014 at 15:26.
Reason: Implemented Admin Menu from csm (!csc)
ok so i tested your new plugin, removed precache all survivors from server config and so far precaching seems to be working, also tested the /n for nick and other characters all work as well. Also tested the menu to switch other characters and that also works fine, although an option to change your own character from the menu would be good. great job on the plugin man.
Last edited by MasterMind420; 09-01-2014 at 11:14.
Reason: edit
meh.. but the long lasting hordes issue still exists at least in l4d1 campaigns.
just played no mercy and the generator room event and the gas station event lasted ages because of this plugin. (everyone played with l4d1 chars and no one switched his model)
no point using this if you spend 5 minutes shooting zombies at every panic event..
If the plugin was unchanged when I released it, then it was apart of the Bill fix I implemented to prevent the server from crashing.
It's good to see that others are taking up the mantle.
I thought Bill is fixed? I knew about Zoey causing the crash now but when i select Bill it waits till i move i mean with WSAD and than crashes doesent crash immidiatly Bill works on survival doesent work on campain.