Advertisement
Guest User

gAFK system by: Gotti

a guest
Jun 6th, 2011
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. //gAFK System, credits to: Gotti, Aleluja (Idea)
  2.  
  3.  
  4. #include <a_samp>
  5. #include <zcmd>
  6.  
  7. #define pink "{FF00D9}"
  8.  
  9. enum posinfo
  10. {
  11. Float:posx,
  12. Float:posy,
  13. Float:posz,
  14. Float:posangle,
  15. };
  16. new PosInfo[MAX_PLAYERS][posinfo];
  17.  
  18. public OnFilterScriptInit()
  19. {
  20.  
  21. return 1;
  22. }
  23.  
  24. public OnFilterScriptExit()
  25. {
  26. return 1;
  27. }
  28.  
  29. public OnPlayerConnect(playerid)
  30. {
  31. SendClientMessage(playerid, 0xFFFFFFAA,"This server is running gAFK system by: {FF00D9}Gotti");
  32. SetPVarInt(playerid,"afk",1);
  33. return 1;
  34. }
  35.  
  36. public OnPlayerDisconnect(playerid)
  37. {
  38. PosInfo[playerid][posx] = 0;
  39. PosInfo[playerid][posy] = 0;
  40. PosInfo[playerid][posz] = 0;
  41. PosInfo[playerid][posangle] = 0;
  42.  
  43. return 1;
  44. }
  45.  
  46. COMMAND:afk(playerid, params[]) {
  47. if(GetPVarInt(playerid,"afk") == 2) return SendClientMessage(playerid,0xFFFFFFAA,"Vec ste {FF00D9}AFK{FFFFFF}! Koristite {FF00D9}/back{FFFFFF} da se vratite!");
  48. {
  49. SetPVarInt(playerid,"afk",2);
  50. new Float:x, Float:y, Float:z, Float:angle;
  51. GetPlayerPos(playerid,x,y,z);
  52. GetPlayerFacingAngle(playerid, angle);
  53. PosInfo[playerid][posx] = x;
  54. PosInfo[playerid][posy] = y;
  55. PosInfo[playerid][posz] = z;
  56. PosInfo[playerid][posangle] = angle;
  57. new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
  58. GetPlayerName(playerid, pname, sizeof(pname));
  59. format(string, sizeof(string), "{FF00D9}%s{FFFFFF} je sada AFK", pname);
  60. SendClientMessageToAll(0xAAAAAAAA, string);
  61. TogglePlayerControllable(playerid,false);
  62. SetPlayerPos(playerid, 376.8465,2538.0879,16.5391);
  63. }
  64.  
  65. return 1; }
  66.  
  67. COMMAND:back(playerid, params[]) {
  68. if(GetPVarInt(playerid,"afk") == 1) return SendClientMessage(playerid,0xFFFFFFAA,"Niste {FF00D9}AFK{FFFFFF}, tako da ne mozete koristiti ovu komandu!");
  69. {
  70. if(PosInfo[playerid][posx] != 0 && PosInfo[playerid][posy] != 0 && PosInfo[playerid][posz] != 0)
  71. {
  72. SetPVarInt(playerid,"afk",1);
  73. SetPlayerPos(playerid,PosInfo[playerid][posx],PosInfo[playerid][posy],PosInfo[playerid][posz]);
  74. ResetPlayerWeapons(playerid);
  75. SetPlayerFacingAngle(playerid, PosInfo[playerid][posangle]);
  76. new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
  77. GetPlayerName(playerid, pname, sizeof(pname));
  78. format(string, sizeof(string), "{FF00D9}%s{FFFFFF} vise nije AFK", pname);
  79. SendClientMessageToAll(0xFFFFFFAA, string);
  80. TogglePlayerControllable(playerid,true);
  81.  
  82. }
  83. }
  84.  
  85. return 1; }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement