Guest User

AFK + FRAMES SYSTEM

a guest
Sep 9th, 2013
396
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 6.68 KB | None | 0 0
  1. #include <a_samp>
  2. #include <zcmd>
  3.  
  4. new afk[MAX_PLAYERS];
  5. new Text3D:label[MAX_PLAYERS];
  6. // Frames
  7. new fpsON[MAX_PLAYERS];
  8. new TimerFPS;
  9. new pDrunkLevelLast[MAX_PLAYERS];
  10. new pFPS[MAX_PLAYERS];
  11. new Text:FPS[MAX_PLAYERS];
  12. forward AggiornaFPS(playerid);
  13.  
  14. // Colori | Colors
  15. #define MioBlu 0x007DFFFF
  16. #define MyBlue 0x007DFFFF
  17. #define Rosso 0xFF0A00FF
  18. #define Red 0xFF0A00FF
  19. #define Verde 0x00FF00FF
  20. #define Green 0x00FF00FF
  21.  
  22. public OnFilterScriptInit()
  23. {
  24.     print("\n------------------------------------------------");
  25.     print(" Semplice Sistema Afk creato da Alex Palermitano");
  26.     print(" Afk Simple System created by Alex Palermitano");
  27.     print("-------------------------------------------------\n");
  28.     return 1;
  29. }
  30.  
  31. public OnFilterScriptExit()
  32. {
  33.     print("\n--------------------------------------");
  34.     print("");
  35.     print("--------------------------------------\n");
  36.     return 1;
  37. }
  38. public OnPlayerConnect(playerid)
  39. {
  40.     afk[playerid] = 0;
  41.    
  42.     FPS[playerid] = TextDrawCreate(596.000000, 0.000000, "_");
  43.     TextDrawBackgroundColor(FPS[playerid], 255);
  44.     TextDrawFont(FPS[playerid], 3);
  45.     TextDrawLetterSize(FPS[playerid], 0.669999, 1.900000);
  46.     TextDrawColor(FPS[playerid], -65281);
  47.     TextDrawSetOutline(FPS[playerid], 0);
  48.     TextDrawSetProportional(FPS[playerid], 1);
  49.     TextDrawSetShadow(FPS[playerid], 1);
  50.     fpsON[playerid] = 0;
  51.     return 1;
  52. }
  53.  
  54. public OnPlayerDisconnect(playerid, reason)
  55. {
  56.     afk[playerid] = 0;
  57.    
  58.     fpsON[playerid] = 0;
  59.     return 1;
  60. }
  61.  
  62. public OnPlayerSpawn(playerid)
  63. {
  64.     return 1;
  65. }
  66.  
  67. public OnPlayerDeath(playerid, killerid, reason)
  68. {
  69.     afk[playerid] = 0;
  70.     return 1;
  71. }
  72.  
  73. public OnVehicleSpawn(vehicleid)
  74. {
  75.     return 1;
  76. }
  77.  
  78. public OnVehicleDeath(vehicleid, killerid)
  79. {
  80.     return 1;
  81. }
  82.  
  83. public OnPlayerText(playerid, text[])
  84. {
  85.     return 1;
  86. }
  87.  
  88. public OnPlayerCommandText(playerid, cmdtext[])
  89. {
  90.     if (strcmp("/mycommand", cmdtext, true, 10) == 0)
  91.     {
  92.         // Do something here
  93.         return 1;
  94.     }
  95.     return 0;
  96. }
  97.  
  98. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  99. {
  100.     return 1;
  101. }
  102.  
  103. public OnPlayerExitVehicle(playerid, vehicleid)
  104. {
  105.     return 1;
  106. }
  107.  
  108. public OnPlayerStateChange(playerid, newstate, oldstate)
  109. {
  110.     return 1;
  111. }
  112.  
  113. public OnPlayerEnterCheckpoint(playerid)
  114. {
  115.     return 1;
  116. }
  117.  
  118. public OnPlayerLeaveCheckpoint(playerid)
  119. {
  120.     return 1;
  121. }
  122.  
  123. public OnPlayerEnterRaceCheckpoint(playerid)
  124. {
  125.     return 1;
  126. }
  127.  
  128. public OnPlayerLeaveRaceCheckpoint(playerid)
  129. {
  130.     return 1;
  131. }
  132.  
  133. public OnRconCommand(cmd[])
  134. {
  135.     return 1;
  136. }
  137.  
  138. public OnPlayerRequestSpawn(playerid)
  139. {
  140.     return 1;
  141. }
  142.  
  143. public OnObjectMoved(objectid)
  144. {
  145.     return 1;
  146. }
  147.  
  148. public OnPlayerObjectMoved(playerid, objectid)
  149. {
  150.     return 1;
  151. }
  152.  
  153. public OnPlayerPickUpPickup(playerid, pickupid)
  154. {
  155.     return 1;
  156. }
  157.  
  158. public OnVehicleMod(playerid, vehicleid, componentid)
  159. {
  160.     return 1;
  161. }
  162.  
  163. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  164. {
  165.     return 1;
  166. }
  167.  
  168. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  169. {
  170.     return 1;
  171. }
  172.  
  173. public OnPlayerSelectedMenuRow(playerid, row)
  174. {
  175.     return 1;
  176. }
  177.  
  178. public OnPlayerExitedMenu(playerid)
  179. {
  180.     return 1;
  181. }
  182.  
  183. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  184. {
  185.     return 1;
  186. }
  187.  
  188. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  189. {
  190.     return 1;
  191. }
  192.  
  193. public OnRconLoginAttempt(ip[], password[], success)
  194. {
  195.     return 1;
  196. }
  197.  
  198. public OnPlayerUpdate(playerid)
  199. {
  200.     new drunknew;
  201.     drunknew = GetPlayerDrunkLevel(playerid);
  202.  
  203.     if (drunknew < 100) {
  204.         SetPlayerDrunkLevel(playerid, 2000);
  205.     } else {
  206.  
  207.         if (pDrunkLevelLast[playerid] != drunknew) {
  208.  
  209.             new wfps = pDrunkLevelLast[playerid] - drunknew;
  210.  
  211.             if ((wfps > 0) && (wfps < 200))
  212.                 pFPS[playerid] = wfps;
  213.  
  214.             pDrunkLevelLast[playerid] = drunknew;
  215.         }
  216.  
  217.     }
  218.     return 1;
  219. }
  220.  
  221. public OnPlayerStreamIn(playerid, forplayerid)
  222. {
  223.     return 1;
  224. }
  225.  
  226. public OnPlayerStreamOut(playerid, forplayerid)
  227. {
  228.     return 1;
  229. }
  230.  
  231. public OnVehicleStreamIn(vehicleid, forplayerid)
  232. {
  233.     return 1;
  234. }
  235.  
  236. public OnVehicleStreamOut(vehicleid, forplayerid)
  237. {
  238.     return 1;
  239. }
  240.  
  241. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  242. {
  243.     return 1;
  244. }
  245.  
  246. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  247. {
  248.     return 1;
  249. }
  250.  
  251. CMD:afk(playerid, params[])
  252. {
  253.     if(afk[playerid] == 0)
  254.     {
  255.         afk[playerid] = 1;
  256.         label[playerid] = Create3DTextLabel("AFK",Verde,30.0,40.0,50.0,40.0,0);
  257.         SetPlayerVirtualWorld(playerid, 2);
  258.         TogglePlayerControllable(playerid,0);
  259.         Attach3DTextLabelToPlayer(label[playerid], playerid, 0.0, 0.0, 0.7);
  260.         SendClientMessage(playerid, Verde, "Info: {FFFFFF} Sei appena andato Afk, se non ritorni entro 15 minuti verrai kickato da questo server!!");
  261.         SendClientMessage(playerid, Green, "Info: {FFFFFF} You just went AFK, if you do not return within 15 minutes you will be kicked from this server!!");
  262.         SetTimer("AfkKick", 5000, playerid);
  263.     }
  264.     else
  265.     {
  266.         SendClientMessage(playerid, Verde, "Info: {FFFFFF} Sei già in modalità /afk!!");
  267.         SendClientMessage(playerid, Green, "Info: {FFFFFF} You are already in /afk mode!!");
  268.     }
  269. }
  270.  
  271. CMD:noafk(playerid, params[])
  272. {
  273.     if(afk[playerid] == 1) {
  274.         afk[playerid] = 0;
  275.         SetPlayerVirtualWorld(playerid, 0);
  276.         Delete3DTextLabel(Text3D:label[playerid]);
  277.         TogglePlayerControllable(playerid,1);
  278.         SendClientMessage(playerid, Verde, "Info: {FFFFFF} Non sei più in modalità /Afk!");
  279.         SendClientMessage(playerid, Green, "Info: {FFFFFF} You are no longer AFK mode!");
  280.     }
  281.     else {
  282.         SendClientMessage(playerid, Rosso, "Attenzione: {FFFFFF} Non sei in modalità /Afk!");
  283.         SendClientMessage(playerid, Red, "Warning: {FFFFFF} You are not in /Afk mode!");
  284.     }
  285. }
  286.  
  287. CMD:fps(playerid, params[])
  288. {
  289.     if(fpsON[playerid] == 0)
  290.     {
  291.         PlayerPlaySound(playerid,1054,0.0,0.0,0.0),
  292.         TimerFPS = SetTimerEx("AggiornaFPS", 500, true, "i",playerid);
  293.         fpsON[playerid] = 1;
  294.     }
  295.     else if(fpsON[playerid] == 1)
  296.     {
  297.         PlayerPlaySound(playerid,1054,0.0,0.0,0.0),
  298.         KillTimer(TimerFPS);
  299.         fpsON[playerid] = 0;
  300.         TextDrawHideForPlayer(playerid, FPS[playerid]);
  301.     }
  302. }
  303.  
  304. forward AfkKick(playerid);
  305. public AfkKick(playerid)
  306. {
  307.     if(afk[playerid] == 1)
  308.     {
  309.         SendClientMessage(playerid, MioBlu, "Kick: Sei stato kickato dal server. Motivo: Sei stato troppo in Afk");
  310.         SendClientMessage(playerid, MyBlue, "Kick: You have been kicked from the server. Reason: You've been too Afk");
  311.         Kick(playerid);
  312.     }
  313. }
  314.  
  315. public AggiornaFPS(playerid)
  316. {
  317.     new string[128];
  318.     format(string, sizeof(string), "%i",pFPS[playerid]);
  319.     TextDrawSetString(FPS[playerid], string);
  320.     TextDrawShowForPlayer(playerid, FPS[playerid]);
  321.     return 1;
  322. }
Advertisement
Add Comment
Please, Sign In to add comment