Kicked and banned user dont get the message
#1

When someone is banned (or kicked) by an admin, the server shows a message: "Player" has been banned/kicked by "ADMIN". (Reason: bla)

But the punished player don't see it, just "Server closed the connection."

How do I fix it?

Thanks in advance.
Reply
#2

You didn't post anything for us to look at to see your mistake?
Reply
#3

its all about timer..
lemme explain
lets say, your Ban code is
Код:
 Ban(playerid);
we go Do a brand new function for it, it will be
Код:
public PlayerBan(playerid)
but, to Do that and avoid errors, we have to forward it
Код:
forward PlayerBan(playerid);
-*The forward should be on top of the Function(before it)*-
--Whole Function should be like this--

Quote:

forward PlayerBan(playerid);
public PlayerBan(playerid)
{
Ban(playerid);
}

-> It Can be put Anywhere


Now lets go
**Lets Say this is my Ban Command
(don't use my command, use the Basic tutorial i gave)
Код:
    
CMD:ban(playerid, params[])
    {
         {
            GetPlayerName(playerid, Adminname, sizeof(Adminname)); //defines the function with the adminname we wanna get
 	  		GetPlayerName(PID, Playername, sizeof(Playername));
            if(sscanf(params, "us[64]", PID,reason)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /kick [playerid] [reason]"); //tell sscanf if the parameters/the syntax is written wrong to return a message (PID and the reason used here)
        (it got player name And other bla bla, this is not what i'm Trying to focus for)

          SendClientMessage(playerid, 0xFF0000FF, "You have been banned!:P");
 
        // Actually ban them a second later on a timer.
        SetTimerEx("PlayerBan", 1000, false, "d", playerid);

        }
        else //if he has not got the permissions
        {
            SendClientMessage(playerid, COLOR_GREY, "You have to be level 5 to use that command!"); //return this message
        }
        return 1;
    }
(Focus where the Message and timer should be, First the Message Before the ban Timer .. and Both of them ''Bantimer+Message" are before the 'Else' Function that checks if he has not got the permission'
Reply
#4

You need a create a timer so the server is able to show the message to the player
Reply
#5

Example code and explanation at https://sampwiki.blast.hk/wiki/Kick
Reply
#6

Quote:
Originally Posted by rymax99
Посмотреть сообщение
Example code and explanation at https://sampwiki.blast.hk/wiki/Kick
Great, But he needs ban ^^
https://sampwiki.blast.hk/wiki/Ban
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)