Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- new bool:AFK[MAX_PLAYERS];
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new String[250];
- if(!strcmp(cmdtext,"/AFK",true)) {
- AFK[playerid] = AFK[playerid]? (0):(1);
- format(String,sizeof(String),AFK[playerid]? ("!The Player %s Is In AFK"):("The Player %s Out From AFK"),GetName(playerid));
- SendClientMessageToAll(COLOR_LBLUE,String);
- TogglePlayerControllable(playerid,!AFK[playerid]);
- GameTextForPlayer(playerid,AFK[playerid]? ("AFK"):("UnAFK"), 3000, 6);
- return 1;
- }
- if(!strcmp(cmdtext,"/AFKList",true)) {
- new afks = 0;
- SendClientMessage(playerid,COLOR_LBLUE,"••••• ••••• AFK LIST ••••• •••••");
- for(new i = 0; i < MAX_PLAYERS; i++) {
- if(!IsPlayerConnected(i) || !AFK[i]) continue;
- format(String, sizeof(String),"%i. %s (id: %d)", ++afks, GetName(playerid), playerid);
- SendClientMessage(playerid,COLOR_LBLUE,String);
- }
- if(!afks)
- return SendClientMessage(playerid, COLOR_LBLUE, "No AFK Players");
- return 1;
- }
- }
- stock GetName(playerid)
- {
- new name[MAX_PLAYER_NAME];
- GetPlayerName(playerid,name,sizeof(name));
- return name;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement