SA-MP Forums Archive
/reconnect - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /reconnect (/showthread.php?tid=221161)



/reconnect - Unknown123 - 05.02.2011

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;
}



Re: /reconnect - Lorenc_ - 05.02.2011

What?


Re: /reconnect - Kitten - 05.02.2011

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.!


Re: /reconnect - Unknown123 - 05.02.2011

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


Re: /reconnect - Lorenc_ - 05.02.2011

He said GetPlayerIP dont work on onplayerdisconnect.


Re: /reconnect - Unknown123 - 05.02.2011

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


Re: /reconnect - Kitten - 05.02.2011

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;
}



Re: /reconnect - [L3th4l] - 05.02.2011

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 >