Ni3ls
12th November 2015, 13:39
Hi all,
Im working on a banfunction that bans with clientID
case "@ban":
if (!isdefined(self.pers["admin"]) || self.pers["admin"] < 1)
{
self iprintlnbold("No admin!");
return;
}
if(isdefined(args[2]))
id = int(args[2]);
else
return;
if (!isdefined(args[3])) /// || args[3].size<1)
reden = "no reason";
else
{
//reden = "Reason: ";
reden = "";
for (i = 3; i < args.size; i++)
reden += args[i] + " ";
}
players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)
{
if(players[i] getEntityNumber() == id)
{
self thread tellmessage("PLAYER: "+players[i].name +" ID: "+players[i] getEntityNumber());
/*id = players[i] getEntityNumber();
ip = players[i] getIP();
guid = players[i] getGUID();
if(guid != 0)
players[i] thread guidbanplayer(self, reden, id, guid);
else
players[i] thread ipbanplayer(self, reden, id, ip);*/
}
else
self thread tellmessage("NO PLAYER");
}
return;
When I write a non existence ID (101), like !@ban 101 REASON, it will show me the message "NO PLAYER".
When I write the correct ID, it will ban me.
However, when I write a string (aaaa) it will still kick the player with ID=0.
How to fix this?
Im working on a banfunction that bans with clientID
case "@ban":
if (!isdefined(self.pers["admin"]) || self.pers["admin"] < 1)
{
self iprintlnbold("No admin!");
return;
}
if(isdefined(args[2]))
id = int(args[2]);
else
return;
if (!isdefined(args[3])) /// || args[3].size<1)
reden = "no reason";
else
{
//reden = "Reason: ";
reden = "";
for (i = 3; i < args.size; i++)
reden += args[i] + " ";
}
players = getentarray("player", "classname");
for(i = 0; i < players.size; i++)
{
if(players[i] getEntityNumber() == id)
{
self thread tellmessage("PLAYER: "+players[i].name +" ID: "+players[i] getEntityNumber());
/*id = players[i] getEntityNumber();
ip = players[i] getIP();
guid = players[i] getGUID();
if(guid != 0)
players[i] thread guidbanplayer(self, reden, id, guid);
else
players[i] thread ipbanplayer(self, reden, id, ip);*/
}
else
self thread tellmessage("NO PLAYER");
}
return;
When I write a non existence ID (101), like !@ban 101 REASON, it will show me the message "NO PLAYER".
When I write the correct ID, it will ban me.
However, when I write a string (aaaa) it will still kick the player with ID=0.
How to fix this?