SA-MP Forums Archive
When player connect (if banned) shows dialog that he is banned! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: When player connect (if banned) shows dialog that he is banned! (/showthread.php?tid=482726)



When player connect (if banned) shows dialog that he is banned! - SplinteX - 22.12.2013

Hello!

I wanna ask how to make that when some banned player join my server it opens a dialog box that he is banned (reason,IP...) and then Server closed the connection.

Like this:




Re: When player connect (if banned) shows dialog that he is banned! - erminpr0 - 22.12.2013

pawn Code:
new bool: Banned[MAX_PLAYERS char];
CMD:ban(playerid, params[])
{
    if(!isnull(params)) Banned[params] = true;
    return 1;
}

OnPlayerConnect(playerid)
{
    if(Banned[playerid])
    {
        SendClientMessage(playerid, -1, " You are banned ! ");
        return Kick(playerid);
    }
}
Make your own ban command, this is example, if you don't understand I'll make it later !


Re: When player connect (if banned) shows dialog that he is banned! - Konstantinos - 22.12.2013

Quote:
Originally Posted by erminpr0
View Post
pawn Code:
new bool: Banned[MAX_PLAYERS char];
CMD:ban(playerid, params[])
{
    if(!isnull(params)) Banned[params] = true;
    return 1;
}

OnPlayerConnect(playerid)
{
    if(Banned[playerid])
    {
        SendClientMessage(playerid, -1, " You are banned ! ");
        return Kick(playerid);
    }
}
Make your own ban command, this is example, if you don't understand I'll make it later !
Use char keyword only if you know how to use it.

The declaration is fine but the rest are not:
pawn Code:
Banned[params] = true;
params is an array and it expects an integer value instead. Also it must be used with {} and not with []. So this:
pawn Code:
if(Banned[playerid])
becomes:
pawn Code:
if(Banned{playerid})
But still.. you need a ban system that will assign whether the player is banned to the variable and act accordingly. There are many filterscripts/tutorials/includes that does what SplinteX wants, just search!