05.01.2015, 02:34
Bueno, veran es que me ha gustado el mensaje de ban y kick de un gamemode y he decidido sacarlo e incorporarlo al mio, sucede que el /ban funciona bien, pero el kick no, solo pone "Server closed conection." sin la informaciуn que quiero, no se porque no funciona (el kick).
Aqui el ban (que si funciona)
Aqui el kick (no funciona)
He intentado de varias maneras cambiando unas cosillas pero sigue igual, no funciona el kick y el ban si.
їAlguien me puede decir en que falla?
Saludos!
Aqui el ban (que si funciona)
pawn Код:
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;
}
}
pawn Код:
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;
}
}
їAlguien me puede decir en que falla?
Saludos!