Advertisement
Guest User

AFK-System (easy-scripting.net, Vincent Petritz)

a guest
Feb 21st, 2012
420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.42 KB | None | 0 0
  1. //easy-scripting.net (Vincent Petritz) für sa-mp.de
  2.  
  3. #include <a_samp>
  4. #include <ocmd>
  5. #include <sscanf2>
  6.  
  7. #define FarbeRot 0xC30000FF
  8.  
  9. new Text:AFK[2];
  10.  
  11. forward AFKend(pID);
  12.  
  13. public OnFilterScriptInit()
  14. {
  15. print("\nAFK System by Vincent Petritz wurde erfolgreich geladen.\n");
  16. for(new i=0;i<MAX_PLAYERS;i++)
  17. {
  18. SetPVarInt(i, "AFKcheck", 0);
  19. }
  20. AFK[0] = TextDrawCreate(50,144, "AFK-Code:");
  21. TextDrawBackgroundColor(AFK[0], 255);
  22. TextDrawFont(AFK[0], 2);
  23. TextDrawLetterSize(AFK[0], 1.200000, 2.000000);
  24. TextDrawColor(AFK[0], -1);
  25. TextDrawSetOutline(AFK[0], 1);
  26. TextDrawSetProportional(AFK[0], 1);
  27. TextDrawSetShadow(AFK[0], 0);
  28.  
  29. AFK[1] = TextDrawCreate(250,144, " ");
  30. TextDrawBackgroundColor(AFK[1], 255);
  31. TextDrawFont(AFK[1], 2);
  32. TextDrawLetterSize(AFK[1], 1.200000, 2.000000);
  33. TextDrawColor(AFK[1], -1);
  34. TextDrawSetOutline(AFK[1], 1);
  35. TextDrawSetProportional(AFK[1], 1);
  36. TextDrawSetShadow(AFK[1], 0);
  37.  
  38. return 1;
  39. }
  40.  
  41. ocmd:afkcheck(playerid, params[])
  42. {
  43. new pID;
  44. if(sscanf(params, "u", pID))
  45. return SendClientMessage(playerid, FarbeRot, "Benutzung: /afkcheck [ID]");
  46. if(!IsPlayerAdmin(playerid))
  47. return SendClientMessage(playerid, FarbeRot, "Du bist kein Administrator!");
  48. if(IsPlayerConnected(pID))
  49. {
  50. if(GetPVarInt(pID, "AFKcheck") == 0)
  51. {
  52. new str1[128], str2[128], admin[MAX_PLAYER_NAME], spieler[MAX_PLAYER_NAME];
  53. GetPlayerName(pID, spieler, sizeof(spieler));
  54. GetPlayerName(playerid, admin, sizeof(admin));
  55. AFKask(pID);
  56. format(str1, sizeof(str1), "[AFK-System]: %s wird auf Anwesenheit überprüft!", spieler);
  57. format(str2, sizeof(str2), "[AFK-System]: %s lässt dich auf Anwesenheit überprüfen!", admin);
  58. SendClientMessage(playerid, FarbeRot, str1);
  59. SendClientMessage(pID, FarbeRot, str2);
  60. }
  61. }
  62. return 1;
  63. }
  64.  
  65. ocmd:notafk(playerid, params[])
  66. {
  67. new number[20];
  68. if(sscanf(params, "s", number))
  69. return SendClientMessage(playerid, FarbeRot, "Benutzung: /notafk [Nummer]");
  70. if(GetPVarInt(playerid, "AFKcheck") == 1)
  71. {
  72. new str[10];
  73. new Value = GetPVarInt(playerid, "AFKnum");
  74. valstr(str, Value);
  75. if(!strcmp(number, str))
  76. {
  77. TextDrawHideForPlayer(playerid, AFK[0]);
  78. TextDrawHideForPlayer(playerid, AFK[1]);
  79. SetPVarInt(playerid, "AFKcheck", 0);
  80. SetPVarInt(playerid, "AFKnum", 0);
  81. }
  82. else
  83. {
  84. SendClientMessage(playerid, FarbeRot, "Falscher Code!");
  85. }
  86. }
  87. else { SendClientMessage(playerid, FarbeRot, "Du bist nicht AFK gemeldet worden!"); }
  88. return 1;
  89. }
  90.  
  91. public AFKend(pID)
  92. {
  93. if(GetPVarInt(pID, "AFKcheck") == 1)
  94. {
  95. new str[128], spieler[MAX_PLAYER_NAME];
  96. GetPlayerName(pID, spieler, sizeof(spieler));
  97. format(str, sizeof(str), "AFK-System: %s war AFK und wird daher gekickt!", spieler);
  98. SendClientMessageToAll(FarbeRot, str);
  99. Kick(pID);
  100. }
  101. else { }
  102. return 1;
  103. }
  104.  
  105. stock AFKask(pID)
  106. {
  107. new rand = random(87654)+12345;
  108. new str[25];
  109. SetPVarInt(pID, "AFKcheck", 1);
  110. SetPVarInt(pID, "AFKnum", rand);
  111. TextDrawShowForPlayer(pID, AFK[0]);
  112. format(str, sizeof(str), " ~r~%d", rand);
  113. TextDrawSetString(AFK[1], str);
  114. TextDrawShowForPlayer(pID, AFK[1]);
  115. SetTimerEx("AFKend", 60000, false, "u", pID);
  116. }
  117.  
  118. public OnFilterScriptExit()
  119. {
  120. return 1;
  121. }
  122.  
  123. public OnPlayerRequestClass(playerid, classid)
  124. {
  125. return 1;
  126. }
  127.  
  128. public OnPlayerConnect(playerid)
  129. {
  130. SetPVarInt(playerid, "AFKcheck", 0);
  131. return 1;
  132. }
  133.  
  134. public OnPlayerDisconnect(playerid, reason)
  135. {
  136. return 1;
  137. }
  138.  
  139. public OnPlayerSpawn(playerid)
  140. {
  141. return 1;
  142. }
  143.  
  144. public OnPlayerDeath(playerid, killerid, reason)
  145. {
  146. return 1;
  147. }
  148.  
  149. public OnVehicleSpawn(vehicleid)
  150. {
  151. return 1;
  152. }
  153.  
  154. public OnVehicleDeath(vehicleid, killerid)
  155. {
  156. return 1;
  157. }
  158.  
  159. public OnPlayerText(playerid, text[])
  160. {
  161. return 1;
  162. }
  163.  
  164. public OnPlayerCommandText(playerid, cmdtext[])
  165. {
  166. return 0;
  167. }
  168.  
  169. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  170. {
  171. return 1;
  172. }
  173.  
  174. public OnPlayerExitVehicle(playerid, vehicleid)
  175. {
  176. return 1;
  177. }
  178.  
  179. public OnPlayerStateChange(playerid, newstate, oldstate)
  180. {
  181. return 1;
  182. }
  183.  
  184. public OnPlayerEnterCheckpoint(playerid)
  185. {
  186. return 1;
  187. }
  188.  
  189. public OnPlayerLeaveCheckpoint(playerid)
  190. {
  191. return 1;
  192. }
  193.  
  194. public OnPlayerEnterRaceCheckpoint(playerid)
  195. {
  196. return 1;
  197. }
  198.  
  199. public OnPlayerLeaveRaceCheckpoint(playerid)
  200. {
  201. return 1;
  202. }
  203.  
  204. public OnRconCommand(cmd[])
  205. {
  206. return 1;
  207. }
  208.  
  209. public OnPlayerRequestSpawn(playerid)
  210. {
  211. return 1;
  212. }
  213.  
  214. public OnObjectMoved(objectid)
  215. {
  216. return 1;
  217. }
  218.  
  219. public OnPlayerObjectMoved(playerid, objectid)
  220. {
  221. return 1;
  222. }
  223.  
  224. public OnPlayerPickUpPickup(playerid, pickupid)
  225. {
  226. return 1;
  227. }
  228.  
  229. public OnVehicleMod(playerid, vehicleid, componentid)
  230. {
  231. return 1;
  232. }
  233.  
  234. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  235. {
  236. return 1;
  237. }
  238.  
  239. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  240. {
  241. return 1;
  242. }
  243.  
  244. public OnPlayerSelectedMenuRow(playerid, row)
  245. {
  246. return 1;
  247. }
  248.  
  249. public OnPlayerExitedMenu(playerid)
  250. {
  251. return 1;
  252. }
  253.  
  254. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  255. {
  256. return 1;
  257. }
  258.  
  259. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  260. {
  261. return 1;
  262. }
  263.  
  264. public OnRconLoginAttempt(ip[], password[], success)
  265. {
  266. return 1;
  267. }
  268.  
  269. public OnPlayerUpdate(playerid)
  270. {
  271. return 1;
  272. }
  273.  
  274. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  275. {
  276. return 1;
  277. }
  278.  
  279. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  280. {
  281. return 1;
  282. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement