Sziasztok!
Unatkoztam ezért megírtam ezt az egyszerû AFK rendszert, ami tartalmaz egy rendszerkickert, tehát aki 5 perce nem mozdul el a spawnhelyrõl azt kickeli. Ugyanakkor van az /afk parancs, amivel be- és kikapcsoljuk az AFK \"üzemmódot\".
Itt a kód:
#include <a_samp>
#include <zcmd>
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xAA3333AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_ORANGE 0xFF9933AA
#define COLOR_LIGHTBLUE 0x33CCFFAA
forward afk(playerid);
new afkTimer[MAX_PLAYERS];
new afkk[MAX_PLAYERS];
new Float:X[MAX_PLAYERS], Float:Y[MAX_PLAYERS], Float:Z[MAX_PLAYERS];
CMD:afk(playerid, params[])
{
if(afkk[playerid] == 0)
{
SendClientMessage(playerid, COLOR_GREEN, \"AFK módba léptél!\");
SetPlayerVirtualWorld(playerid, 10);
TogglePlayerControllable(playerid, 0);
afkk[playerid] = 1;
}
else
{
SendClientMessage(playerid, COLOR_GREEN, \"Kiléptél az AFK-ból!\");
SetPlayerVirtualWorld(playerid, 0);
TogglePlayerControllable(playerid, 1);
afkk[playerid] = 0;
}
return 1;
}
public OnFilterScriptInit()
{
print(\"\\n--------------------------------------\");
print(\" AFK script by Rupert \");
print(\"--------------------------------------\\n\");
return 1;
}
public OnFilterScriptExit()
{
print(\"AFK script bezarva.\");
return 1;
}
public OnPlayerConnect(playerid)
{
SendClientMessage(playerid, -1, \"AFK-hoz írd be: /afk!\");
afkk[playerid] = 0;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
afkk[playerid] = 0;
return 1;
}
public OnPlayerSpawn(playerid)
{
GetPlayerPos(playerid, X[playerid], Y[playerid], Z[playerid]);
afkTimer[playerid] = SetTimerEx(\"afk\", 1000*5*60, 1, \"i\", playerid);
return 1;
}
public afk(playerid)
{
new Float:Xx, Float:Yy, Float:Zz;
GetPlayerPos(playerid, Xx, Yy, Zz);
if(X[playerid] == Xx && Y[playerid] == Yy && Z[playerid] == Zz)
{
if(afkk[playerid] == 0)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new string[128];
format(string, sizeof(string), \"%s ki lett rúgva a rendszer által, indok: /AFK nélküli AFK!\", name);
SendClientMessageToAll(COLOR_RED, string);
}
}
return 1;
}
Nem teszteltem, ha valami bug, vagy hiba lenne akkor írjátok meg hozzászólásban és azonnal javítom!