[AJUDA] Comandos /kick e /ban -
Niko_Bellik - 29.09.2011
Eu sei fazer o comando, sу o que nгo sei mesmo й fazer a mensagem para todos os players como por exemplo:
" O Admin %s kickou %s pelo motivo: [mensagem do adm]".
Alguem poderia dar uma ajuda ai pra fazer o /kick com a mensagem exatamente como mostrei acima?
Obg! D:
Respuesta: [AJUDA] Comandos /kick e /ban -
ReDKiiL - 29.09.2011
poderia postar o codigo de comando?
ou senao:
pawn Код:
new nome1[MAX_PLAYER_NAME],nome2[MAX_PLAYER_NAME],string[50];
GetPlayerName(playerid,nome1,MAX_PLAYER_NAME);
GetPlayerName(id do outro player que й pego no comando,nome1,MAX_PLAYER_NAME);
format(string, sizeof(string),"o Admin %s Kickou %s",nome1,nome2);
SendClientMessageToAll(-1,string);
Acho Que й Isso
Re: Respuesta: [AJUDA] Comandos /kick e /ban -
Niko_Bellik - 29.09.2011
Quote:
Originally Posted by ReDKiiL
poderia postar o codigo de comando?
ou senao:
pawn Код:
new nome1[MAX_PLAYER_NAME],nome2[MAX_PLAYER_NAME],string[50]; GetPlayerName(playerid,nome1,MAX_PLAYER_NAME); GetPlayerName(id do outro player que й pego no comando,nome1,MAX_PLAYER_NAME); format(string, sizeof(string),"o Admin %s Kickou %s",nome1,nome2); SendClientMessageToAll(-1,string);
Acho Que й Isso ![Smiley](images/smilies/smile.png)
|
Nгo й isso, eu quero tipo, digito la /KICK [ID DO PLAYER] [MOTIVO: ] entendeu?
Nгo para um player especifico
Respuesta: [AJUDA] Comandos /kick e /ban -
ReDKiiL - 29.09.2011
https://sampforum.blast.hk/showthread.php?tid=286550 Tutorial Do Shick Ensina Isso
Re: [AJUDA] Comandos /kick e /ban -
CyNiC - 29.09.2011
Eu nгo aprendi com ele.
Re: Respuesta: [AJUDA] Comandos /kick e /ban -
Niko_Bellik - 29.09.2011
Quote:
Originally Posted by ReDKiiL
|
Qualidade do vнdeo tava ruim, nгo deu pra ver nada que estava escrito..
Respuesta: [AJUDA] Comandos /kick e /ban -
ReDKiiL - 29.09.2011
Eu Uso ZCMD e SSCANF. e Nao Sei usar STRTOK.
mais tem tutorial no wiki й so traduzir a pagina ae.
https://sampwiki.blast.hk/wiki/Tutorial_of_strtok
Re: [AJUDA] Comandos /kick e /ban -
Jason` - 29.09.2011
Coloque isso no game mode pra nгo precisar ficar dando GetPlayerName em si mesmo:
pawn Код:
stock pNome(playerid)
{
new nome[MAX_PLAYER_NAME];
GetPlayerName(playerid, nome, sizeof(nome));
return nome;
}
Agora:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext)
{
new tmp[256];//ainda nao entendo mto quanto as celulas
new idx;
new string[256]//nao entendo mto quanto as celular
if(strcmp(cmdtext,"/ban",true) == 0)
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,0xFFFFFFAA,"Use /Ban [ID/Nome][Motivo]");
return 1;
}
new banido = strval(tmp);
new banidoname[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 /Ban [ID/Nome][Motivo]");
return 1;
}
GetPlayerName(banido,banidoname,sizeof(banidoname));
format(string,sizeof(string),"%s Foi Banido Pelo Admin %s, Motivo: %s",banidoname,pNome(playerid),result);
SendClientMessageToAll(0xFFFFFFAA,string);
Ban(banido);
return 1;
}
if(strcmp(cmdtext,"/kick",true) == 0)
{
tmp = strtok(cmdtext,idx);
if(!strlen(tmp))
{
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(kickadoname));
format(string,sizeof(string),"%s Foi Kickado Pelo Admin %s, Motivo: %s",kickadoname,pNome(playerid),result);
SendClientMessageToAll(0xFFFFFFAA,string);
return 1;
}
return 0;
}
Tente Isso!
Re: [AJUDA] Comandos /kick e /ban -
Niko_Bellik - 29.09.2011
Quote:
Originally Posted by Pedro_Miranda
Coloque isso no game mode pra nгo precisar ficar dando GetPlayerName em si mesmo:
pawn Код:
stock pNome(playerid) { new nome[MAX_PLAYER_NAME]; GetPlayerName(playerid, nome, sizeof(nome)); return nome; }
Agora:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext) { new tmp[256];//ainda nao entendo mto quanto as celulas new idx; new string[256]//nao entendo mto quanto as celular if(strcmp(cmdtext,"/ban",true) == 0) { tmp = strtok(cmdtext,idx); if(!strlen(tmp)) { SendClientMessage(playerid,0xFFFFFFAA,"Use /Ban [ID/Nome][Motivo]"); return 1; } new banido = strval(tmp); new banidoname[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 /Ban [ID/Nome][Motivo]"); return 1; } GetPlayerName(banido,banidoname,sizeof(banidoname)); format(string,sizeof(string),"%s Foi Banido Pelo Admin %s, Motivo: %s",banidoname,pNome(playerid),result); SendClientMessageToAll(0xFFFFFFAA,string); Ban(banido); return 1; } if(strcmp(cmdtext,"/kick",true) == 0) { tmp = strtok(cmdtext,idx) if(!strlen(tmp)) { 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(kickadoname)); format(string,sizeof(string),"%s Foi Kickado Pelo Admin %s, Motivo: %s",kickadoname,pNome(playerid),result); SendClientMessageToAll(0xFFFFFFAA,string); return 1; } return 0; }
Tente Isso!
|
Код:
C:\Users\Felipe\Documents\Server Samp\gamemodes\BRASILTDM.pwn(725) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Users\Felipe\Documents\Server Samp\gamemodes\BRASILTDM.pwn(726) : error 001: expected token: ";", but found "if"
C:\Users\Felipe\Documents\Server Samp\gamemodes\BRASILTDM.pwn(728) : error 017: undefined symbol "strtok"
C:\Users\Felipe\Documents\Server Samp\gamemodes\BRASILTDM.pwn(728) : error 033: array must be indexed (variable "tmp")
C:\Users\Felipe\Documents\Server Samp\gamemodes\BRASILTDM.pwn(761) : error 017: undefined symbol "strtok"
C:\Users\Felipe\Documents\Server Samp\gamemodes\BRASILTDM.pwn(761 -- 762) : error 033: array must be indexed (variable "tmp")
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
5 Errors.
Re: [AJUDA] Comandos /kick e /ban -
Lipe_Stronda - 29.09.2011
pawn Код:
strtok(const string[], &index)
{
new length = strlen(string);
while ((index < length) && (string[index] <= ' '))
{
index++;
}
new offset = index;
new result[20];
while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
{
result[index - offset] = string[index];
index++;
}
result[index - offset] = EOS;
return result;
}