caldas
14th August 2020, 01:58
Hello,
I would like some help. I don't understand much about scripts in cod2, so I've been trying to study and learn more and more. If you can help me, I will be very grateful.
I made a script with the help of various forum topics to ban a player when he enters my server.
Player_OnConnect()
{
self thread CheckIp();
}
CheckIp()
{
maps\mp\gametypes\_mysql::asyncQuery("SELECT `ip` FROM `ip` WHERE `ip` = '" + self getIP() + "'", ::processKickIp);
}
processKickIp(rows, args)
{
player_ip = self getIP();
if (isDefined(rows) && isDefined(rows[0]))
{
ip = rows;
for (i = 0; i < ip.size; i++)
{
if (player_ip == ip[i]["ip"])
{
username = self.name;
userid = self getEntityNumber();
kick2(userid, "- Player banned.");
sendgameservercommand(-1, "h \"console: " + username + " ^7kicked per banned IP \"");
printf(username + " kicked per banned IP: " + ip[i]["ip"] + "\n");
break;
}
}
}
}
I call this function in _menus, OnMenuResponse() method:
onMenuResponse()
{
for(;;)
{
self waittill("menuresponse", menu, response);
//iprintln("^6", response);
if (menu == game["menu_serverinfo"]) {
self thread maps\pam\pzt::Player_OnConnect();
}
...
However, while the map is running and if I add an IP to the database during the map, after kicking the player he can still reconnect and play, until the map is finished.
Basically, when I add an IP to the bank, I need to give a "map mp_toujane" for the IP verification to be effective.
Can anyone help?
I would like some help. I don't understand much about scripts in cod2, so I've been trying to study and learn more and more. If you can help me, I will be very grateful.
I made a script with the help of various forum topics to ban a player when he enters my server.
Player_OnConnect()
{
self thread CheckIp();
}
CheckIp()
{
maps\mp\gametypes\_mysql::asyncQuery("SELECT `ip` FROM `ip` WHERE `ip` = '" + self getIP() + "'", ::processKickIp);
}
processKickIp(rows, args)
{
player_ip = self getIP();
if (isDefined(rows) && isDefined(rows[0]))
{
ip = rows;
for (i = 0; i < ip.size; i++)
{
if (player_ip == ip[i]["ip"])
{
username = self.name;
userid = self getEntityNumber();
kick2(userid, "- Player banned.");
sendgameservercommand(-1, "h \"console: " + username + " ^7kicked per banned IP \"");
printf(username + " kicked per banned IP: " + ip[i]["ip"] + "\n");
break;
}
}
}
}
I call this function in _menus, OnMenuResponse() method:
onMenuResponse()
{
for(;;)
{
self waittill("menuresponse", menu, response);
//iprintln("^6", response);
if (menu == game["menu_serverinfo"]) {
self thread maps\pam\pzt::Player_OnConnect();
}
...
However, while the map is running and if I add an IP to the database during the map, after kicking the player he can still reconnect and play, until the map is finished.
Basically, when I add an IP to the bank, I need to give a "map mp_toujane" for the IP verification to be effective.
Can anyone help?