PDA

View Full Version : messsage before ban? [+reps]


PawnoQ
01/01/2012, 04:09 AM
hi,

when i ban a player like this i want that he sees the client message first before he gets banned from the server.
But he gets banned and the message doesnt appear anymore for the banned player, why?


//this message he doesnt see anymore cause he gets banned as u can see further in this code but why, as it comes before ban?
SendClientMessage(playerid,0xFF0000FF,"This account has been banned! For more information visit our website:");

new string[128];
format(string,sizeof(string),"%s has been banned due ban evading",pname);
SendClientMessageToAll(0xFF0000FF,string);
new query[256];
format(query, sizeof(query), "INSERT INTO `Ban` (banned) VALUES('%s')",pname);
mysql_query(query);
BanEx(playerid,"Ban Evader");

Ivonete
01/01/2012, 04:18 AM
try this

//this message he doesnt see anymore cause he gets banned as u can see further in this code but why, as it comes before ban?

new string[128];
format(string,sizeof(string),"%s has been banned due ban evading",pname);
SendClientMessageToAll(0xFF0000FF,string);
new query[256];
format(query, sizeof(query), "INSERT INTO `Ban` (banned) VALUES('%s')",pname);
mysql_query(query);
SendClientMessage(playerid,0xFF0000FF,"This account has been banned! For more information visit our website:");
BanEx(playerid,"Ban Evader");

Kieren
01/01/2012, 04:19 AM
If a player is banned using Ban or BanEx the server will automatically refuse the connection when they try to connection, so they won't see the message.

The way I did it was add the ban to the database, then the ban is checked against the player and if it comes back that they're banned, I would send the message using SendClientMessage, then kick them. I NEVER used the default SA-MP ban functions, just kicked them using the kick function when the ban was found.

So basically I'd go through it this way;

Initial Ban
1. Add the ban to the MySQL database
2. Send a message "You have been bannded ladeedaa"
3. Kick them

Player reconnecting after ban
1. Check MySQL database if the player is banned
1. Send banned message if they are indeed banned
2. Kick them

So you allow the player to temporarily connect to your server, just so you can present them with the ban message; then you boot them off ;)

PawnoQ
01/01/2012, 04:46 AM
thx kieren, but i made it exact the same way as u mentioned it (with kick and mysql system)
but it still doesnt send the message to the ban evader in time.
Why? The kick command comes last and the send client message before, so why he cant see it?
(except this minor bug everything works like a charm..)

please help me :)

PawnoQ
01/01/2012, 05:10 AM
sorry for double post but...

LOL it is the same problem when i set the kick function into a timer xD

Im totally speechless xD

BigETI
01/01/2012, 05:11 AM
I prefer using a delayed Kick/Ban/BanEx with timers.

PawnoQ
01/01/2012, 05:16 AM
yeah, thats what i tryed lol...
the result was the same as before xD

I dont get it!