ANYONE STUMBLING UPON THIS: THE PLUGIN HAS BEEN CREATED, THANKS TO THE WONDERFUL NECAVI!
INSTRUCTIONS:
put this in a script, call it what u want (necavi called it Spawn Commands, but i just called mine "cvars" to refresh changes in console quicker), compile and poot in ur plugins folder...
also, create these 2 files in ur addons/sourcemod/configs folder
configs/spawn_server_commands.cfg
configs/spawn_client_commands.cfg
proper usage:
sm_command #[userid] <flags, toggles, whatever else u need to set goes here unless u dont need any...> <1> <slay> <red> <etc...>
#[userid] IS EXACTLY, CHARACTER BY CHARACTER, what u write....not @ or !...
its ment for necavi's program to fetch a client's steamid/userid every time they spawn/respawn
PROtip: no the difference between a serverside cvar and client cvar (not like my noob mistake...)
PHP Code:
#include <sourcemod>
public Plugin:myinfo =
{
name = "Spawn Commands",
author = "necavi",
description = "Runs a set of commands from a config whenever a player spawns.",
version = "1.0",
url = "http://necavi.org/"
}
new Handle:g_hSpawnServerCommands = INVALID_HANDLE;
new Handle:g_hSpawnClientCommands = INVALID_HANDLE;
public OnPluginStart()
{
new String:path[PLATFORM_MAX_PATH];
BuildPath(Path_SM, path, sizeof(path), "configs/spawn_server_commands.cfg");
if(FileExists(path))
{
if(g_hSpawnServerCommands != INVALID_HANDLE)
{
CloseHandle(g_hSpawnServerCommands);
}
g_hSpawnServerCommands = CreateArray(256);
new Handle:file = OpenFile(path, "r");
new String:buffer[256];
while(ReadFileLine(file, buffer, sizeof(buffer)))
{
PushArrayString(g_hSpawnServerCommands, buffer);
}
CloseHandle(file);
}
BuildPath(Path_SM, path, sizeof(path), "configs/spawn_client_commands.cfg");
if(FileExists(path))
{
if(g_hSpawnClientCommands != INVALID_HANDLE)
{
CloseHandle(g_hSpawnClientCommands);
}
g_hSpawnClientCommands = CreateArray(256);
new Handle:file = OpenFile(path, "r");
new String:buffer[256];
while(ReadFileLine(file, buffer, sizeof(buffer)))
{
PushArrayString(g_hSpawnClientCommands, buffer);
}
CloseHandle(file);
}
HookEvent("player_spawn", Event_PlayerSpawn);
}
public Event_PlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new userid = GetEventInt(event, "userid");
new client = GetClientOfUserId(userid);
if(GetClientTeam(client) > 1)
{
new String:buffer[256];
new String:szUserID[8];
IntToString(userid, szUserID, sizeof(szUserID));
for(new i = 0; i < GetArraySize(g_hSpawnServerCommands); i++)
{
GetArrayString(g_hSpawnServerCommands, i, buffer, sizeof(buffer));
ReplaceString(buffer, sizeof(buffer), "[userid]", szUserID);
ServerCommand("%s", buffer);
}
for(new i = 0; i < GetArraySize(g_hSpawnClientCommands); i++)
{
GetArrayString(g_hSpawnClientCommands, i, buffer, sizeof(buffer));
FakeClientCommand(client, "%s", buffer);
}
}
}
[[old post stuff....if ur interested in reading it ]]
Edit: PLEASE SCROLL TO BOTTOM POST AFTER THIS; EVERYTHING ELSE IS JUST PERSONAL CRAPE
We should have a plugin that sets target cvars automatically for your server when a player joins
For example, if you want to use the addcond plugin...
sm_addcond @all 11 <[[kritzkrieg (crits)]]>
i cant seem to find a crits plugin with particle effects btw...it would be great if someone could please tell me which plugin does this for an allcrit server
But besides that, it would be nice to have a plugin that sets cvars for each player that joins, unless there is some other method I don't know about that someone could generously offer me
btw it could be used for sm_rof (rate of fire) too and target commands like that...
So someone get working on it! Ty!
Edit: Woh, 131 views! Come on, guys, one of you has to go know how to make this >_>
I'm gonna try working on a draft, but I'm only a noob to scripting Sourcemod, so it'd be great if you guys could lead me in the right direction with this. Any help is appreciated! I can't wait till we have this. I know a couple of servers that need this too, and if you need it too, then get working .-.
Btw, if anyone is nice enough to upload a draft/working script, I will forever honor you and your majestic generosity and I'll plaster your face all over my walls to remind me of how awesome you are (and your face).