Guest User

AFK Syst

a guest
Jun 26th, 2012
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.89 KB | None | 0 0
  1. #include <a_samp>
  2.  
  3. new AFK[MAX_PLAYERS];
  4.  
  5. public OnPlayerConnect(playerid)
  6. {
  7. return 1;
  8. }
  9.  
  10. public OnPlayerCommandText(playerid,cmdtext[])
  11. }
  12. if(strcmp(cmdtext,"/back",true) == 0)
  13. {
  14. 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
  15. else
  16. {
  17. AFK[playerid] = 0;// set AFK as off. for player..
  18. new name[MAX_PLAYER_NAME], string[256]; // create variable for player called name and string for message and more..
  19. GetPlayerName(playerid,name,sizeof(name)); // now setting NAme as the name of the player
  20. format(string,sizeof(string), "%s",name);
  21. SetPlayerName(playerid,string); // set the name to his/hi normal name
  22. SetPlayerColor(playerid,-1); // set the color of the player to white
  23. SetPlayerWeather(playerid,-2); // setting the weather to 2 for nice weather
  24. TogglePlayerControllable(playerid,1); //unfreeze the player
  25. }
  26. return 1;
  27. }
  28. if(strcmp(cmdtext, "/afk", true) == 0)
  29. {
  30. if(AFK[playerid] == 1) return SendClientMessage(playerid,-1,"You are already AFK"); //verify if the player is afk if is will send a message
  31. AFK[playerid] = 1;// set AFK as on. for player..
  32. new name[MAX_PLAYER_NAME], string[256]; // create variable for player called name and string for message and more..
  33. GetPlayerName(playerid,name,sizeof(name)); // now setting NAme as the name of the player
  34. format(string,sizeof(string), "[AFK]%s",name);
  35. SetPlayerName(playerid,string); // set the name with AFK when he type /afk
  36. SetPlayerColor(playerid,-1); // set the color of the player to white
  37. SetPlayerWeather(playerid,-1); // setting the weather to -1 to create a real AFK effect
  38. TogglePlayerControllable(playerid,0); //frezeze the player
  39. }
  40. if(strcmp(cmdtext,"/afklist",true) == 0)
  41. {
  42. for(new i = 0; i != MAX_PLAYERS; i++)
  43. {
  44. new name[MAX_PLAYER_NAME], string[256];
  45. GetPlayerName(i,name,sizeof(name));
  46. format(string,sizeof(string),"AFK Set Player : %s (id : %i)",name,playerid);
  47. }
  48. SendClientMessage(playerid,-1,string);
  49. return 1;
  50. }
  51. return 1;
  52. }
Advertisement
Add Comment
Please, Sign In to add comment