SA-MP Forums Archive
Count. /kick & /ban. - 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: Count. /kick & /ban. (/showthread.php?tid=232166)



Count. /kick & /ban. - iGetty - 27.02.2011

Is there a way to get a count, for example: The total amout of players kicked from this server is [number]..?

To only be show, on the /kick command? And the same again for /ban?

Thankyou.


Re: Count. /kick & /ban. - admantis - 27.02.2011

pawn Код:
new KickAndBans = 0;
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    if (reason == 2) { KickAndBans += 1; }
    return 1;
}
pawn Код:
stock DisplayKickAndBans(playerid)
{
    new string[64];
    format(string, sizeof(string), "There has been %i kick and bans", KickAndBans);
    SendClientMessage(playerid, 0xFFFFFFFF, string);
    return 1;
}
Althought you can make separate variables, one for bans and other for kicks, this one counts both in one.


Re: Count. /kick & /ban. - iGetty - 27.02.2011

Quote:
Originally Posted by admantis
Посмотреть сообщение
pawn Код:
new KickAndBans = 0;
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    if (reason == 2) { KickAndBans += 1; }
    return 1;
}
pawn Код:
stock DisplayKickAndBans(playerid)
{
    new string[64];
    format(string, sizeof(string), "There has been %i kick and bans", KickAndBans);
    SendClientMessage(playerid, 0xFFFFFFFF, string);
    return 1;
}



Althought you can make separate variables, one for bans and other for kicks, this one counts both in one.
Bro, how do i do this, how could I put this into a FS?


Re: Count. /kick & /ban. - grand.Theft.Otto - 02.03.2011

Quote:
Originally Posted by getty154
Посмотреть сообщение
Bro, how do i do this, how could I put this into a FS?
pawn Код:
new KickAndBans = 0; //Put this at the top of your script under #include <a_samp>
pawn Код:
if (reason == 2) { KickAndBans += 1; }
return 1; // put these 2 lines under OnPlayerDisconnect
pawn Код:
stock DisplayKickAndBans(playerid)
{
    new string[64];
    format(string, sizeof(string), "There has been %i kick and bans", KickAndBans);
    SendClientMessage(playerid, 0xFFFFFFFF, string);
    return 1;
} // Put this function anywhere in your script, the very bottom is recommended.



Re: Count. /kick & /ban. - Lorrden - 02.03.2011

Quote:

if (reason == 2) { KickAndBans += 1; }

Why not simply:
pawn Код:
if(reason == 2) KickAndBans++;



Re: Count. /kick & /ban. - admantis - 02.03.2011

Quote:
Originally Posted by Lorrden
Посмотреть сообщение
Why not simply:
pawn Код:
if(reason == 2) KickAndBans++;
Wait, are you kidding?
It's the SAME thing. No difference, but my STYLE is different than you.
Stop kidding arround.


Re: Count. /kick & /ban. - [NRP]Blade - 02.03.2011

I could put this in a FS, if you still need it.


Re: Count. /kick & /ban. - iGetty - 02.03.2011

If you could?


Re: Count. /kick & /ban. - [NRP]Blade - 02.03.2011

Here ya are:
SolidFiles: http://solidfiles.com/d/b2ac/
Notesbin: http://notesbin.com/1215213861


Re: Count. /kick & /ban. - Lorrden - 02.03.2011

Quote:
Originally Posted by admantis
Посмотреть сообщение
Wait, are you kidding?
It's the SAME thing. No difference, but my STYLE is different than you.
Stop kidding arround.
I know it's the same thing, but why make it more complicated than it really is?