PDA

View Full Version : Message box wont pop up



Ni3ls
25th June 2015, 10:30
Hi all,
I made a kick function and when u are kicked a message box should pop up.


self setClientCvar("com_errorTitle", "KICKED");
self setClientCvar("com_errorMessage", "You are kicked by: " +admin +"\n" + "^7Reason: "+reden);
wait 1;
self setClientCvar ("clientcmd", "disconnect");
I disconnect but no message. There is also no error in the code

IzNoGoD
25th June 2015, 10:55
Try using the kick2("reason") in libcod

Ni3ls
25th June 2015, 12:05
Hoe does that one work?

filthy_freak_
25th June 2015, 12:39
It's not working because you are disconnecting the player, which does not trigger the "You have been kicked." dialogue. Try doing a normal kick.

Mitch
25th June 2015, 12:52
Try using the kick2("reason") in libcod


kick2(clientnum, "message");

It currently doesn't temporally ban the player for a few minutes like the default function does (uses tempBanClient).
Your message starts with the player's name and then you message. I don't know if there is a way around this.

Edit: it sends the disconnect message like this (A):

SV_SendServerCommand(client, 1, "%c \"%s\"", 119, message);
or B:

SV_SendServerCommand(client, 1, "%c \"%s^7 %s\" PB", 119, &playername, message);
I think A is for precached messages and B isn't.

Edit 2: in the function tempBanClient after "%s (guid %i) was kicked for cheating\n" is the function that bans the guid.


SV_BanGuidBriefly(int guid) = 808D72E (1.3)

Ni3ls
26th June 2015, 11:16
If I use kick(id) its not working

kick2(id, "You are kicked by: " +admin +"\n" + "^7Reason: "+reden +"");
Is not doing anything( doesnt throw me out of the server)
Error:

Param 0 needs to be an int, >make function for this<=0 given! NumParams=2
Param 1 needs to be a string, >make function for this<=0 given! NumParams=2
scriptengine> ERROR: gsc_kick_slot(): param "id"[1] has to be an int!
scriptengine> ERROR: gsc_kick_slot(): param "msg"[2] has to be an string!


I already made a ban function

if(thisPlayerNum == banipNum && isAlive(players[i]) )
{
ip= players[i] getIP();
players[i] writebanlist(ip);
players[i] setClientCvar("com_errorTitle", "BANNED");
players[i] setClientCvar("com_errorMessage", "You are permanently banned from this server!\nIf you think it is an unfair ban,\ngo to www^1.^7evilmulticlan^1.^7tk and complain about it.");
players[i] setClientCvar ("clientcmd", "disconnect");
players[i] openMenu ("clientcmd");
players[i] closeMenu ("clientcmd");
iprintln(players[i].name + "^7 was Banned by the ^7Admin");
}

And with this function I do see message box

EDIT:
Stupid error. Should be admin.NAME

IzNoGoD
26th June 2015, 14:18
Try using a more recent version of libcod to get kick2 working