SA-MP Forums Archive
How to display total kicks and bans? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: How to display total kicks and bans? (/showthread.php?tid=235455)



How to display total kicks and bans? - grand.Theft.Otto - 05.03.2011

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.


Re: How to display total kicks and bans? - rjjj - 05.03.2011

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


Re: How to display total kicks and bans? - xRyder - 05.03.2011

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


Re: How to display total kicks and bans? - Markx - 05.03.2011

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++;


Re: How to display total kicks and bans? - grand.Theft.Otto - 05.03.2011

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!