Trocar Nick
2 participantes
Página 1 de 1
Trocar Nick
Transfer Account
Eu queria um sistema de transferir nicks em tempo real sem parar o server. Como no BRL
Eu queria um sistema de transferir nicks em tempo real sem parar o server. Como no BRL
IceRazor- Mensagens : 19
Pontos : 35
Reputação : 0
Data de inscrição : 16/04/2017
Re: Trocar Nick
Não sei como está a sua tabela mas aqui vai um exemplo...
Junte todas as tabelas que usam o nome do jogador.
Exemplo: Contas, Veiculos, Casas.
Comando:
Função:
Junte todas as tabelas que usam o nome do jogador.
Exemplo: Contas, Veiculos, Casas.
Comando:
- Código:
function onPlayerCommand( player, cmd, text )
{
if ( cmd == "mudarnick" )
{
if ( !text ) MessagePlayer( "Use /" + cmd + " <Nick/ID> <Novo Nick>", player );
else
{
local plr = GetPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) MessagePlayer( "Jogador Desconhecido.", player );
else
{
local nick = GetTok( text, " ", 2 );
if ( !nick ) MessagePlayer( "Use /" + cmd + " <Nick/ID> <Novo Nick>", player );
else
{
Message( "Admin " + player.Name + " alterou o nick do jogador " + plr.Name + " para " + nick + "." );
MudarNick( nick, plr.Name );
}
}
}
}
}
Função:
- Código:
function MudarNick( novo, velho )
{
//Mudar o nome na tabela de contas
QuerySQL( db, "UPDATE Contas SET Nome='" + novo + "' WHERE Nome LIKE '" + velho + "'");
//Mudar o nome na tabela de veículos
QuerySQL( db, "UPDATE Veiculos SET Dono='" + novo + "' WHERE Dono LIKE '" + velho + "'");
QuerySQL( db, "UPDATE Veiculos SET Compart='" + novo + "' WHERE Compart LIKE '" + velho + "'");
//Mudar o nome na tabela de casas
QuerySQL( db, "UPDATE Casas SET Dono='" + novo + "' WHERE Dono LIKE '" + velho + "'");
QuerySQL( db, "UPDATE Casas SET Compart='" + novo + "' WHERE Compart LIKE '" + velho + "'");
//Mudar o nick do jogador
if ( GetPlayerIDFromName( velho ) != -1 )
{
local player = FindPlayer( GetPlayerIDFromName( velho ) );
player.Name = novo;
}
}
Última edição por Diego^ em Ter maio 02, 2017 8:48 pm, editado 1 vez(es)
Re: Trocar Nick
Funcionou muito bem! Obrigado!
Só tinha um erro no cmd mais eu consertei.
else if ( cmd == "mudarnick" )
{
if ( !text ) MessagePlayer( "Use /" + cmd + " <Nick/ID> <Novo Nick>", player );
else
{
local plr = GetPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) MessagePlayer( "Jogador Desconhecido.", player );
else
{
local nick = GetTok( text, " ", 2 );
if ( !nick ) MessagePlayer( "Use /" + cmd + " <Nick/ID> <Novo Nick>", player );
else
{
MudarNick( nick, plr.Name );
Message( "Admin " + player.Name + " alterou o nick do jogador " + plr.Name + " para " + nick + "." );
}
}
}
}
} // <-- O erro estava aqui .
Só tinha um erro no cmd mais eu consertei.
else if ( cmd == "mudarnick" )
{
if ( !text ) MessagePlayer( "Use /" + cmd + " <Nick/ID> <Novo Nick>", player );
else
{
local plr = GetPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) MessagePlayer( "Jogador Desconhecido.", player );
else
{
local nick = GetTok( text, " ", 2 );
if ( !nick ) MessagePlayer( "Use /" + cmd + " <Nick/ID> <Novo Nick>", player );
else
{
MudarNick( nick, plr.Name );
Message( "Admin " + player.Name + " alterou o nick do jogador " + plr.Name + " para " + nick + "." );
}
}
}
}
} // <-- O erro estava aqui .
IceRazor- Mensagens : 19
Pontos : 35
Reputação : 0
Data de inscrição : 16/04/2017
Re: Trocar Nick
Ainda eu percebi mais um bug.
***Admin =UZ=Sore alterou o nick do jogador =UZ=Sore para =UZ=Sore.
***Admin =UZ=Sore alterou o nick do jogador =UZ=Sore para =UZ=Sore.
IceRazor- Mensagens : 19
Pontos : 35
Reputação : 0
Data de inscrição : 16/04/2017
Re: Trocar Nick
Funcionou muito bem, Obrigado.
IceRazor- Mensagens : 19
Pontos : 35
Reputação : 0
Data de inscrição : 16/04/2017
Página 1 de 1
Permissões neste sub-fórum
Não podes responder a tópicos
|
|