Code:
public OnGameModeInit()
{
glob0 = funcidx(8) != -1;
glob4 = funcidx(104) != -1;
if(-1 != funcidx(204))
{
return CallLocalFunction(284, 364);
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext)
{
if(glob0 && !CallLocalFunction(368, 464, playerid, cmdtext))
{
return 1;
}
new var0 = 0, var1[32];
while(cmdtext[++var0] > 32)
{
var1[var0 - 1] = tolower(cmdtext[var0]);
}
format(var1, 32, "cmd_%s", var1);
while(cmdtext[var0] == 32)
{
var0++;
}
if(!cmdtext[var0])
{
if(glob4)
{
return CallLocalFunction(504, 604, playerid, cmdtext);
}
return CallLocalFunction(var1, 640, playerid, 652);
}
if(glob4)
{
return CallLocalFunction(660, 760, playerid, cmdtext);
}
return CallLocalFunction(var1, 788, playerid, cmdtext);
}
public OnFilterScriptInit()
{
print("\n=====================================");
print("===AFK System v1.1 By RyderX LOADED!===");
print("=====================================\n");
return 1;
}
public OnFilterScriptExit()
{
print("\n=====================================");
print("===AFK System v1.1 By RyderX UNLOADED!===");
print("=====================================\n");
return 1;
}
public OnPlayerConnect(playerid)
{
glob3200[playerid] = 0;
return 1;
}
public cmd_afk(playerid)
{
if(!glob3200[playerid])
{
new var0[128];
new var1[24];
glob3200[playerid] = 1;
GetPlayerPos(playerid, 0.0, 0.0, 0.0);
GetPlayerFacingAngle(playerid, 0.0);
glob2260[playerid] = GetPlayerInterior(playerid);
GetPlayerName(playerid, var1, 24);
GetPlayerWeapon(playerid);
GivePlayerWeapon(playerid, 0, 0);
format(var0, 128, "[AFK] {6f00ff}*%s {FFFFFF}is now AFK {00ff00}(Away From Keyboard){FFFFFF}.", var1);
TogglePlayerControllable(playerid, false);
glob2A30[playerid] = Create3DTextLabel(16052, 4294901930, 1106247680, 1109393408, 1112014848, 1109393408, 0, 0);
Attach3DTextLabelToPlayer(glob2A30[playerid], playerid, 0, 0, 1060320051);
SetPlayerVirtualWorld(playerid, 0);
SetPlayerInterior(playerid, 3);
SendClientMessageToAll(0x8F8F8FFF, var0);
return 1;
}
if(glob3200[playerid] == 1)
{
return SendClientMessage(playerid, 0x8F8F8FFF, "[ERROR]:{FFFFFF}You're already AFK.");
}
return 1;
}
public cmd_back(playerid)
{
if(glob3200[playerid] == 1)
{
new var0[128];
new var1[24];
glob3200[playerid] = 0;
SetPlayerPos(playerid, glob320[playerid], globAF0[playerid], glob12C0[playerid]);
SetPlayerFacingAngle(playerid, glob1A90[playerid]);
SetCameraBehindPlayer(playerid);
SetPlayerInterior(playerid, glob2260[playerid]);
GetPlayerName(playerid, var1, 24);
format(var0, 128, "* {6f00ff}%s {FFFFFF}is now Back From AFK {00ff00}(Back To Keyboard){FFFFFF}.", var1);
TogglePlayerControllable(playerid, true);
Delete3DTextLabel(glob2A30[playerid]);
SendClientMessageToAll(0x8F8F8FFF, var0);
return 1;
}
if(!glob3200[playerid])
{
return SendClientMessage(playerid, 0x8F8F8FFF, "[ERROR]:{FFFFFF}You're not AFK.");
}
return 1;
}
public cmd_afkhelp(arg0)
{
ShowPlayerDialog(arg0, 1, 0, 16668, 16704, 17088, 17100);
return 1;
}