[Ajuda] player nгo й kickado com kick(playerid);
#1

O cуdigo й simples, quando conecta verifica se ele possui uma conta registrada, nгo importando o resultado era para kickar o player em sql_onplayerconnect.

pawn Код:
#define threadMySQL::%0(%1) forward %0(%1); \
                            public %0(%1)


public OnPlayerConnect(playerid)
{
    GetPlayerName(playerid, nome[0], 21);
    format(queryformat, 103, "select contaid, statusconta, linguagem, senhaacesso from contas where nickname='%s'", nome[0]);
    mysql_function_query(connectionhandle, queryformat, true, "sql_onplayerconnect", "i", playerid);
    return 1;
}

threadMySQL::sql_onplayerconnect(playerid)
{
    SendClientMessage(playerid, 0xFFFF80AA, "republicadventure-server.com");
    Kick(playerid);
    return 0x01;
}

Quando eu adiciono o Kick() antes de tudo em OnPlayerConnect funciona bem:
pawn Код:
public OnPlayerConnect(playerid)
{
    Kick(playerid);
    GetPlayerNa...
    format(que...

server_log.txt:
[17:21:04] Incoming connection: 127.0.0.1:53258
[17:21:04] [join] Falcon has joined the server (0:127.0.0.1)
[17:21:04] [part] Falcon has left the server (0:2)
[17:21:15] Incoming connection: 127.0.0.1:53259
[17:21:15] [join] Falcon has joined the server (0:127.0.0.1)
[17:21:15] [part] Falcon has left the server (0:2)
[17:21:30] Incoming connection: 127.0.0.1:64866
[17:21:30] [join] Falcon has joined the server (0:127.0.0.1)
[17:21:30] [part] Falcon has left the server (0:2)
[17:21:45] Incoming connection: 127.0.0.1:64867
[17:21:46] [join] Falcon has joined the server (0:127.0.0.1)
[17:21:46] [part] Falcon has left the server (0:2)



chatlog.txt:
Код:
[17:21:01] {FFFFFF}SA-MP {B9B9BF}0.3e {FFFFFF}Started

[17:21:04] Connecting to 127.0.0.1:7777...

[17:21:04] Connected. Joining the game...

[17:21:04] Audio stream: http://localhost/intro_login.mp3

[17:21:04] Connected to {B9B9BF}..:: Republic Adventure server ::..

[17:21:14] Lost connection to the server. Reconnecting..

[17:21:14] The server is restarting..

[17:21:15] Connecting to 127.0.0.1:7777...

[17:21:15] Connected. Joining the game...

[17:21:15] Audio stream: http://localhost/intro_login.mp3

[17:21:15] Connected to {B9B9BF}..:: Republic Adventure server ::..

[17:21:30] Lost connection to the server. Reconnecting..

[17:21:30] The server is restarting..

[17:21:30] Connecting to 127.0.0.1:7777...

[17:21:30] Connected. Joining the game...

[17:21:30] Audio stream: http://localhost/intro_login.mp3

[17:21:30] Connected to {B9B9BF}..:: Republic Adventure server ::..

[17:21:45] Lost connection to the server. Reconnecting..

[17:21:45] The server is restarting..

[17:21:45] Connecting to 127.0.0.1:7777...

[17:21:46] Connected. Joining the game...

[17:21:46] Audio stream: http://localhost/intro_login.mp3

[17:21:46] Connected to {B9B9BF}..:: Republic Adventure server ::..

[17:21:46] republicadventure-server.com

[17:21:46] Server closed the connection.
parece ser o mesmo o mesmo problema desse cara:
Quote:
Originally Posted by scott1
Посмотреть сообщение
...so it have to kick me, but nothing happend, i got an message "lose connection, try reconnecting" like if server shut down, after some sec i got reconnected and after another time the message and so and so.

But never the server shut down or restart, just for me.
Reply
#2

Aquele SendClientMessage ta sendo enviado ?
Reply
#3

no chatlog.txt tб mostrando ai, depois de vбrias vezes que "o servidor cai" como no exemplo do scott1 envia e kicka.

й como se fosse para eu ser kickado e o servidor fica reiniciando somente para mim
Reply
#4

entгo... ninguйm saberia oque pode ser isto ? =/
nгo estou muito afim de refazer tudo e acabar neste erro novamente
Reply
#5

Esta chegando ao sql_onplayerconnect
Reply
#6

sim, todas as outras funзхes que eu adiciono lб funciona. Mas quando uso o Kick o servidor fica reiniciando somente para mim e nгo kicka.

ai no chatlog.txt que eu postei tб mostrando como tб acontecendo
Reply
#7

a funзгo mysql_query_calback nгo estб chamando a callback.
Reply
#8

a consulta estб chegando na callback, o problema mesmo й quando executa o Kick(playerid);

o servidor fica como se desse gmx vбrias vezes seguidas, mas somente para mim
Reply
#9

Jб viu o valor que playerid tб assumindo?
Reply
#10

sim, todo o resto funciona bem... aparenta ser algum problema no sa-mp server.
Atй porque mesmo com o new.pwn resultava nisso.

A soluзгo para o problema foi usar um SetTimer, entгo passou a funcionar corretamente.
pawn Код:
#include <a_samp>

main()
{
    print("SA-MP Forums");
}

public OnPlayerConnect(playerid)
{
    SetTimerEx("Falcon", 500, false, "i", playerid);
    return 1;
}

forward Falcon(playerid);
public Falcon(playerid)
{
    SendClientMessage(playerid, -1, "GET OUT !!!");
    Kick(playerid);
    return 0x01;
}
Obrigado todos que respoderam.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)