23.11.2013, 18:47
How can i relog a player using a command ingame?
#include <a_samp>
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp(cmdtext, "/reconnect", true, 10))
{
if((cmdtext[10] != ' ') || (cmdtext[11] == EOS)) return SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}» Usage: {FFFFFF}/reconnect [playerid]");
new
string[16 + 6],
destid = strval(cmdtext[11])
;
if(!IsPlayerConnected(destid)) return SendClientMessage(playerid, 0xFFFFFFFF, "{FF0000}» Error: {FFFFFF}Player is not connected!");
GetPlayerIp(destid, string, 16), SetPVarString(destid, "pIp", string);
format(string, sizeof(string), "banip %s", string);
SendRconCommand(string);
return SendClientMessage(destid, 0xFFFFFFFF, "{A9C4E4}Reconnecting...");
}
return 0;
}
public OnPlayerDisconnect(playerid)
{
new
string[16 + 8]
;
GetPVarString(playerid, "pIp", string, 16);
format(string, sizeof(string), "unbanip %s", string);
SendRconCommand(string);
return 1;
}