How to display total kicks and bans?
#1

Say when I /kicked someone, I want it to show all kicks in total, and if I /ban someone it will show total bans.

Like so:

/kick 0

pawn Код:
format(string,sizeof string,"*There Has Been %d Kicks In Total.",kicks);
SendClientMessageToAll(COLOR_PINK,string);
or something similar to that lol... I also need one for total of bans but I don't know how to format the code for number of kicks and bans.

Thanks.
Reply
#2

Just create variables to count the number of kicks and bans.

I did it for you . Put:

pawn Код:
//In the top of your Gamemode:

new Kicks,Bans;


//In your kick command:

Kick++;



//In your ban command:

Bans++;

And, finally, use this to see the total:

pawn Код:
if(strcmp("/display",cmdtext,true,8)==0)
    {
        new txt[70];
        SendClientMessage(playerid,0xFFFFFFAA,"/=======[Kicks and Bans Display]=======/");
        format(txt,70,"Total Kicks done: %d", Kicks);
        SendClientMessage(playerid,0xFFFFFFAA,txt);
        format(txt,70,"Total Bans done: %d", Bans);
        SendClientMessage(playerid,0xFFFFFFAA,txt);
        return 1;
    }
I hope that i have helped
Reply
#3

Make something like count system...

pawn Код:
new kicks = 0;//on top of your script

//and the in a command, let's say /kick
CMD:kick()
{
kick(playerid);
kicks++;
format(string,sizeof string,"*There Has Been %d Kicks In Total.",kicks);
SendClientMessageToAll(COLOR_PINK,string);
}
^This code doesn't work! Edit it as you want, I'm just trying to give you an idea...

Edit: rjjj was faster
Reply
#4

Quote:
Originally Posted by rjjj
Посмотреть сообщение
Just create variables to count the number of kicks and bans.

I did it for you . Put:

pawn Код:
//In the top of your Gamemode:

new Kicks,Bans;


//In your kick command:

Kick++;



//In your ban command:

Bans++;

And, finally, use this to see the total:

pawn Код:
if(strcmp("/display",cmdtext,true,8)==0)
    {
        new txt[70];
        SendClientMessage(playerid,0xFFFFFFAA,"/=======[Kicks and Bans Display]=======/");
        format(txt,70,"Total Kicks done: %d", Kicks);
        SendClientMessage(playerid,0xFFFFFFAA,txt);
        format(txt,70,"Total Bans done: %d", Bans);
        SendClientMessage(playerid,0xFFFFFFAA,txt);
        return 1;
    }
I hope that i have helped
If you made new Kicks, Bans

Then it has to be Kicks++;
Reply
#5

Quote:
Originally Posted by Markx
Посмотреть сообщение
If you made new Kicks, Bans

Then it has to be Kicks++;
Thanks, I noticed that missing letter in the variable too, I'll make sure to remember it.


Thanks all, I'll try it out!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)