View difference between Paste ID: BSUqzhG0 and 2qPEx5Zz
SHOW: | | - or go back to the newest paste.
1
#include <a_samp>
2
3
new AFK[MAX_PLAYERS];
4
5
public OnPlayerConnect(playerid)
6
{
7
        AFK[playerid] = 0;
8
   return 1;
9
}
10
11
public OnPlayerCommandText(playerid,cmdtext[])
12
 }
13
           if(strcmp(cmdtext,"/back",true) == 0)
14
             {
15
             if(AFK[playerid] == 0) return SendClientMessage(playerid,-1,"You are not AFK"); //verify if the player is afk if is not will send a message
16
                     else
17
                    {
18
                  AFK[playerid] = 0;// set AFK as off. for player..
19
                       new name[MAX_PLAYER_NAME], string[256]; // create variable for player called name and string for message and more..
20
                               GetPlayerName(playerid,name,sizeof(name)); // now setting NAme as the name of the player
21
                                      format(string,sizeof(string), "%s",name);
22
                                      SetPlayerName(playerid,string); // set the name to his/hi normal name
23
                                          SetPlayerColor(playerid,-1); // set the  color of the player to white
24
                                        SetPlayerWeather(playerid,-2); // setting the weather to 2 for nice weather
25
                                         TogglePlayerControllable(playerid,1);           //unfreeze the player      
26
               }    
27
                return 1;
28
         }
29
                   if(strcmp(cmdtext, "/afk", true) == 0)
30
         {
31
             if(AFK[playerid] == 1) return SendClientMessage(playerid,-1,"You are already AFK"); //verify if the player is afk if is will send a message
32
                  AFK[playerid] = 1;// set AFK as on. for player..
33
                       new name[MAX_PLAYER_NAME], string[256]; // create variable for player called name and string for message and more..
34
                               GetPlayerName(playerid,name,sizeof(name)); // now setting NAme as the name of the player
35
                                      format(string,sizeof(string), "[AFK]%s",name);
36
                                      SetPlayerName(playerid,string); // set the name with AFK when he type /afk
37
                                          SetPlayerColor(playerid,-1); // set the  color of the player to white
38
                                        SetPlayerWeather(playerid,-1); // setting the weather to -1 to create a real AFK effect
39
                                         TogglePlayerControllable(playerid,0);       //frezeze the player                              
40
         }
41
            if(strcmp(cmdtext,"/afklist",true) == 0)
42
           {
43
          for(new i = 0; i != MAX_PLAYERS; i++)
44
          {
45
                  new name[MAX_PLAYER_NAME], string[256];
46
                  GetPlayerName(i,name,sizeof(name));
47
                   format(string,sizeof(string),"AFK Set Player : %s (id : %i)",name,playerid);
48
         }
49
            SendClientMessage(playerid,-1,string);
50
       return 1;
51
}       
52
         return  1;        
53
}