[Problema] /kick y /ban
#1

pawn Код:
CMD:ban(playerid, params[])
{
    new targetid, reason[64], string[128], string3[128], string2[MAX_PLAYER_NAME];
    if(pInfo[playerid][pAdmin] == 0) return SCM(playerid, COLOR_RED, "You are not admin or you're not authorized.");
    if(sscanf(params, "us[64]", targetid, reason)) return SCM(playerid, -1, "{32CD32}Use:{FFFFFF} /ban (playerid) (reason).");
    if(!IsPlayerConnected(targetid)) return SCM(playerid, COLOR_RED, "Player is not connected.");
    format(string3, sizeof(string3), "{FF8C00}Admin {DC143C}%s (%d) {FF8C00}has banned {DC143C}%s (%d) {FF8C00}(reason: {DC143C}%s{FF8C00}).", GetName(playerid), playerid, GetName(params[0]), targetid, reason);
    SCMToAll(-1, string3);
    BanEx(targetid);
    return 1;
}
CMD:kick(playerid, params[])
{
    new targetid, reason[64], string[128];
    if(pInfo[playerid][pAdmin] == 0) return SCM(playerid, COLOR_RED, "You are not admin or you're not authorized.");
    if(sscanf(params, "us[64]", targetid, reason)) return SCM(playerid, -1, "{32CD32}Use:{FFFFFF} /kick (playerid) (reason).");
    if(!IsPlayerConnected(targetid)) return SCM(playerid, COLOR_RED, "Player is not connected.");
    format(string, sizeof(string), "{FF8C00}Admin {DC143C}%s (%d) {FF8C00}has kicked {DC143C}%s (%d) {FF8C00}(reason: {DC143C}%s{FF8C00}).", GetName(playerid), playerid, GetName(targetid), targetid, reason);
    SCMToAll(-1, string);
    KickEx(targetid);
    return 1;
}
En cualquiera de йstos dos comandos no se muestra el nombre del jugador kickeado / baneado.

їCуmo lo arreglo? D:
Reply
#2

pawn Код:
CMD:ban(playerid, params[])
{
    new targetid, reason[64], string[128], string3[128], string2[MAX_PLAYER_NAME];
    if(pInfo[playerid][pAdmin] == 0) return SCM(playerid, COLOR_RED, "You are not admin or you're not authorized.");
    if(sscanf(params, "us[64]", targetid, reason)) return SCM(playerid, -1, "{32CD32}Use:{FFFFFF} /ban (playerid) (reason).");
    if(!IsPlayerConnected(targetid)) return SCM(playerid, COLOR_RED, "Player is not connected.");
    format(string3, sizeof(string3), "{FF8C00}Admin {DC143C}%s (%d) {FF8C00}has banned {DC143C}%s (%d) {FF8C00}(reason: {DC143C}%s{FF8C00}).", GetPlayerName(playerid), playerid, GetPlayerName(targetid), targetid, reason);
    SCMToAll(-1, string3);
    BanEx(targetid);
    return 1;
}
CMD:kick(playerid, params[])
{
    new targetid, reason[64], string[128];
    if(pInfo[playerid][pAdmin] == 0) return SCM(playerid, COLOR_RED, "You are not admin or you're not authorized.");
    if(sscanf(params, "us[64]", targetid, reason)) return SCM(playerid, -1, "{32CD32}Use:{FFFFFF} /kick (playerid) (reason).");
    if(!IsPlayerConnected(targetid)) return SCM(playerid, COLOR_RED, "Player is not connected.");
    format(string, sizeof(string), "{FF8C00}Admin {DC143C}%s (%d) {FF8C00}has kicked {DC143C}%s (%d) {FF8C00}(reason: {DC143C}%s{FF8C00}).", GetPlayerName(playerid), playerid, GetPlayerName(targetid), targetid, reason);
    SCMToAll(-1, string);
    KickEx(targetid);
    return 1;
}
PD: En el CMD:ban declaras 2 variables que no usas... string y string2
Reply
#3

Es por un bug que hay en la versiуn actual de SA-MP, asi se arregla:

PHP код:
forward KickPublic(playerid);
public 
KickPublic(playerid) { Kick(playerid); }
 
stock KickWithMessage(playeridmessage[])
{
    
SendClientMessage(playerid0xFF4444FFmessage);
    
SetTimerEx("KickPublic"10000"d"playerid);     //Delay of 1 second before kicking the player so he recieves the message
}
 
public 
OnPlayerCommandText(playeridcmdtext[])
{
    if(
strcmp(cmdtext"/kickme"true) == 0)
    {
        
//Kicks the player who the executed this command
        
KickWithMessage(playerid"You have been kicked.");
        return 
1;
    }
    return 
0;

Reply
#4

@jwalker: Lo que tъ dices es que el jugador kickeado no ve el mensaje, pero ese no era el problema, igual gracias.

@Dreyfuz: Solucionado, gracias.
Reply
#5

Quote:
Originally Posted by Loox
Посмотреть сообщение
@jwalker: Lo que tъ dices es que el jugador kickeado no ve el mensaje, pero ese no era el problema, igual gracias.

@Dreyfuz: Solucionado, gracias.
Denada y acordate lo que te dije de las variables,.. si no lo usas borrala que usan memoria al pedo..
Reply
#6

Cierto, para que llege el mensaje a un jugador que es expulsado o obtenga su nombre, en esta versiуn no funciona. Tienes que hacerlo con timer.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)