View difference between Paste ID: Pb9ded2K and Cp2tDpgM
SHOW: | | - or go back to the newest paste.
1-
new AFK[MAX_PLAYERS];
1+
new bool:AFK[MAX_PLAYERS];
2
3
public OnPlayerCommandText(playerid, cmdtext[])
4
{
5-
new String[250];
5+
	new String[250];
6
7-
if(!strcmp(cmdtext,"/AFK",true))
7+
	if(!strcmp(cmdtext,"/AFK",true)) {
8
		AFK[playerid] = AFK[playerid]? (0):(1);
9-
AFK[playerid] = 1;
9+
		format(String,sizeof(String),AFK[playerid]? ("!The Player %s Is In AFK"):("The Player %s Out From AFK"),GetName(playerid));
10-
format(String,sizeof(String),"!The Player %s Is In AFK",GetName(playerid));
10+
		SendClientMessageToAll(COLOR_LBLUE,String);
11-
SendClientMessageToAll(COLOR_LBLUE,String);
11+
		TogglePlayerControllable(playerid,!AFK[playerid]);
12-
TogglePlayerControllable(playerid,0);
12+
		GameTextForPlayer(playerid,AFK[playerid]? ("AFK"):("UnAFK"), 3000, 6);
13-
GameTextForPlayer(playerid,"AFK", 3000, 6);
13+
		return 1;
14-
return 1;
14+
	}
15
		
16-
	
16+
	if(!strcmp(cmdtext,"/AFKList",true)) {
17-
if(!strcmp(cmdtext,"/UnAFK",true))
17+
		new afks = 0;
18
		
19-
AFK[playerid] = 0;
19+
		SendClientMessage(playerid,COLOR_LBLUE,"••••• ••••• AFK LIST ••••• •••••");
20-
format(String,sizeof(String),"The Player %s Out From AFK",GetName(playerid));
20+
		for(new i = 0; i < MAX_PLAYERS; i++) {
21-
SendClientMessageToAll(COLOR_LBLUE,String);
21+
			if(!IsPlayerConnected(i) || !AFK[i]) continue;
22-
TogglePlayerControllable(playerid,1);
22+
23-
GameTextForPlayer(playerid,"UnAFK", 3000, 6);
23+
			format(String, sizeof(String),"%i. %s (id: %d)", ++afks, GetName(playerid), playerid);
24-
return 1;
24+
			SendClientMessage(playerid,COLOR_LBLUE,String);
25
		}
26-
	
26+
27-
if(!strcmp(cmdtext,"/AFKList",true))
27+
		if(!afks) 
28
			return SendClientMessage(playerid, COLOR_LBLUE, "No AFK Players");
29-
new afks = 0;
29+
		return 1;
30-
SendClientMessage(playerid,COLOR_LBLUE,"••••• ••••• AFK LIST ••••• •••••");
30+
	}
31-
for(new i=0;i<MAX_PLAYERS;i++)
31+
32
33-
if(IsPlayerConnected(i) && AFK[i] == 1)
33+
34
{
35-
format(String,sizeof(String),"%i. %s (id: %d)",++afks,GetName(playerid),playerid);
35+
	new name[MAX_PLAYER_NAME];
36-
SendClientMessage(playerid,COLOR_LBLUE,String);
36+
	GetPlayerName(playerid,name,sizeof(name));
37
	return name;
38
}