Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- AFK system by Johurt(ES.^).
- */
- #include <a_samp>
- new bool:AFK_Stat[MAX_PLAYERS], Text3D:AFK_Label[MAX_PLAYERS];
- public OnPlayerConnect(playerid)
- {
- AFK_Stat[playerid] = false;
- AFK_Label[playerid] = Text3D:INVALID_3DTEXT_ID;
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if(AFK_Label[playerid] != Text3D:INVALID_3DTEXT_ID) Delete3DTextLabel(AFK_Label[playerid]);
- return 1;
- }
- public OnGameModeInit()
- {
- SetTimer("OneSecond", 1000, true);
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- if(AFK_Label[playerid] != Text3D:INVALID_3DTEXT_ID)
- {
- Delete3DTextLabel(AFK_Label[playerid]);
- AFK_Label[playerid] = Text3D:INVALID_3DTEXT_ID;
- }
- AFK_Stat[playerid] = false;
- return 1;
- }
- forward OneSecond();
- public OneSecond()
- {
- for(new p = 0; p < MAX_PLAYERS; p++)
- {
- if(IsPlayerNPC(p) || !IsPlayerConnected(p)) continue;
- if(AFK_Stat[p] && AFK_Label[p] == Text3D:INVALID_3DTEXT_ID)
- {
- AFK_Label[p] = Create3DTextLabel("AFK", 0xFFFFFFFF, 0.0, 0.0, 0.0, 15.0, 0, 1);
- Attach3DTextLabelToPlayer(AFK_Label[p], p, 0.0, 0.0, 0.5);
- }
- AFK_Stat[p] = true;
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement