Advertisement
Guest User

TU V1.0

a guest
Dec 8th, 2014
439
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.98 KB | None | 0 0
  1. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  2. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  3. /////
  4. ///// /// /// /// //////////// ///////// //
  5. ///// /// /// /// /// /// /// // //
  6. ///// /// /// /// /// /// /// // //
  7. ///// /// /// /// /// /// /// // //
  8. ///// /// /// /// //////////// /// // // BY: DARTH_VADER
  9. ///// /// /// /// /// /// /// // //
  10. ///// //////////// //////////// /// /// /// // //
  11. ///// //////////// //////////// /// /// /// ////////
  12. /////
  13. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  14. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  15. #define FILTERSCRIPT
  16.  
  17. #include <a_samp>
  18. #include <zcmd>
  19.  
  20. //FPS
  21. new TimerFPS[MAX_PLAYERS];
  22. new Text:FPS[MAX_PLAYERS];
  23. //PING
  24. new Text:PingT[MAX_PLAYERS];
  25. //TEXTDRAW INTRO
  26. new Text:LOGIN;
  27. new Text:LOGIN2;
  28. new Text:LOGIN3;
  29. //NICK
  30. new Text:SEUNICK;
  31. new Text:NICK;
  32. //PLAYERS ON
  33. new Text:TextDrawPlayers;
  34. new PlayersOnline = 0;
  35. //SCORE
  36. new Text:ScoreTextDraw[MAX_PLAYERS];
  37. //COMANDOS
  38. #define DIALOG_TEXTDRAW 1//MUDE PARA UMA ID QUE NÃO DE CONFLITOS EM SEU GAMEMODE
  39. //CORES
  40. #define VERMELHO 0xFF0000AA
  41. #define AZUL 0x0000FFAA
  42.  
  43. public OnGameModeInit()
  44. {
  45. print("\n--------------------------------------");
  46. print("« Carregando Textdraw... »");
  47. print("\n--------------------------------------");
  48. //PING
  49. for( new i = 0; i < MAX_PLAYERS; i++ )
  50. {
  51. PingT[ i ] = TextDrawCreate(499.000000, 104.000000, " ");
  52. TextDrawBackgroundColor(PingT[ i ], 255);
  53. TextDrawAlignment(PingT[ i ], 1);
  54. TextDrawFont(PingT[ i ], 2);
  55. TextDrawLetterSize(PingT[ i ], 0.270000, 2.200000);
  56. TextDrawColor(PingT[ i ], -1);
  57. TextDrawSetOutline(PingT[ i ], 1);
  58. TextDrawSetProportional(PingT[ i ], 1);
  59. TextDrawSetShadow(PingT[ i ], 2);
  60. }
  61. //SCORE
  62. for(new i; i < MAX_PLAYERS; i++)
  63. {
  64. ScoreTextDraw[i] = TextDrawCreate(498.000000, 142.000000, " ");
  65. TextDrawBackgroundColor(ScoreTextDraw[i], 255);
  66. TextDrawFont(ScoreTextDraw[i], 2);
  67. TextDrawLetterSize(ScoreTextDraw[i], 0.270000, 2.200000);
  68. TextDrawColor(ScoreTextDraw[i], -1);
  69. TextDrawSetOutline(ScoreTextDraw[i], 1);
  70. TextDrawSetProportional(ScoreTextDraw[i], 1);
  71. TextDrawSetShadow(ScoreTextDraw[i], 1);
  72. }
  73. //TEXTDRAW INTRO
  74. LOGIN = TextDrawCreate(-30.000000, -5.000000, "TelaPreta");
  75. TextDrawBackgroundColor(LOGIN, 255);
  76. TextDrawFont(LOGIN, 1);
  77. TextDrawLetterSize(LOGIN, 0.700000, 53.099998);
  78. TextDrawColor(LOGIN, -1);
  79. TextDrawSetOutline(LOGIN, 0);
  80. TextDrawSetProportional(LOGIN, 1);
  81. TextDrawSetShadow(LOGIN, 1);
  82. TextDrawUseBox(LOGIN, 1);
  83. TextDrawBoxColor(LOGIN, 255);
  84. TextDrawTextSize(LOGIN, 650.000000, 30.000000);
  85. //
  86. LOGIN2 = TextDrawCreate(111.000000, 77.000000, "NOME DO SERVIDOR");
  87. TextDrawBackgroundColor(LOGIN2, 255);
  88. TextDrawAlignment(LOGIN2, 1);
  89. TextDrawFont(LOGIN2, 2);
  90. TextDrawLetterSize(LOGIN2, 0.949999, 9.299999);
  91. TextDrawUseBox(LOGIN2, 0);
  92. TextDrawColor(LOGIN2, 0xFFFFFFAA);
  93. TextDrawSetOutline(LOGIN2, 1);
  94. TextDrawSetProportional(LOGIN2, 1);
  95. //
  96. LOGIN3 = TextDrawCreate(477.000000, 148.000000, "VERSAO");
  97. TextDrawBackgroundColor(LOGIN3, 255);
  98. TextDrawAlignment(LOGIN3, 1);
  99. TextDrawFont(LOGIN3, 2);
  100. TextDrawLetterSize(LOGIN3, 0.579999, 2.499999);
  101. TextDrawUseBox(LOGIN3, 0);
  102. TextDrawColor(LOGIN3, 0xFFFFFFAA);
  103. TextDrawSetOutline(LOGIN3, 1);
  104. TextDrawSetProportional(LOGIN3, 1);
  105. //NICK
  106. SEUNICK = TextDrawCreate(225.000000, 207.000000, "SEU NICK E:");
  107. TextDrawBackgroundColor(SEUNICK, 255);
  108. TextDrawFont(SEUNICK, 2);
  109. TextDrawLetterSize(SEUNICK, 0.859999, 3.699998);
  110. TextDrawColor(SEUNICK, -1);
  111. TextDrawSetOutline(SEUNICK, 1);
  112. TextDrawSetProportional(SEUNICK, 1);
  113. //
  114. NICK = TextDrawCreate(98.000000, 264.000000, " ");
  115. TextDrawBackgroundColor(NICK, 255);
  116. TextDrawFont(NICK, 2);
  117. TextDrawLetterSize(NICK, 0.909999, 12.200010);
  118. TextDrawColor(NICK, -1);
  119. TextDrawSetOutline(NICK, 1);
  120. TextDrawSetProportional(NICK, 1);
  121. TextDrawSetShadow(NICK, 2);
  122. TextDrawAlignment(NICK, 1);
  123. //PLAYERS ON
  124. TextDrawPlayers = TextDrawCreate(498.000000, 123.000000, "");
  125. TextDrawBackgroundColor(TextDrawPlayers, 255);
  126. TextDrawFont(TextDrawPlayers, 2);
  127. TextDrawColor(TextDrawPlayers, -1);
  128. TextDrawSetOutline(TextDrawPlayers, 1);
  129. TextDrawSetProportional(TextDrawPlayers, 1);
  130. TextDrawSetShadow(TextDrawPlayers, 1);
  131. TextDrawAlignment(TextDrawPlayers, 1);
  132. TextDrawLetterSize(TextDrawPlayers, 0.329999, 2.299999);
  133. //-----------------------SETTIMERS------------------------------------//
  134. //SCORE
  135. SetTimer("AtualizarScore", 1000, 1);
  136. //PLAYERS ON
  137. SetTimer("PlayersOnlineText",1000, true);
  138. //PING
  139. SetTimer( "AtualizarPing", 1000, 1 );
  140. return 1;
  141. }
  142. public OnPlayerConnect(playerid)
  143. {
  144. SendClientMessage(playerid,AZUL,"Esse Servidor Possui Um Sistema De Textdraw Feito Por: Darth_Vader");
  145. //NICK
  146. new string[128];
  147. format(string, sizeof(string), "%s", rNome(playerid));
  148. TextDrawSetString(NICK, string);
  149. //FPS
  150. FPS[playerid] = TextDrawCreate(564.000000, 104.000000, " ");
  151. TextDrawBackgroundColor(FPS[playerid], 255);
  152. TextDrawFont(FPS[playerid], 2);
  153. TextDrawLetterSize(FPS[playerid], 0.270000, 2.200000);
  154. TextDrawColor(FPS[playerid], -1);
  155. TextDrawSetOutline(FPS[playerid], 1);
  156. TextDrawSetProportional(FPS[playerid], 1);
  157. TextDrawSetShadow(FPS[playerid], 2);
  158. //TEXTDRAW INTRO
  159. TextDrawShowForPlayer(playerid,LOGIN);
  160. TextDrawShowForPlayer(playerid,LOGIN2);
  161. TextDrawShowForPlayer(playerid,LOGIN3);
  162. //NICK
  163. TextDrawShowForPlayer(playerid,SEUNICK);
  164. TextDrawShowForPlayer(playerid,NICK);
  165. //FPS
  166. TimerFPS[playerid] = SetTimerEx("AtualizarFPS", 1000, true, "i", playerid);
  167. //PLAYERS ON
  168. PlayersOnline++;
  169. return 1;
  170. }
  171. public OnPlayerDisconnect(playerid, reason)
  172. {
  173. //FPS
  174. switch(reason)
  175. {
  176.  
  177. case 0..2: KillTimer(TimerFPS[playerid]);
  178. }
  179. //PLAYERS ON
  180. PlayersOnline--;
  181. }
  182. public OnPlayerRequestClass(playerid, classid)
  183. {
  184. //TEXTDRAW INTRO
  185. TextDrawHideForPlayer(playerid, LOGIN);
  186. TextDrawHideForPlayer(playerid, LOGIN2);
  187. TextDrawHideForPlayer(playerid, LOGIN3);
  188. //NICK
  189. TextDrawHideForPlayer(playerid, SEUNICK);
  190. TextDrawHideForPlayer(playerid, NICK);
  191. //SCORE
  192. for(new i; i < MAX_PLAYERS; i++)
  193. {
  194. TextDrawHideForPlayer(playerid, ScoreTextDraw[i]);
  195. }
  196. //PLAYERS ON
  197. TextDrawHideForPlayer(playerid, TextDrawPlayers);
  198. return 1;
  199. }
  200. public OnPlayerSpawn(playerid)
  201. {
  202. //PING
  203. for( new i = 0; i < MAX_PLAYERS; i++ )
  204. {
  205. if( IsPlayerConnected( i ) )
  206. {
  207.  
  208. TextDrawShowForPlayer( i, PingT[ i ] );
  209. }
  210. }
  211. //FPS
  212. TextDrawShowForPlayer(playerid, FPS[playerid]);
  213. //SCORE
  214. for(new i; i < MAX_PLAYERS; i++)
  215. {
  216. TextDrawShowForPlayer(playerid, ScoreTextDraw[i]);
  217. }
  218. //PLAYERS ON
  219. TextDrawShowForPlayer(playerid, TextDrawPlayers);
  220. }
  221. public OnPlayerDeath(playerid, killerid, reason)
  222. {
  223. //FPS
  224. TextDrawHideForPlayer(playerid, FPS[playerid]);
  225. //PING
  226. TextDrawHideForPlayer(playerid, PingT[playerid]);
  227. //PLAYERS ON
  228. TextDrawHideForPlayer(playerid, TextDrawPlayers);
  229. //SCORE
  230. for(new i; i < MAX_PLAYERS; i++)
  231. {
  232. TextDrawHideForPlayer(playerid, ScoreTextDraw[i]);
  233. }
  234. return 1;
  235. }
  236. //PING
  237. forward AtualizarPing();
  238. public AtualizarPing()
  239. {
  240. new string[ 16 ];
  241. for( new i = 0; i < MAX_PLAYERS; i++ )
  242. {
  243. if( IsPlayerConnected( i ) )
  244. {
  245. format( string, sizeof( string ), "~r~PING: ~w~%d", GetPlayerPing(i) );
  246. TextDrawSetString( PingT[ i ], string);
  247. }
  248. }
  249. return 1;
  250. }
  251. //FPS
  252. forward AtualizarFPS(playerid);
  253. public AtualizarFPS(playerid)
  254. {
  255. new string[128];
  256. format(string, sizeof(string), "~y~FPS: ~w~%d", GetPlayerFPS(playerid));
  257. TextDrawSetString(FPS[playerid], string);
  258. return 1;
  259. }
  260. //SCORE
  261. forward AtualizarScore(playerid);
  262. public AtualizarScore(playerid)
  263. {
  264. for(new i=0; i<MAX_PLAYERS; i++)
  265. {
  266. if(IsPlayerConnected(i))
  267. {
  268. new STR[26];
  269. format(STR, 26, "~b~SCORES: ~w~%i", GetPlayerScore(i));
  270. TextDrawSetString(ScoreTextDraw[i], STR);
  271. }
  272. }
  273. return 1;
  274. }
  275. //PLAYERS
  276. forward PlayersOnlineText();
  277. public PlayersOnlineText()
  278. {
  279. new String[100];
  280. format(String, sizeof(String), "~w~~h~PLAYERS: ~w~%d~w~~w~/~w~%d", PlayersOnline, GetMaxPlayers());
  281. TextDrawSetString(TextDrawPlayers, String);
  282. return 1;
  283. }
  284. //COMANDO
  285. CMD:hud(playerid, params[])
  286. {
  287. ShowPlayerDialog(playerid, DIALOG_TEXTDRAW, DIALOG_STYLE_MSGBOX, "{FF0000}#{FFFFFF}HUD", "{0000FF}O Que Você Fazer Com As Tetxdraw", "Exibir", "Esconder");
  288. return 1;
  289. }
  290. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  291. {
  292. if(dialogid == DIALOG_TEXTDRAW)
  293. {
  294. if(response)
  295. {
  296. //PING
  297. for( new i = 0; i < MAX_PLAYERS; i++ )
  298. {
  299. if( IsPlayerConnected( i ) )
  300. {
  301.  
  302. TextDrawShowForPlayer( i, PingT[ i ] );
  303. }
  304. }
  305. //FPS
  306. TextDrawShowForPlayer(playerid, FPS[playerid]);
  307. //SCORE
  308. for(new i; i < MAX_PLAYERS; i++)
  309. {
  310. TextDrawShowForPlayer(playerid, ScoreTextDraw[i]);
  311. }
  312. //PLAYERS ON
  313. TextDrawShowForPlayer(playerid, TextDrawPlayers);
  314. SendClientMessage(playerid,VERMELHO,"Você Está Exibindo O HUD");
  315. }
  316. else
  317. {
  318. //FPS
  319. TextDrawHideForPlayer(playerid, FPS[playerid]);
  320. //PING
  321. TextDrawHideForPlayer(playerid, PingT[playerid]);
  322. //PLAYERS ON
  323. TextDrawHideForPlayer(playerid, TextDrawPlayers);
  324. //SCORE
  325. for(new i; i < MAX_PLAYERS; i++)
  326. {
  327. TextDrawHideForPlayer(playerid, ScoreTextDraw[i]);
  328. }
  329. SendClientMessage(playerid,VERMELHO,"Você Está Escondendo O HUD");
  330. }
  331. return true;
  332. }
  333. return 0;
  334. }
  335. //FPS
  336. stock GetPlayerFPS(playerid)
  337. {
  338. SetPVarInt(playerid, "DrunkL", GetPlayerDrunkLevel(playerid));
  339. if(GetPVarInt(playerid, "DrunkL") < 100)
  340. {
  341. SetPlayerDrunkLevel(playerid, 2000);
  342. }
  343. else
  344. {
  345. if(GetPVarInt(playerid, "LDrunkL") != GetPVarInt(playerid, "DrunkL"))
  346. {
  347. SetPVarInt(playerid, "FPS", (GetPVarInt(playerid, "LDrunkL") - GetPVarInt(playerid, "DrunkL")));
  348. SetPVarInt(playerid, "LDrunkL", GetPVarInt(playerid, "DrunkL"));
  349. if((GetPVarInt(playerid, "FPS") > 0) && (GetPVarInt(playerid, "FPS") < 256))
  350. {
  351. return GetPVarInt(playerid, "FPS") - 1;
  352. }
  353. }
  354. }
  355. return 0;
  356. }
  357. //NICK
  358. stock rNome(playerid)
  359. {
  360. new rnome[MAX_PLAYER_NAME];
  361. GetPlayerName(playerid, rnome, MAX_PLAYER_NAME);
  362. return rnome;
  363. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement