nem teszteltem..
#include a_samp
#include zcmd
new afktimer[MAX_PLAYERS];
new Text3D:afktext[MAX_PLAYERS];
new d[MAX_PLAYERS][3];
CMD:afk(playerid)
{
if(GetPVarInt(playerid,\"AFKON\") == 0)
{
new Float:X,Float:Y,Float:Z;
GetPlayerPos(playerid,X,Y,Z);
SetPVarInt(playerid,\"AFKON\",1);
SendClientMessage(playerid,-1,\"AFK-ba léptél!\");
afktext[playerid] = Create3DTextLabel(\"AFK: 0 órája 0 perce \\n0 másodperce\",0x51e026AA,X,Y,Z,20.0,0);
afktimer[playerid] = SetTimerEx(\"SAFK\",1000,1,\"i\",playerid);
}
else
{
SetPVarInt(playerid,\"AFKON\",0);
SendClientMessage(playerid,-1,\"Az AFK-ból kiléptél!\");
KillTimer(afktimer[playerid]);
d[playerid][0] = 0;
d[playerid][1] = 0;
d[playerid][2] = 0;
}
}
forward SAFK(playerid);
public SAFK(playerid)
{
new string[128];
if(d[playerid][2] == 60)
{
d[playerid][2] = 0;
d[playerid][1]++;
}
if(d[playerid][1] == 60)
{
d[playerid][1] = 0;
d[playerid][0]++;
}
format(string,sizeof(string),\"AFK: %02i órája %02i perce\\n%02i másodperce\",d[playerid][2],d[playerid][1],d[playerid][0]);
Update3DTextLabelText(afktext[playerid],0x51e026AA,string);
return 1;
}