raphael
9th March 2023, 17:06
Hello
Do you know if modifying game["menu_team"] applies only to self?
I tried self game["menu_team"] = ... but that gives me a bad syntax error
I'm not sure how I could check if it does or not ...
IzNoGoD
9th March 2023, 17:39
I don't get what you're trying to do. If you're trying to edit which menu file gets shown to players, just do it through script. If you're trying to modify it globally, then why are you using self? Also, who (or what) is self in the context that you're describing?
raphael
9th March 2023, 17:57
If you're trying to edit which menu file gets shown to players, just do it through script.
Do you mean it's possible to set a specific team menu to a specific player through gsc ? (I mean not globally/not for everyone)
Also, who (or what) is self in the context that you're describing?
In this context, self is a player
Here is the code I'm trying to make working :
//1. Put this file in the "codam" folder of the "main" server folder.
//2. Add the below line to "modlist.gsc":
//[[register]]("Promod", codam\promod::main);
main(phase, register)
{
switch(phase)
{
case "init": _init(register); break;
}
}
_init(register)
{
if(isDefined(level.promod))
return;
level.promod = true;
[[register]]("PlayerConnect", ::playerConnect, "thread");
[[register]]("PlayerDisconnect", ::deleteVar, "thread");
[[register]]("gt_spawnSpectator", ::spawnSpectator, "thread");
[[register]]("gt_startRound", ::startRound, "thread");
if (getCvar("previousmap") == "") //SERVER JUST STARTED
{
setCvar("previousmap", getCvar("mapname"));
}
else
{
if (getCvar("previousmap") != getCvar("mapname")) //MAP CHANGED
{
level.mapchanged = true;
setCvar("previousmap", getCvar("mapname"));
}
}
}
playerConnect(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, b0, b1, b2, b2, b4, b5, b6, b7, b8, b9)
{
//RESTORE alreadyconnected vars
vidrestart = getCvar("tmp_pm_alreadyconnected");
if (vidrestart != "")
{
vidrestart = codam\_mm_mmm::strTok(vidrestart, ";");
for (i = 0; i < vidrestart.size; i++)
{
num = self getEntityNumber();
user = codam\_mm_mmm::strTok(vidrestart[i], "|");
if (user[1] == num)
{
self.pers["alreadyconnected"] = user[0];
break;
}
}
}
//CHECK IF ALREADY JOINED AND IS A FULLBRIGHT MAP (so no unnecessary vid_restart for r_overBrightBits)
if (isDefined(self.pers["alreadyconnected"]))
{
if (isDefined(level.mapchanged))
{
mapname = getCvar("mapname");
if (mapname == "mp_carentan" || mapname == "mp_depot")
{
self setClientCvar("r_fullbright", 1);
prefix = "1sk_team_vidrestart_";
game["menu_team"] = prefix + game["allies"] + game["axis"];
precacheMenu(prefix + "americangerman");
precacheMenu(prefix + "britishgerman");
precacheMenu(prefix + "russiangerman");
self.pers["removevidrestartmenuneeded"] = true;
}
else
{
//SET NORMAL MENU
prefix = "1sk_team_";
game["menu_team"] = prefix + game["allies"] + game["axis"];
precacheMenu(prefix + "americangerman");
precacheMenu(prefix + "britishgerman");
precacheMenu(prefix + "russiangerman");
}
}
else
{
//SET NORMAL MENU
prefix = "1sk_team_";
game["menu_team"] = prefix + game["allies"] + game["axis"];
precacheMenu(prefix + "americangerman");
precacheMenu(prefix + "britishgerman");
precacheMenu(prefix + "russiangerman");
}
}
//CHECK IF FIRST JOIN: validate r_overBrightBits (that will also do vid_restart in case is a r_fullbright map)
else
{
self setClientCvar("r_overBrightBits", 0);
self setClientCvar("r_swapInterval", 0);
mapname = getCvar("mapname");
if (mapname == "mp_carentan" || mapname == "mp_depot")
{
self setClientCvar("r_fullbright", 1);
}
prefix = "1sk_team_vidrestart_";
game["menu_team"] = prefix + game["allies"] + game["axis"];
precacheMenu(prefix + "americangerman");
precacheMenu(prefix + "britishgerman");
precacheMenu(prefix + "russiangerman");
self.pers["removevidrestartmenuneeded"] = true;
//SET VAR alreadyconnected
self.pers["alreadyconnected"] = true;
clientnum = self getEntityNumber();
removeVar(clientnum);
rSTR = "";
if (getCvar("tmp_pm_alreadyconnected") != "")
{
rSTR += getCvar("tmp_pm_alreadyconnected");
}
rSTR += true;
rSTR += "|" + clientnum;
rSTR += ";";
setCvar("tmp_pm_alreadyconnected", rSTR);
}
}
deleteVar(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9)
{
num = self getEntityNumber();
removeVar(num);
}
removeVar(num)
{
vidrestart = getCvar("tmp_pm_alreadyconnected");
if (vidrestart != "")
{
vidrestart = codam\_mm_mmm::strTok(vidrestart, ";");
validuser = false;
rSTR = "";
for(i = 0; i < vidrestart.size; i++)
{
user = codam\_mm_mmm::strTok(vidrestart[i], "|");
if(user[1] == num)
{
validuser = true;
continue;
}
rSTR += vidrestart[i];
rSTR += ";";
}
if (validuser)
{
setCvar("tmp_pm_alreadyconnected", rSTR);
}
}
}
spawnSpectator(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9)
{
setPlayerCvars(self);
//REMOVE VIDRESTART MENU IF SET
if (isDefined(self.pers["removevidrestartmenuneeded"]))
{
wait 1;
prefix = "1sk_team_";
game["menu_team"] = prefix + game["allies"] + game["axis"];
precacheMenu(prefix + "americangerman");
precacheMenu(prefix + "britishgerman");
precacheMenu(prefix + "russiangerman");
self setClientCvar("g_scriptMainMenu", game["menu_team"]);
self openMenu(game["menu_team"]);
self.pers["removevidrestartmenuneeded"] = undefined;
}
}
startRound(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9)
{
if (getCvar("g_gametype") == "sd")
{
wait 1;
players = getEntArray("player", "classname");
if (players.size > 0)
{
for(i = 0; i < players.size; i++)
{
setPlayerCvars(players[i]);
}
}
}
}
setPlayerCvars(player)
{
if (!isDefined(player.pers["mm_fov"]))
{
player setClientCvar("cg_fov", 93);
}
player setClientCvar("fx_draw", 0);
player setClientCvar("r_fog", 0);
player setClientCvar("r_entFullbright", 1);
}
I just ran my public server with that, when a player joined, clicking on a team just showed again the team menu (in my case)
raphael
9th March 2023, 18:12
I accidentally deleted the part where I explained what I'm trying to do
I'm trying to make some players execute the vid_restart command, at some specific moments
For that I set a custom team menu that exec a cfg file when being opened (I don't know another way to do it)
Edit:
On my testing server, I just reproduced what happened on the public one
When a player is joining and downloading files, the player who clicks a team just get the team menu again
When the player finished downloading and is in, now clicking a team propose to pick a weapon
raphael
9th March 2023, 19:59
I think I found a solution here :
- https://killtube.org/showthread.php?2815-Server-Redirection
- https://killtube.org/showthread.php?1261-player-execClientCommand(-quot-say-boobs-quot-)
It looks to be a better way/the way for what I try to achieve
I will tell if I succeed
edit: my issue is fixed using this "ExecClientCommand" trick
I don't need to modify the team menu anymore
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.