stock BanPlayer( DB:Database, PlayerID, AdminID, Reason[ ] )
{
if ( Database )
{
new Query [ 512 ],
DBResult:Result,
Name [ MAX_PLAYER_NAME ],
Banner [ MAX_PLAYER_NAME ],
pIP [ 16 ],
t1, t2, t3;
if ( AdminID == 1000 )
Banner = "Admin";
else if ( AdminID == INVALID_PLAYER_ID )
Banner = "Desconocido";
else
GetPlayerName( AdminID, Banner, MAX_PLAYER_NAME );
gettime( t1, t2, t3 );
GetPlayerName( PlayerID, Name, MAX_PLAYER_NAME );
GetPlayerIp( PlayerID, pIP, 16 );
format( Query, sizeof( Query ), "INSERT INTO lva_bans(name,reporter,reason,ip,time,type) values(\
lower('%s'), '%s', '%s', '%s', strftime('%%s','now'),2\
);\
", Name, Banner, Reason, pIP );
Result = db_query( Database, Query );
db_free_result( Result );
format( Query, sizeof( Query ), ">> %s (ID: %d) has banned %s (ID: %d) for: %s", Banner, AdminID, Name, PlayerID, Reason );
SendClientMessageToAll( COLOR_ORANGE, Query );
SendClientMessage( PlayerID, COLOR_YELLOW, ЎHAS SIDO BANEADO!");
format( Query, sizeof( Query ), ">> Admin : %s", Banner );
SendClientMessage( PlayerID, COLOR_ORANGE, Query );
format( Query, sizeof( Query ), ">> Motivo: %s", Reason );
SendClientMessage( PlayerID, COLOR_ORANGE, Query );
SendClientMessage( PlayerID, COLOR_YELLOW, "Comunica tu ban a un administrador si quieres recuperar tu cuenta" );
if ( IsUserRegistered( Database, Name ) )
{
format( Query, sizeof( Query ), "UPDATE `lva_users` SET `banned`=1 WHERE `name`=lower('%s')", Name );
Result = db_query( Database, Query );
db_free_result( Result );
Kick( PlayerID );
printf( "[acc-ban] %s (IP: %s) baneado por %s por %s.", Name, pIP, Banner, Reason );
}
else
{
Ban ( PlayerID );
Kick ( PlayerID );
printf ( "[ip-ban] %s (IP: %s) was banned by %s for the reason %s.", Name, pIP, Banner, Reason );
}
format ( Query, sizeof( Query ), "[banreason] %s %s %s [IP:%s]", Banner, Name, Reason, pIP );
add_log ( Query );
return 1;
}
else
{
print( "[ERROR] NO DATABASE!" );
return 0;
}
}
stock KickPlayer( DB:Database, PlayerID, AdminID, Reason[ ] )
{
if ( Database )
{
new Query [ 512 ],
DBResult:Result,
Name [ MAX_PLAYER_NAME ],
Kicker [ MAX_PLAYER_NAME ],
pIP [ 16 ],
t1, t2, t3;
if ( AdminID == 1000 )
Kicker = "Admin";
else if ( AdminID == INVALID_PLAYER_ID )
Kicker = "Desconocido";
else
GetPlayerName( AdminID, Kicker, MAX_PLAYER_NAME );
gettime( t1, t2, t3 );
GetPlayerName( PlayerID, Name, MAX_PLAYER_NAME );
GetPlayerIp( PlayerID, pIP, 16 );
format( Query, sizeof( Query ), "INSERT INTO lva_bans(name,reporter,reason,ip,time,type) values(\
'%s', '%s', '%s', '%s', strftime('%%s','now'),1\
);\
", Name, Kicker, Reason, pIP );
Result = db_query( Database, Query );
db_free_result( Result );
format( Query, sizeof( Query ), ">> %s (ID: %d) expulsa a %s (ID: %d) por: %s", Kicker, AdminID, Name, PlayerID, Reason );
SendClientMessageToAll( COLOR_ORANGE, Query );
SendClientMessage( PlayerID, COLOR_YELLOW, "ЎHAS SIDO EXPULSADO!");
format( Query, sizeof( Query ), ">> Admin : %s", Kicker );
SendClientMessage( PlayerID, COLOR_ORANGE, Query );
format( Query, sizeof( Query ), ">> Motivo: %s", Reason );
SendClientMessage( PlayerID, COLOR_ORANGE, Query );
SendClientMessage( PlayerID, COLOR_YELLOW, "Procura que no vuelva a suceder!" );
Kick( PlayerID );
printf( "[kick] %s (IP: %s) expulsado por %s por %s.", Name, pIP, Kicker, Reason );
format( Query, sizeof( Query ), "[kickreason] %s %s %s [IP:%s]", Kicker, Name, Reason, pIP );
add_log( Query );
return 1;
}
else
{
print( "[ERROR] NO DATABASE!" );
return 0;
}
}
forward KickJugador(playerid); public KickJugador(playerid) { Kick(playerid); return 1; } public OnPlayerConnect(playerid) { SendClientMessage(playerid, -1, "Expulsado!!"); SetTimerEx("KickJugador", 600, false, "i", playerid); return 1; }
forward KickJugador(playerid); public KickJugador(playerid) { Kick(playerid); return 1; } stock KickPlayer( DB:Database, PlayerID, AdminID, Reason[ ] ) { if ( Database ) { new Query [ 512 ], DBResult:Result, Name [ MAX_PLAYER_NAME ], Kicker [ MAX_PLAYER_NAME ], pIP [ 16 ], t1, t2, t3; if ( AdminID == 1000 ) Kicker = "Admin"; else if ( AdminID == INVALID_PLAYER_ID ) Kicker = "Desconocido"; else GetPlayerName( AdminID, Kicker, MAX_PLAYER_NAME ); gettime( t1, t2, t3 ); GetPlayerName( PlayerID, Name, MAX_PLAYER_NAME ); GetPlayerIp( PlayerID, pIP, 16 ); format( Query, sizeof( Query ), "INSERT INTO lva_bans(name,reporter,reason,ip,time,type) values(\ '%s', '%s', '%s', '%s', strftime('%%s','now'),1\ );\ ", Name, Kicker, Reason, pIP ); Result = db_query( Database, Query ); db_free_result( Result ); format( Query, sizeof( Query ), ">> %s (ID: %d) expulsa a %s (ID: %d) por: %s", Kicker, AdminID, Name, PlayerID, Reason ); SendClientMessageToAll( COLOR_ORANGE, Query ); SendClientMessage( PlayerID, COLOR_YELLOW, "ЎHAS SIDO EXPULSADO!"); format( Query, sizeof( Query ), ">> Admin : %s", Kicker ); SendClientMessage( PlayerID, COLOR_ORANGE, Query ); format( Query, sizeof( Query ), ">> Motivo: %s", Reason ); SendClientMessage( PlayerID, COLOR_ORANGE, Query ); SendClientMessage( PlayerID, COLOR_YELLOW, "Procura que no vuelva a suceder!" ); SetTimerEx("KickJugador", 1000, false, "i", PlayerID); printf( "[kick] %s (IP: %s) expulsado por %s por %s.", Name, pIP, Kicker, Reason ); format( Query, sizeof( Query ), "[kickreason] %s %s %s [IP:%s]", Kicker, Name, Reason, pIP ); add_log( Query ); return 1; } else { print( "[ERROR] NO DATABASE!" ); return 0; } }
stock KickPlayer( DB:Database, PlayerID, AdminID, Reason[ ] )
{
if ( Database )
{
new Query [ 512 ],
DBResult:Result,
Name [ MAX_PLAYER_NAME ],
Kicker [ MAX_PLAYER_NAME ],
pIP [ 16 ],
t1, t2, t3;
if ( AdminID == 1000 )
Kicker = "Admin";
else if ( AdminID == INVALID_PLAYER_ID )
Kicker = "Desconocido";
else
GetPlayerName( AdminID, Kicker, MAX_PLAYER_NAME );
gettime( t1, t2, t3 );
GetPlayerName( PlayerID, Name, MAX_PLAYER_NAME );
GetPlayerIp( PlayerID, pIP, 16 );
format( Query, sizeof( Query ), "INSERT INTO lva_bans(name,reporter,reason,ip,time,type) values(\
'%s', '%s', '%s', '%s', strftime('%%s','now'),1\
);\
", Name, Kicker, Reason, pIP );
Result = db_query( Database, Query );
db_free_result( Result );
format( Query, sizeof( Query ), ">> %s (ID: %d) expulsa a %s (ID: %d) por: %s", Kicker, AdminID, Name, PlayerID, Reason );
SendClientMessageToAll( COLOR_ORANGE, Query );
SendClientMessage( PlayerID, COLOR_YELLOW, "ЎHAS SIDO EXPULSADO!");
format( Query, sizeof( Query ), ">> Admin : %s", Kicker );
SendClientMessage( PlayerID, COLOR_ORANGE, Query );
format( Query, sizeof( Query ), ">> Motivo: %s", Reason );
SendClientMessage( PlayerID, COLOR_ORANGE, Query );
SendClientMessage( PlayerID, COLOR_YELLOW, "Procura que no vuelva a suceder!" );
SetTimerEx("expulsar",500,false,"d",PlayerID);
printf( "[kick] %s (IP: %s) expulsado por %s por %s.", Name, pIP, Kicker, Reason );
format( Query, sizeof( Query ), "[kickreason] %s %s %s [IP:%s]", Kicker, Name, Reason, pIP );
add_log( Query );
return 1;
}
else
{
print( "[ERROR] NO DATABASE!" );
return 0;
}
}
forward expulsar(playerid);
public expulsar(playerid)
{
Kick(playerid);
return true;
}
Originally Posted by Nota Importante
A partir de SA-MP 0.3x, cualquier acciуn no funcionarб; se deberб de usar un timer para retrasar la funciуn Kick(). Por ejemplo, el envнo de un mensaje con SendClientMessage antes de Kick() no funcionarб.
|
stock Fix_Kick(playerid) SetTimerEx("kick_fix",1000,false,"d",playerid);
forward kick_fix(playerid); public kick_fix(playerid) Kick(playerid);
#define Fix_Kick Kick