You'd need to use some basic PHP and MySQL ( dunno if it's possible with samp.ban )...
Here is just a simple
example /ban command saving to a database called "whatever your DB is" and table called "bans" with g-Stlyezzz's MySQL plugin and 3 fields called "nick", "banned" and "bannedreason", also using ZCMD and sscanf:
pawn Код:
CMD:ban( playerid, params[ ] )
{
new
id,
reason[ 128 ]
;
if( sscanf( params, "us[128]", id, reason ) )
return SendClientMessage( playerid, 0xAAAAAAAA, "USAGE: /ban [ID] [Reason]" );
if( !IsPlayerConnected( id ) )
return SendClientMessage( playerid, 0xAAAAAAAA, "Invalid ID" );
new
query[ 128 ],
playername[ 24 ]
;
GetPlayerName( id, playername, 24 );
format( query, sizeof query, "INSERT INTO `bans` (`nick`, `banned`, `bannedreason`) VALUES (%s, 1, '%s')", playername, reason );
mysql_query( query );
return 1;
}
public OnPlayerConnect( playerid )
{
new
query[ 128 ],
playername[ 24 ],
escplayername[ 24 ]
;
GetPlayerName( playerid, playername, 24 );
mysql_real_escape_string( playername, escplayername );
format( query, sizeof query, "SELECT * FROM `bans` WHERE `nick` = '%s'", escplayername );
mysql_query( query );
mysql_store_result( );
if( mysql_num_rows( ) != 0 ) // Ban found
{
SendClientMessage( playerid, 0xAAAAAAAA, "Banned from this server! " );
Kick( playerid );
}
mysql_free_result( );
return 1;
}
Untested^^, just wrote it quickly here.
For PHP, I won't teach u that. Read some MySQL tuts from [HiC]TheKiller, some of them have some PHP stuff.
By the way, ****** is a grammar nazi
![Shocked](images/smilies/surprised.gif)
?
EDITED: optimized the code, and did it the diffrent way.