SA-MP Forums Archive
comando kick - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Español/Spanish (https://sampforum.blast.hk/forumdisplay.php?fid=29)
+---- Thread: comando kick (/showthread.php?tid=559080)



comando kick - gaara13 - 20.01.2015

ayuda estoy creando este comando para kick funciona bien lo unico que quier es que pida la razon del kick
ya e intentado de varias formas pero no me sale espero me puedan ayudar
desde ya gracias
este es el cуdigo normal como me funciona sin la razon
pawn Код:
if (strcmp("/kick", cmd, true, 10) == 0)
{

if (PlayerInfo[playerid][pAdmin] >= 2) {
GetPlayerName(playerid,NAME,MAX_PLAYER_NAME);
new kikeado[MAX_PLAYER_NAME];
new jugadork;
tmp = strtok(cmdtext, idx);
jugadork = strval(tmp);
if(!strlen(tmp)) return SendClientMessage(playerid, COLOR_RED, "[Error] USA: /kick [ID del jugador]");
if (strval(tmp) == playerid) return SendClientMessage(playerid, COLOR_RED, "[Error]: No te puedes kickear a ti mismo pendejo wey.");
if (IsPlayerConnected(jugadork))
{
GetPlayerName(jugadork,kikeado,MAX_PLAYER_NAME);
format(string,sizeof string," %s a sido kickeado por el admin %s por %s",kikeado,NAME);
SendClientMessageToAll(0xC4C4C4FF, string);
format(string,sizeof string,"Fuistes kickeado por el admin %s",NAME);
SendClientMessage(jugadork,0xC4C4C4FF, string);
Kick(jugadork);
}

}
return 1;
}

}



Respuesta: comando kick - jotajeda - 20.01.2015

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
//Kick Command
    if(strcmp("/kick", cmd, true) == 0)
    {
        if(IsPlayerAdmin(playerid)) {
            tmp = strtok(cmdtext,idx);
            if(!strlen(tmp) || strlen(tmp) > 5) {
                return SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /kick (id) [reason]");
            }
           
            new id = strval(tmp);

            if(!IsPlayerConnected(id)) {
                SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/kick : Bad player ID");
                return 1;
            }
           
            gMessage = strrest(cmdtext,idx);
           
            GetPlayerName(id,iName,sizeof(iName));
            SendClientMessage(id,ADMINFS_MESSAGE_COLOR,"-- You have been kicked from the server.");

            if(strlen(gMessage) > 0) {
                format(Message,sizeof(Message),"Reason: %s",gMessage);
                SendClientMessage(id,ADMINFS_MESSAGE_COLOR,Message);
            }
           
            format(Message,sizeof(Message),">> %s(%d) has been kicked.",iName,id);
            SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,Message);
           
            Kick(id);
            return 1;
        } else {
            SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/kick : You are not an admin");
            return 1;
        }
    }

    //Ban Command
    if(strcmp("/ban", cmd, true) == 0)
    {
        if(IsPlayerAdmin(playerid)) {
            tmp = strtok(cmdtext,idx);
            if(!strlen(tmp) || strlen(tmp) > 5) {
                return SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /ban (id) [reason]");
            }

            new id = strval(tmp);

            if(!IsPlayerConnected(id)) {
                SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/ban : Bad player ID");
                return 1;
            }

            gMessage = strrest(cmdtext,idx);

            GetPlayerName(id,iName,sizeof(iName));
            SendClientMessage(id,ADMINFS_MESSAGE_COLOR,"-- You have been banned from the server.");

            if(strlen(gMessage) > 0) {
                format(Message,sizeof(Message),"Reason: %s",gMessage);
                SendClientMessage(id,ADMINFS_MESSAGE_COLOR,Message);
            }

            format(Message,sizeof(Message),">> %s(%d) has been banned.",iName,id);
            SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,Message);

            Ban(id);
            return 1;
        } else {
            SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/ban : You are not an admin");
            return 1;
        }
    }
   
    return 0;
}
https://sampforum.blast.hk/showthread.php?tid=244458


Respuesta: comando kick - gaara13 - 21.01.2015

Quote:
Originally Posted by jotajeda
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
//Kick Command
    if(strcmp("/kick", cmd, true) == 0)
    {
        if(IsPlayerAdmin(playerid)) {
            tmp = strtok(cmdtext,idx);
            if(!strlen(tmp) || strlen(tmp) > 5) {
                return SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /kick (id) [reason]");
            }
           
            new id = strval(tmp);

            if(!IsPlayerConnected(id)) {
                SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/kick : Bad player ID");
                return 1;
            }
           
            gMessage = strrest(cmdtext,idx);
           
            GetPlayerName(id,iName,sizeof(iName));
            SendClientMessage(id,ADMINFS_MESSAGE_COLOR,"-- You have been kicked from the server.");

            if(strlen(gMessage) > 0) {
                format(Message,sizeof(Message),"Reason: %s",gMessage);
                SendClientMessage(id,ADMINFS_MESSAGE_COLOR,Message);
            }
           
            format(Message,sizeof(Message),">> %s(%d) has been kicked.",iName,id);
            SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,Message);
           
            Kick(id);
            return 1;
        } else {
            SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/kick : You are not an admin");
            return 1;
        }
    }

    //Ban Command
    if(strcmp("/ban", cmd, true) == 0)
    {
        if(IsPlayerAdmin(playerid)) {
            tmp = strtok(cmdtext,idx);
            if(!strlen(tmp) || strlen(tmp) > 5) {
                return SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"Usage: /ban (id) [reason]");
            }

            new id = strval(tmp);

            if(!IsPlayerConnected(id)) {
                SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/ban : Bad player ID");
                return 1;
            }

            gMessage = strrest(cmdtext,idx);

            GetPlayerName(id,iName,sizeof(iName));
            SendClientMessage(id,ADMINFS_MESSAGE_COLOR,"-- You have been banned from the server.");

            if(strlen(gMessage) > 0) {
                format(Message,sizeof(Message),"Reason: %s",gMessage);
                SendClientMessage(id,ADMINFS_MESSAGE_COLOR,Message);
            }

            format(Message,sizeof(Message),">> %s(%d) has been banned.",iName,id);
            SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,Message);

            Ban(id);
            return 1;
        } else {
            SendClientMessage(playerid,ADMINFS_MESSAGE_COLOR,"/ban : You are not an admin");
            return 1;
        }
    }
   
    return 0;
}
https://sampforum.blast.hk/showthread.php?tid=244458
ok gracias amigo
probare