Erro comando /kick
#1

Rapaziada eu coloquei esse comando /kick, mais quando vou testa ele nгo kika '-'

if(strcmp(cmdtext,"/kick",true) == 0)
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp))
{
if(PlayerInfo[playerid][pAdmin] >= 1 || PlayerInfo[playerid][pCbf] >= 1)
SendClientMessage(playerid,0xFFFFFFAA,"Use /Kick [ID/Nome][Motivo]");
return 1;
}
new kickado = strval(tmp);
new kickadoname[MAX_PLAYER_NAME];
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[256];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
if(!strlen(result))
{
SendClientMessage(playerid,BRANCO,"Use /Kick[ID][Motivo]");
return 1;
}
GetPlayerName(kickado,kickadoname,sizeof(kickadona me));
format(string,sizeof(string),"%s Foi Kickado Pelo %s %s, Motivo: %s",kickadoname,pNome(playerid),result);
SendClientMessageToAll(0xFFFFFFAA,string);
return 1;
}
Reply
#2

OBS: Minha primeira publicaзгo no fуrum, ainda nгo sei mexer aqui direito.
Reply
#3

PHP код:
if(strcmp(cmdtext,"/kick",true) == 0){
    
tmp strtok(cmdtext,idx);
    new 
motivo strtok(tmp,idx);
    if(!
strlen(tmp) || !strlen(motivo)){
        if(
PlayerInfo[playerid][pAdmin] > || PlayerInfo[playerid][pCbf] > 0){
            
SendClientMessage(playerid,0xFFFFFFAA,"Use /Kick [ID/Nome] [Motivo]");
            return 
1;
        }
    }
    new 
kickado strval(tmp);
    new 
kickadoname[MAX_PLAYER_NAME];
    if(!
IsPlayerConnected(kickado)){
        return 
SendClientMessage(playerid0xFFFFFFAA"Erro: O player nгo estб conectado.");
    }
    
GetPlayerName(kickado,kickadoname,sizeof(kickadoname));
    
format(string,sizeof(string),"%s foi kickado pelo %s. Motivo: %s",kickadoname,pNome(playerid),motivo);
    
SendClientMessageToAll(0xFFFFFFAA,string);
    return 
1;

Reply
#4

error 033: array must be indexed (variable "-unknown-")
error 035: argument type mismatch (argument 1)
2 erros
Reply
#5

Quote:
Originally Posted by Pxndx
Посмотреть сообщение
PHP код:
if(strcmp(cmdtext,"/kick",true) == 0){
    
tmp strtok(cmdtext,idx);
    new 
motivo strtok(tmp,idx);
    if(!
strlen(tmp) || !strlen(motivo)){
        if(
PlayerInfo[playerid][pAdmin] > || PlayerInfo[playerid][pCbf] > 0){
            
SendClientMessage(playerid,0xFFFFFFAA,"Use /Kick [ID/Nome] [Motivo]");
            return 
1;
        }
    }
    new 
kickado strval(tmp);
    new 
kickadoname[MAX_PLAYER_NAME];
    if(!
IsPlayerConnected(kickado)){
        return 
SendClientMessage(playerid0xFFFFFFAA"Erro: O player nгo estб conectado.");
    }
    
GetPlayerName(kickado,kickadoname,sizeof(kickadoname));
    
format(string,sizeof(string),"%s foi kickado pelo %s. Motivo: %s",kickadoname,pNome(playerid),motivo);
    
SendClientMessageToAll(0xFFFFFFAA,string);
    return 
1;

error 033: array must be indexed (variable "-unknown-")
error 035: argument type mismatch (argument 1)
2 erros
Reply
#6

qual sugestгo vocк utilizou?
Reply
#7

Quote:
Originally Posted by Pxndx
Посмотреть сообщение
qual sugestгo vocк utilizou?
sugestгo? '-
Reply
#8

tenta assim:
PHP код:
if(strcmp(cmdtext,"/kick",true) == 0){
    new 
motivo[128];
    
tmp strtok(cmdtext,idx);
    
motivo strtok(tmp,idx);
    if(!
strlen(tmp) || !strlen(motivo)){
        if(
PlayerInfo[playerid][pAdmin] > || PlayerInfo[playerid][pCbf] > 0){
            
SendClientMessage(playerid,0xFFFFFFAA,"Use /Kick [ID/Nome] [Motivo]");
            return 
1;
        }
    }
    new 
kickado strval(tmp);
    new 
kickadoname[MAX_PLAYER_NAME];
    if(!
IsPlayerConnected(kickado)){
        return 
SendClientMessage(playerid0xFFFFFFAA"Erro: O player nгo estб conectado.");
    }
    
GetPlayerName(kickado,kickadoname,sizeof(kickadoname));
    
format(string,sizeof(string),"%s foi kickado pelo %s. Motivo: %s",kickadoname,pNome(playerid),motivo);
    
SendClientMessageToAll(0xFFFFFFAA,string);
    
Kick(kickado);
    return 
1;

Reply
#9

Quote:
Originally Posted by Pxndx
Посмотреть сообщение
tenta assim:
PHP код:
if(strcmp(cmdtext,"/kick",true) == 0){
    new 
motivo[128];
    
tmp strtok(cmdtext,idx);
    
motivo strtok(tmp,idx);
    if(!
strlen(tmp) || !strlen(motivo)){
        if(
PlayerInfo[playerid][pAdmin] > || PlayerInfo[playerid][pCbf] > 0){
            
SendClientMessage(playerid,0xFFFFFFAA,"Use /Kick [ID/Nome] [Motivo]");
            return 
1;
        }
    }
    new 
kickado strval(tmp);
    new 
kickadoname[MAX_PLAYER_NAME];
    if(!
IsPlayerConnected(kickado)){
        return 
SendClientMessage(playerid0xFFFFFFAA"Erro: O player nгo estб conectado.");
    }
    
GetPlayerName(kickado,kickadoname,sizeof(kickadoname));
    
format(string,sizeof(string),"%s foi kickado pelo %s. Motivo: %s",kickadoname,pNome(playerid),motivo);
    
SendClientMessageToAll(0xFFFFFFAA,string);
    
Kick(kickado);
    return 
1;

Compilou, mais fui testa e nгo kikou
Reply
#10

@edit 20:16
PHP код:
if(strcmp(cmdtext,"/kick",true) == 0){
    new 
motivo[128];
    
tmp strtok(cmdtext,idx);
    
motivo strtok(tmp,idx);
    if(!
strlen(tmp) || !strlen(motivo)){
        if(
PlayerInfo[playerid][pAdmin] > || PlayerInfo[playerid][pCbf] > 0){
            
SendClientMessage(playerid,0xFFFFFFAA,"Use: /kick [ID/Nome] [Motivo]");
            return 
1;
        }
    }
    new 
kickado;
    new 
kickadoname[MAX_PLAYER_NAME];
    if(!
IsNumeric(tmp))
        
kickado GetPlayerID(tmp);
        
kickadoname tmp;
    else
        
kickado strval(tmp);
        
GetPlayerName(kickado,kickadoname,sizeof(kickadoname));
    if(!
IsPlayerConnected(kickado)){
        return 
SendClientMessage(playerid0xFFFFFFAA"Erro: O player nгo estб conectado.");
    }
    
format(string,sizeof(string),"%s foi kickado pelo %s. Motivo: %s",kickadoname,pNome(playerid),motivo);
    
SendClientMessageToAll(0xFFFFFFAA,string);
    
Kick(kickado);
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)