[AJUDA] Retirando clan do nome
#1

Bom, resolvi fazer um sistema de quando o player entrar no server ... checa se tem a tag(clan) de admin no nome, se tiver retira-o, ficando assim (OnPlayerConnect
pawn Код:
new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
    new Pip[128];
    GetPlayerName(playerid, pname, sizeof(pname));
    GetPlayerIp(playerid, Pip, sizeof(Pip));
    if(strcmp(Pip, "192.168.1.100"))//isso eh pq to tendo q usar o samp_debug
    {
        SetPlayerName(playerid, "[BP]BiieL");
    }
   
    if(strfind("[BP]", pname))
    {
        strdel(pname, 0, 4);
        SetPlayerName(playerid, pname);
        new bla[128];
        format(bla, 128, "You aren't a admin, so the Auto-Admin changed your name to: %s", pname);
        SendClientMessage(playerid, VERMELHO, bla);
    }
   
    format(string, sizeof(string), "%s has joined the Base Jumping Server", pname);
    SendClientMessageToAll(AZUL, string);
    SendDeathMessage(INVALID_PLAYER_ID, playerid, 200);
        //daqui pra frente й sу  do registro
Entгo, compilou normal, ai entгo fui testб-lo com o nick [BP]BiieL (BP: admin clan) ...

Aн detectou, sу que na hora de retirar o [BP] (strdel) ele transformou o nick em: "er"

Aн queria saber se alguem consegue me dizer como resolve-lo ...
Usei o search pois atй lembro q o Drakon postou algo assim, mas nгo estou achando-o ...

Se achar eu informo ...

Obrigado
Reply
#2

Tente fazer o seguinte...
Botar assim :
pawn Код:
/*if(strcmp(Pip, "192.168.1.100"))//isso eh pq to tendo q usar o samp_debug    
{        
SetPlayerName(playerid, "[BP]BiieL");    
}        
if(strfind("[BP]", pname))    
{        strdel(pname, 0, 4);        
SetPlayerName(playerid, pname);      
 new bla[128];      
 format(bla, 128, "You aren't a admin, so the Auto-Admin changed your name to: %s", pname);        SendClientMessage(playerid, VERMELHO, bla);    
}*/
Pra tipo poderem entrar com o Nick [BP] Quem nгo й Registrado ... Depois se registre com o Nick tendo [BP] ..
Depois tira os /* */ e tenta logar ...
PS : Vocк tem que tar registado sei-la xD
Reply
#3

nao cara, ja boto antes do registro pois assim, ja registra sem a tag ..

EDIT:
achei metadezinha do que quero bem:
http://forum.sa-mp.com/showpost.php?...&postcount=106

EDIT2:

Achei, uhu, aqui estб
http://forum.sa-mp.com/showpost.php?...3&postcount=72
mas ainda nao eh exatamente com quero, quero que nгo tire todos clans mas somente se for [BP]
Reply
#4

pawn Код:
if(strfind("[BP]", pname, true) != -1)
{
    SetPlayerName(playerid, pname[4]);
    new bla[128];
    format(bla, 128, "You aren't a admin, so the Auto-Admin changed your name to: %s", pname[4]);
    SendClientMessage(playerid, VERMELHO, bla);
}
Й um pequeno truque que fazemos com a memуria da mбquina virtual...
Reply
#5

Tenta assim :
Код:
 new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
	new Pip[128];
	GetPlayerName(playerid, pname, sizeof(pname));
	GetPlayerIp(playerid, Pip, sizeof(Pip));
	if(strcmp(Pip, "192.168.1.100"))//isso eh pq to tendo q usar o samp_debug
	{
		SetPlayerName(playerid, "[BP]BiieL");
	}
	
    new namestring = strfind(pname, "[BP]", true);
    if(namestring == -1)
    {
        SendClientMessage(playerid, COLOR_YELLOW, "Sу administradores usam o Nick com [BP]. Por favor retire o [BP] !");
		Kick(playerid);
        return 1;
    }
	
	format(string, sizeof(string), "%s has joined the Base Jumping Server", pname);
	SendClientMessageToAll(AZUL, string);
	SendDeathMessage(INVALID_PLAYER_ID, playerid, 200);
        //daqui pra frente й sу  do registro
Reply
#6

Toribio: nгo funfou, ficou com o mesmo nick ([BP]BiieL)

BadDark, eu nao quero kickar, isso eu ja ate tinha feito antes, mas lembrei que dava pra fazer o q eu quero eh desse jeito
Reply
#7

Muito entranho, aqui funciona, mas se for o caso, tente com strmid:

pawn Код:
if(strfind("[BP]", pname, true) != -1)
{
    new bla[128];
    strmid(pname, pname, 4, strlen(pname));
    SetPlayerName(playerid, pname);
    format(bla, 128, "You aren't a admin, so the Auto-Admin changed your name to: %s", pname);
    SendClientMessage(playerid, VERMELHO, bla);
}
Reply
#8

Sei-la ..
Eu fiz na doida 0.0
pawn Код:
new namestring = strfind(pname, "[BP]", true);
    if(namestring == -1)
    {
        SetPlayerName(playerid, "[]%s");
        return 1;
    }
Reply
#9

ta doido man, isso precisa de um format, e pq aquele "-1" /
Reply
#10

Sei-la eu fiz na doida .--.
Tenta
pawn Код:
if(strfind("[BP]", pname))    
{        
strdel(pname, 0, 4);        
SetPlayerName(playerid, "[]%s" , pname);        
new bla[128];        
format(bla, 128, "You aren't a admin, so the Auto-Admin changed your name to: %s", pname);        
SendClientMessage(playerid, VERMELHO, bla);    
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)