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