SendClientMessage problem
#1

Hello there,

It doesn't happen often that I ask for help but here I need some.

I have set a timer to ban a player after 1 second that he is connected. The ban works perfectly and all. But any client message that I send to the player within the function is not sent. If I try to paste what's inside the function to the place and remove the timer, it still bans but doesn't send the client messages to the player. I also have put some print so it would echo them to the console, but nothing. Only the print shows, not the client messages.

Here is my function:

pawn Код:
public GLine_Entry(playerid)
{
    SetAccountInfo(Player[playerid][Nickname], "banned", "1");
    new str[256];
    format(str, 256, "Closing Link: %s[%s] (User has been permanently banned from *** (%s))", Player[playerid][Nickname], Player[playerid][IP], Player[playerid][BanReason]);
    SendClientMessage(playerid, GREEN, str);
    print(str);
    BanEx(playerid, Player[playerid][BanReason]);
    return 1;
}
Also note that the print works, but the SendClientMessage doesn't. Everything else is fine.

Thank you.
Reply
#2

did you use


Код:
SetTimerEx("GLine_Entry",TIME,false,"i",playerid);
Код:
forward GLine_Entry(playerid);
?
Reply
#3

Did you want to put SendClientMessageToAll? cause that's sending a message to the player telling them their name and IP and reason why.
Reply
#4

Strange. please tell me how did you define the following:

pawn Код:
Player[playerid][Nickname]
Player[playerid][IP]
Player[playerid][BanReason]
SetAccountInfo
Also str[128] will do since the chat only supports up to 128 characters.

Also did you do:

pawn Код:
SetTimerEx("GLine_Entry",1000,0,"i",playerid);
Like pagie1111 said and it's forwarded also?
Reply
#5

Ban should be dealy, but message shouldn't(In my opinion, it's a fail to make KickEx, BanEx.
Try this:
pawn Код:
#define Imp_BanEx(%1) BanEx(%1)
forward Imp_BanEx_1(const playerid,const reason[]);
stock Imp_BanEx(const playerid, const reason[]){
  SetTimerEx("Imp_BanEx_1",1000,0,"is",playerid,reason);
  SendClientMessage(playerid,COLOR_GREEN,reason);
  return true;
}

public Imp_BanEx_1(const playerid,const reason[]){
  BanEx(playerid,reason);
}
Reply
#6

Well everything is fine as I said, everything runs. Just the ClientMessage doesn't send.

Quote:
Originally Posted by pagie1111
did you use


Код:
SetTimerEx("GLine_Entry",TIME,false,"i",playerid);
Код:
forward GLine_Entry(playerid);
?
Yes I did.
Quote:
Originally Posted by Joe Staff
Did you want to put SendClientMessageToAll? cause that's sending a message to the player telling them their name and IP and reason why.
No, that's the way I want it, don't ask why.
Quote:
Originally Posted by Sneaky'
Strange. please tell me how did you define the following:

pawn Код:
Player[playerid][Nickname]
Player[playerid][IP]
Player[playerid][BanReason]
SetAccountInfo
Using an enum, but that isn't the problem as everything runs but the message.
Quote:
Originally Posted by yezizhu
Ban should be dealy, but message shouldn't(In my opinion, it's a fail to make KickEx, BanEx.
Try this:
pawn Код:
#define Imp_BanEx(%1) BanEx(%1)
forward Imp_BanEx_1(const playerid,const reason[]);
stock Imp_BanEx(const playerid, const reason[]){
  SetTimerEx("Imp_BanEx_1",1000,0,"is",playerid,reason);
  SendClientMessage(playerid,COLOR_GREEN,reason);
  return true;
}

public Imp_BanEx_1(const playerid,const reason[]){
  BanEx(playerid,reason);
}
I will try this and post back, hold on.
Reply
#7

Nothing worked at all in what yezizhu posted.
Reply
#8

http://forum.sa-mp.com/index.php?top...4513#msg694513
Reply
#9

Quote:
Originally Posted by [SAP
Francis ]
Nothing worked at all in what yezizhu posted.
Omg my failed.
Код:
//edit
#define Imp_BanEx(%1) BanEx(%1)
//to
#define BanEx(%1) Imp_BanEx(%1)
Then try
Код:
public OnPlayerConnect(playerid){
  BanEx(playerid,"You get pwned!!!");
  return true;
}
Reply
#10

Quote:
Originally Posted by yezizhu
Quote:
Originally Posted by [SAP
Francis ]
Nothing worked at all in what yezizhu posted.
Omg my failed.
Код:
//edit
#define Imp_BanEx(%1) BanEx(%1)
//to
#define BanEx(%1) Imp_BanEx(%1)
Then try
Код:
public OnPlayerConnect(playerid){
  BanEx(playerid,"You get pwned!!!");
  return true;
}
I already had made this change, I'm not a noob. :P

Quote:
Originally Posted by paytas
Oh yeah right I had forgot about that. Let me go try what I think it would fix it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)