Sziasztok! Találtam egy angol AFK rendszert! Gondoltam lefordítom magyarra. Remélem valakinek segítek vele!
Használati kód: /afk /brb
Visszatérési kód: /back
AFK Játékosok: /afkplayers
Készítette: Monster
Fordította: Zalakaka45
http://forum.sa-mp.com/showthread.php?t=261994A script tesztelve lett!
#include <a_samp>
#define dcmd(%1,%2,%3) if (!strcmp((%3)[1], #%1, true, (%2)) && ((((%3)[(%2) + 1] == \'\\0\') && (dcmd_%1(playerid, \"\"))) || (((%3)[(%2) + 1] == \' \') && (dcmd_%1(playerid, (%3)[(%2) + 2]))))) return 1
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_RED 0xFF0000AA
#define COLOR_LIGHTBLUE 0x33CCFFAA
enum Player
{
AFKstatus
}
new PlayerInfo[MAX_PLAYERS][Player];
public OnFilterScriptInit()
{
print(\"\\n--------------------------------------\");
print(\" Simple AFK System By Monster and Zalakaka45 \\n Loading.....\\nSikeres betöltés !\");
print(\"--------------------------------------\\n\");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
dcmd_afk(playerid, params[])
{
#pragma unused params
new string[256];
if (PlayerInfo[playerid][AFKstatus] == 1)
{
SendClientMessage(playerid, COLOR_RED, \"Hiba: Te már AFK-ban vagy!\");
return 1;
}
else if (PlayerInfo[playerid][AFKstatus] == 0)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), \"%s(%d) AFK-ba lépett!\", pname,playerid);
SendClientMessageToAll(COLOR_YELLOW, string);
TogglePlayerControllable(playerid,0);
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(playerid) + 50);
PlayerInfo[playerid][AFKstatus] = 1;
return 1;
}
return 0;
}
dcmd_brb(playerid, params[])
{
#pragma unused params
new string[256];
if (PlayerInfo[playerid][AFKstatus] == 1)
{
SendClientMessage(playerid, COLOR_RED, \"Hiba: Te már AFK-ban vagy!\");
return 1;
}
else if (PlayerInfo[playerid][AFKstatus] == 0)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), \"%s -nak/nek elkellett mennie!\", pname,playerid);
SendClientMessageToAll(COLOR_YELLOW, string);
TogglePlayerControllable(playerid,0);
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(playerid) + 50);
PlayerInfo[playerid][AFKstatus] = 1;
return 1;
}
return 0;
}
dcmd_back(playerid, params[])
{
#pragma unused params
new string [256];
if (PlayerInfo[playerid][AFKstatus] == 0)
{
SendClientMessage(playerid, COLOR_RED, \"Hiba: Te már nem vagy AFK-ban!\");
return 1;
}
else if (PlayerInfo[playerid][AFKstatus] == 1)
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), \"%s%d visszajött!\", pname,playerid);
SendClientMessageToAll(COLOR_YELLOW, string);
TogglePlayerControllable(playerid,1);
SetPlayerVirtualWorld(playerid, GetPlayerVirtualWorld(playerid) - 50);
PlayerInfo[playerid][AFKstatus] = 0;
return 1;
}
return 0;
}
dcmd_afkplayers( playerid, params[ ] )
{
#pragma unused params
new count = 0;
new name[MAX_PLAYER_NAME];
new string[128];
//
SendClientMessage(playerid, COLOR_WHITE, \"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\");
SendClientMessage(playerid, COLOR_LIGHTBLUE, \"AFK lista:\");
SendClientMessage(playerid, COLOR_WHITE, \"-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
if(PlayerInfo[AFKstatus] == 1)
{
GetPlayerName(i, name, sizeof(name));
format(string, 256, \"Afk > %s{FFFFFF}%d\", name,i );
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
count++;
}
}
}
if (count == 0)
{
SendClientMessage(playerid, COLOR_RED, \"Senki nem AFK!\");
}
SendClientMessage(playerid, COLOR_WHITE, \"-=---=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\");
return 1;
}
public OnPlayerConnect(playerid)
{
PlayerInfo[playerid][AFKstatus] = 0;
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
PlayerInfo[playerid][AFKstatus] = 0;
return 1;
}
public OnPlayerText(playerid, text[])
{
if (PlayerInfo[playerid][AFKstatus] == 1)
{
SendClientMessage(playerid, COLOR_RED, \"Írd be /back hogy visszajöhess!\");
return 0;
}
else if (PlayerInfo[playerid][AFKstatus] == 0)
{
return 1;
}
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
dcmd(afk,3,cmdtext);
dcmd(brb,3,cmdtext);
dcmd(back,4,cmdtext);
dcmd(afkplayers,10,cmdtext);
return 0;
}