/reconnect
#1

It make everyone to reconnect.
I want it like...
THE player who type the command, reconnect.

I gonna use this for a register dialog system
When he register, the game restart for him.

pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    if(GetPVarInt(playerid, "Reconnect") == 1)
    {
        new string[25], playerIP[16];
        GetPlayerIp(playerid, playerIP, sizeof(playerIP));
        format(string, sizeof(string), "unbanip %s",playerIP);
        SendRconCommand(string);
    }
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    dcmd(reconnect, 9, cmdtext);
    return 0;
}

dcmd_reconnect(playerid, params[])
{
    #pragma unused params
    SetPVarInt(playerid, "Reconnect", 1);
    new string[23], playerIP[16];
    GetPlayerIp(playerid, playerIP, sizeof(playerIP));
    format(string, sizeof(string), "banip %s",playerIP);
    SendRconCommand(string);
    return 1;
}
Reply
#2

What?
Reply
#3

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
What?
He is saying when someone types /reconnect like somehow kicks them and reconnects them without leaving samp

but i dont know how to do it.!
Reply
#4

Quote:
Originally Posted by Kitten
Посмотреть сообщение
He is saying when someone types /reconnect like somehow kicks them and reconnects them without leaving samp

but i dont know how to do it.!
Yeah.

The tutorial i saw: http://forum.sa-mp.com/showthread.ph...ight=Reconnect
Reply
#5

He said GetPlayerIP dont work on onplayerdisconnect.
Reply
#6

Quote:
Originally Posted by Lorenc_
Посмотреть сообщение
He said GetPlayerIP dont work on onplayerdisconnect.
How to do it then?
Reply
#7

pawn Код:
stock GetPlayerIp2(playerid)
{
     GetPlayerIp(etc.. // sorrryz ever used getplayerip);
}

//then call the function stock GetPlayerIp2(playerid);

into the place you had

//example:

forward OMFG(playerid);
public OMFG(playerid)
{
    GetPlayerIp2(playerid);
    return 1;
}
Reply
#8

Just made this based on Jenejl's post:
pawn Код:
public OnPlayerDisconnect(playerid, reason)
{
    if(GetPVarInt(playerid, "Reconnecting") == 1)
    {
        new
            iStr[30],
            iP[16];

        GetPVarString(playerid, "RecIP", iP, sizeof(iP));
        printf("%s", iP);

        format(iStr, sizeof(iStr), "unbanip %s", iP);

        SendRconCommand(iStr);
        SendRconCommand("reloadbans");

        SetPVarInt(playerid, "Reconnecting", 0);
    }
    return 1;
}

CMD:reconnect(playerid, params[])
{
    new
        pIP[16],
        iStr[25];

    if(isnull(params)) return SendClientMessage(playerid, 0xFF0000FF, "Usage: /Reconnect < Player ID >");

    new
        PID = strval(params);

    GetPlayerIp(PID, pIP, sizeof(pIP));

    SetPVarInt(PID, "Reconnecting", 1);
    SetPVarString(PID, "RecIP", pIP);

    format(iStr, sizeof(iStr), "banip %s", pIP);
    SendRconCommand(iStr);

    SendClientMessage(PID, 0x008080FF, "Reconnecting, please wait..");
    return 1;
}
Код:
/Reconnect < Player ID >
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)