I prefer using this
But that still doesnt solve my problem :PCode:self setClientCvar("com_errorTitle", "BANNED"); self setClientCvar("com_errorMessage", "You have been disconnected, because you are banned");
I prefer using this
But that still doesnt solve my problem :PCode:self setClientCvar("com_errorTitle", "BANNED"); self setClientCvar("com_errorMessage", "You have been disconnected, because you are banned");
It might be possible to use libcod to make a custom kick with reason.
https://github.com/PJayB/Quake-III-A...er/sv_client.c
See SV_DropClient. (now the reason is 'was kicked')
Edit: CoD2 uses SV_DropClient(clientnum, "EXE_PLAYERKICKED") by defaultPHP Code:
// tell everyone why they got dropped
SV_SendServerCommand( NULL, "print \"%s" S_COLOR_WHITE " %s\n\"", drop->name, reason );
SV_SendServerCommand( drop, "disconnect \"%s\"", reason);
The only thing I need help with is the function to do the kick with reason or optinional reason. The messages arent hard to do
Ni3ls (21st January 2015)
I think there is some big error in my cod2 and I have no idea what is going on. When I wrote the command /rcon g_test2 nie hallo it couldnt find the player, while my name is niels.
So i tried to print the input.
I tested with different name. My name: i<3evil.server 999PHP Code:
info = strTok(getCvar("name")," ");
for(i=0;i<info.size;i++)
{
iprintlnbold("info"+i+" : "+ info[i]);
}
In the console I wrote
This is the output I getCode:/rcon name server hallo test1 test2 doei
So in my screen it was printed like thisPHP Code:
WARNING: Non-localized Game Message string is not allowed to have letters in it. Must be changed over to a localized string: "info0 : scri"
WARNING: Non-localized Game Message string is not allowed to have letters in it. Must be changed over to a localized string: "info1 : hallo"
WARNING: Non-localized Game Message string is not allowed to have letters in it. Must be changed over to a localized string: "info2 : test1"
WARNING: Non-localized Game Message string is not allowed to have letters in it. Must be changed over to a localized string: "info3 : test2"
WARNING: Non-localized Game Message string is not allowed to have letters in it. Must be changed over to a localized string: "info4 : doei"
Somehow the first one is bugged. How the hell is that possible?PHP Code:
info0: scri
info1: hallo
info2: test1
info3: test2
info4: doei
Complete script
PHP Code:
name()
{
level endon("boot");
setCvar("name","");
while(1)
{
if(getcvar("name") != "")
{
info = strTok(getCvar("name")," ");
for(i=0;i<info.size;i++)
{
iprintlnbold("info"+i+" : "+ info[i]);
}
setcvar("name", "");
}
wait 1;
}
}
Ni3ls (22nd January 2015)
Yup, dont directly put getcvar() into any other function
"Does not work" is an error report for a bug between keyboard and chair.
All hail Artie Effem
Ni3ls (22nd January 2015)
Ni3ls (22nd January 2015)
Thanks guys! This is working now.
One more problem I cant figure out is to do it if people have the same name. If I tests with bots it will return the latest bot.PHP Code:
test()
{
level endon("boot");
setCvar("g_test2","");
while(1)
{
if(getcvar("g_test2") != "")
{
nameString = getcvar("g_test2");
info = strTok(nameString, " ");
name1 = getnormalname(info[0]);
if(info.size >= 2)
name2 = info[1];
else
name2 = "no reason";
iprintlnbold("info1: "+name1+" , info2: "+name2);
player_to_kick = undefined;
player_warn = undefined;
players = getentarray("player","classname");
for(i=0;i<players.size;i++)
{
name = getnormalname(players[i].name);
if(name == name1 || isSubStr(name, name1))
player_to_kick = players[i];
}
if(!isDefined(player_to_kick))
{
setcvar("g_test2", "");
iprintlnbold("no player");
wait 0.05;
continue;
}
player_to_kick iprintlnbold("You are kicked\nREASON: "+name2);
setcvar("g_test2", "");
}
wait 1;
}
}
However I wanted to make if there are multiple players it should return a message with "multiple players, player 1 name: + id, player 2 name + id"
I was thinking just to keep the players in an array, but I cant get that working. Can somebody point me in the right direction?