[Ajuda] /kick e /ban aparecer para o player
#1

Fala aк galera to ai mais uma vez incomodando vcs, seguinte: jб tentei de diversas formas que o /kick e o /ban ANTES de dar "server closed conection" aparece para o player que ele foi banido/kickado e o motivo. Mas nunca dб certo e antes de ele poder ver a msg de ban/kick ele sai do sv primeiro.
Alguem me ajuda a ver o q estб errado? vlw

/kick:

pawn Код:
if(strcmp(cmd, "/kick", true) == 0) {
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), PASTA_CONTAS, aname);
if(pAdmin[playerid] == 1 || pAdmin[playerid] == 2 || pAdmin[playerid] == 3 || pAdmin[playerid] == 4 || pAdmin[playerid] == 5 || IsPlayerAdmin(playerid)){
new tmp[256];
new plid;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, Vermelho, "Digite: /kick [id] [motivo]");
return 1;
}
plid = strval(tmp);
if(IsPlayerConnected(plid)){
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' ')) {
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) {
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, Vermelho, "Uso: /kick [id] [motivo]");
}else{
new pname[MAX_PLAYER_NAME];
GetPlayerName(plid, pname, MAX_PLAYER_NAME);
if(pAdmin[playerid] == 1){
format(string, sizeof(string), "[KICK]%s kickou %s, Motivo: (%s)", aname, pname);
MsgLog(string);
format(string, sizeof(string), "| INFO-SERVER | O Administrador %s kickou o jogador: %s (Motivo: %s)", aname,pname,result);
SendClientMessageToAll(AdminCor, string);
kick[plid]=1;
SetPlayerColor(plid,0xFFFFFFAA);
Kick(plid);
return 1;
}
format(string, sizeof(string), "[KICK]%s kickou %s, Motivo: (%s)", aname, pname);
MsgLog(string);
format(string, sizeof(string), "| INFO-SERVER | O Administrador %s kickou o jogador: %s (Motivo: %s)", aname,pname,result);
SendClientMessageToAll(AdminCor, string);
kick[plid]=1;
SetPlayerColor(plid,0xFFFFFFAA);
Kick(plid);
}
}else{
format(string, sizeof(string), "** ID invбlido!", plid);
SendClientMessage(playerid, Vermelho, string);
}
}
return 1;
}
/ban

pawn Код:
if(strcmp(cmd, "/ban", true) == 0) {
new aname[MAX_PLAYER_NAME];
GetPlayerName(playerid, aname, MAX_PLAYER_NAME);
format(file, sizeof(file), PASTA_CONTAS, aname);
if(pAdmin[playerid] == 2 || pAdmin[playerid] == 3 || pAdmin[playerid] == 4 || pAdmin[playerid] == 5 || IsPlayerAdmin(playerid)){
new tmp[256];
new plid;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp)) {
SendClientMessage(playerid, Vermelho, "Uso: /ban [id] [motivo]");
return 1;
}
plid = strval(tmp);
new pname[MAX_PLAYER_NAME];
GetPlayerName(plid, pname, MAX_PLAYER_NAME);
format(file2, sizeof(file2), PASTA_CONTAS, pname);
if(IsPlayerConnected(plid)){
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' ')) {
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1))) {
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, Vermelho, "Uso: /ban [id] [motivo]");
}else{
new year, month,day;
getdate(year, month, day);
if(pAdmin[playerid]== 1){
format(string, sizeof(string), "| INFO-SERVER | O Moderador %s baniu o jogador %s (Motivo: %s)", aname,pname,result);
SendClientMessageToAll(AdminCor, string);
format(string,sizeof string,"%s(ID: %d) saiu do servidor. (Kickado/Banido)",aname, playerid);
SendClientMessageToAll(0xA6A6A6AA, string);
dini_IntSet("banidos.ini",pname,1);
Ban(plid);
}
format(string, sizeof(string), "| INFO-SERVER |O Administrador %s baniu o jogador: %s. (Motivo: %s)", aname, pname,result,month,day,year);
BanLog(string);
GameTextForPlayer(plid,"~r~banido", 2500, 3);
format(string, sizeof(string), "| INFO-SERVER | O Administrador %s baniu o jogador: %s. (Motivo: %s)", aname,pname,result);
SendClientMessageToAll(tcadm, string);
dini_IntSet("banidos.ini",pname,1);
SetPlayerPos(plid, 831.9581,-1102.1510,24.2969);
GameTextForPlayer(plid,"~r~banido~w~!", 2500, 3);
SendClientMessage(plid, Vermelho, "* Vocк foi banido do servidor!");
Ban(plid);
}
}else{
format(string, sizeof(string), "| ERRO | ID : %d nгo й valido!", plid);
SendClientMessage(playerid, Vermelho, string);
}
}
return 1;
}
Reply
#2

https://sampwiki.blast.hk/wiki/Kick
para kick com mensagem
pawn Код:
forward KickPublic(playerid);
public KickPublic(playerid) Kick(playerid);
 
stock KickWithMessage(playerid, color, message[])
{
    SendClientMessage(playerid, color, message);
    SetTimerEx("KickPublic", 1000, 0, "d", playerid);   //1 segundo de delay, pra dar tempo de mandar msg e kickar
}
 
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/kickme", true) == 0)
    {
        //ai no lugar de Kick(playerid), vocк usa a sintaxe abaixo, ele ja vai mandar a mensagem e kickar o player
        KickWithMessage(playerid, 0xFF0000FF, "You have been kicked.");
        return 1;
    }
    return 0;
}
para ban com mensagem
pawn Код:
forward BanPublic(playerid);
public BanPublic(playerid) Ban(playerid);
 
stock BanWithMessage(playerid, color, message[])
{
    SendClientMessage(playerid, color, message);
    SetTimerEx("BanPublic", 1000, 0, "d", playerid);   //1 segundo de delay, pra dar tempo de mandar msg e kickar
}
 
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/kickme", true) == 0)
    {
        //ai no lugar de Ban(playerid), vocк usa a sintaxe abaixo, ele ja vai mandar a mensagem e kickar o player
        BanWithMessage(playerid, 0xFF0000FF, "You have been kicked.");
        return 1;
    }
    return 0;
}
Reply
#3

https://sampwiki.blast.hk/wiki/Kick

Basta ler a nota importante.
Reply
#4

+_+ vlw +rep pros dois


@OFF
Cromado foi ban? antes na pбgina inicial tinha uns 5 posts dele kk
Reply
#5

nao ele ta viajando so pode kkkk == Ferias
Reply
#6

kkk sу pode msm
Reply
#7

it's here!.> https://sampwiki.blast.hk/wiki/Kick !!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)