Advertisement
AiRaLoKa

Moving TextDraw MOTD R2

Jun 8th, 2014
791
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 9.01 KB | None | 0 0
  1. //////////////////////////////////////////////////////////////////////////////////////////
  2. //////////////////////////////////////////////////////////////////////////////////////////
  3. //======================== MOVING TEXTDRAW MOTD R2 BY AiRaLoKa =========================//
  4. //////////////////////////////////////////////////////////////////////////////////////////
  5. //////////////////////////////////////////////////////////////////////////////////////////
  6. //==================================== CREDITS =========================================//
  7. //                         PLEASE DO NOT REMOVE THE CREDITS                             //
  8. //                SA-MP Teams - Wihout they all, this all will never exitst             //
  9. //                          AiRaLoKa - For the whole script                             //
  10. //                                  Y_Less - sscanf2                                    //
  11. //                                    ZeeX - ZCMD                                       //
  12. //////////////////////////////////////////////////////////////////////////////////////////
  13. //////////////////////////////////////////////////////////////////////////////////////////
  14.  
  15. //////////////////////////////////////////////////////////////////////////////////////////
  16. //============================== INCLUDE ===============================================//
  17. //////////////////////////////////////////////////////////////////////////////////////////
  18.  
  19. #include <a_samp>
  20. #include <dini>
  21. #include <sscanf>
  22. #include <zcmd>
  23.  
  24. //////////////////////////////////////////////////////////////////////////////////////////
  25. //============================== DEFINES ===============================================//
  26. //////////////////////////////////////////////////////////////////////////////////////////
  27.  
  28. #define FILTERSCRIPT
  29. #define File       "MOTD.ini"
  30. #define MAX_MOTD        5
  31.  
  32. //////////////////////////////////////////////////////////////////////////////////////////
  33. //============================== FORWARDS ==============================================//
  34. //////////////////////////////////////////////////////////////////////////////////////////
  35.  
  36. forward MoveText(playerid);
  37.  
  38. //////////////////////////////////////////////////////////////////////////////////////////
  39. //============================== NEWS ==================================================//
  40. //////////////////////////////////////////////////////////////////////////////////////////
  41.  
  42. new Text:MOTDBack;
  43. new Text:MOTD;
  44. new MOTDMovingTimer;
  45. new Float:Pos = 640.000000;
  46. new MOTDText[MAX_MOTD][128];
  47. new CurrentMOTD;
  48.  
  49. //////////////////////////////////////////////////////////////////////////////////////////
  50. //============================== PUBLICS ===============================================//
  51. //////////////////////////////////////////////////////////////////////////////////////////
  52.  
  53. public OnFilterScriptInit()
  54. {
  55.     if(dini_Exists(File))
  56.     {
  57.         for(new i; i < MAX_MOTD; i++)
  58.         {
  59.             new motdnum[10];
  60.             format(motdnum, sizeof(motdnum), "MOTD_%d", i);
  61.             format(MOTDText[i], 128, dini_Get(File, motdnum));
  62.         }
  63.     }
  64.     else if(!dini_Exists(File))
  65.     {
  66.         dini_Create(File);
  67.         for(new i; i < MAX_MOTD; i++)
  68.         {
  69.             new motdnum[10];
  70.             format(motdnum, sizeof(motdnum), "MOTD_%d", i);
  71.             format(MOTDText[i], 128, "Null");
  72.             dini_Set(File, motdnum, MOTDText[i]);
  73.         }
  74.     }
  75.     MOTDBack = TextDrawCreate(1270.000000, 433.750000, "usebox");
  76.     TextDrawLetterSize(MOTDBack, 0.000000, 3.431018);
  77.     TextDrawTextSize(MOTDBack, -2.100000, 0.000000);
  78.     TextDrawAlignment(MOTDBack, 1);
  79.     TextDrawColor(MOTDBack, 0);
  80.     TextDrawUseBox(MOTDBack, true);
  81.     TextDrawBoxColor(MOTDBack, 102);
  82.     TextDrawSetShadow(MOTDBack, 0);
  83.     TextDrawSetOutline(MOTDBack, 0);
  84.     TextDrawFont(MOTDBack, 0);
  85.  
  86.     MOTD = TextDrawCreate(640.000000, 434.000000, MOTDText[0]);
  87.     TextDrawLetterSize(MOTD, 0.449999, 1.600000);
  88.     TextDrawAlignment(MOTD, 1);
  89.     TextDrawColor(MOTD, -1);
  90.     TextDrawSetShadow(MOTD, 0);
  91.     TextDrawSetOutline(MOTD, 1);
  92.     TextDrawBackgroundColor(MOTD, 51);
  93.     TextDrawFont(MOTD, 1);
  94.     TextDrawSetProportional(MOTD, 1);
  95.  
  96.     MOTDMovingTimer = SetTimer("MoveText", 10, true);
  97.    
  98.     print("\n/////////////////////////////////////////////////////////");
  99.     print("//==== Moving TextDraw MOTD R2 By AiRaLoKa Loaded! ====//");
  100.     print("/////////////////////////////////////////////////////////\n");
  101.     return 1;
  102. }
  103.  
  104. public OnFilterScriptExit()
  105. {
  106.     KillTimer(MOTDMovingTimer);
  107.     TextDrawDestroy(MOTD);
  108.     TextDrawDestroy(MOTDBack);
  109.     return 1;
  110. }
  111.  
  112. public OnPlayerRequestClass(playerid, classid)
  113. {
  114.     return 1;
  115. }
  116.  
  117. public OnPlayerConnect(playerid)
  118. {
  119.     TextDrawShowForPlayer(playerid, Text:MOTDBack);
  120.     return 1;
  121. }
  122.  
  123. public OnPlayerDisconnect(playerid, reason)
  124. {
  125.     return 1;
  126. }
  127.  
  128. public OnPlayerSpawn(playerid)
  129. {
  130.     return 1;
  131. }
  132.  
  133. public OnPlayerDeath(playerid, killerid, reason)
  134. {
  135.     return 1;
  136. }
  137.  
  138. public OnVehicleSpawn(vehicleid)
  139. {
  140.     return 1;
  141. }
  142.  
  143. public OnVehicleDeath(vehicleid, killerid)
  144. {
  145.     return 1;
  146. }
  147.  
  148. public OnPlayerText(playerid, text[])
  149. {
  150.     return 1;
  151. }
  152.  
  153. public OnPlayerCommandText(playerid, cmdtext[])
  154. {
  155.     return 1;
  156. }
  157.  
  158. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  159. {
  160.     return 1;
  161. }
  162.  
  163. public OnPlayerExitVehicle(playerid, vehicleid)
  164. {
  165.     return 1;
  166. }
  167.  
  168. public OnPlayerStateChange(playerid, newstate, oldstate)
  169. {
  170.     return 1;
  171. }
  172.  
  173. public OnPlayerEnterCheckpoint(playerid)
  174. {
  175.     return 1;
  176. }
  177.  
  178. public OnPlayerLeaveCheckpoint(playerid)
  179. {
  180.     return 1;
  181. }
  182.  
  183. public OnPlayerEnterRaceCheckpoint(playerid)
  184. {
  185.     return 1;
  186. }
  187.  
  188. public OnPlayerLeaveRaceCheckpoint(playerid)
  189. {
  190.     return 1;
  191. }
  192.  
  193. public OnRconCommand(cmd[])
  194. {
  195.     return 1;
  196. }
  197.  
  198. public OnPlayerRequestSpawn(playerid)
  199. {
  200.     return 1;
  201. }
  202.  
  203. public OnObjectMoved(objectid)
  204. {
  205.     return 1;
  206. }
  207.  
  208. public OnPlayerObjectMoved(playerid, objectid)
  209. {
  210.     return 1;
  211. }
  212.  
  213. public OnPlayerPickUpPickup(playerid, pickupid)
  214. {
  215.     return 1;
  216. }
  217.  
  218. public OnVehicleMod(playerid, vehicleid, componentid)
  219. {
  220.     return 1;
  221. }
  222.  
  223. public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
  224. {
  225.     return 1;
  226. }
  227.  
  228. public OnVehicleRespray(playerid, vehicleid, color1, color2)
  229. {
  230.     return 1;
  231. }
  232.  
  233. public OnPlayerSelectedMenuRow(playerid, row)
  234. {
  235.     return 1;
  236. }
  237.  
  238. public OnPlayerExitedMenu(playerid)
  239. {
  240.     return 1;
  241. }
  242.  
  243. public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
  244. {
  245.     return 1;
  246. }
  247.  
  248. public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
  249. {
  250.     return 1;
  251. }
  252.  
  253. public OnRconLoginAttempt(ip[], password[], success)
  254. {
  255.     return 1;
  256. }
  257.  
  258. public OnPlayerUpdate(playerid)
  259. {
  260.     return 1;
  261. }
  262.  
  263. public OnPlayerStreamIn(playerid, forplayerid)
  264. {
  265.     return 1;
  266. }
  267.  
  268. public OnPlayerStreamOut(playerid, forplayerid)
  269. {
  270.     return 1;
  271. }
  272.  
  273. public OnVehicleStreamIn(vehicleid, forplayerid)
  274. {
  275.     return 1;
  276. }
  277.  
  278. public OnVehicleStreamOut(vehicleid, forplayerid)
  279. {
  280.     return 1;
  281. }
  282.  
  283. public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
  284. {
  285.     return 1;
  286. }
  287.  
  288. public OnPlayerClickPlayer(playerid, clickedplayerid, source)
  289. {
  290.     return 1;
  291. }
  292.  
  293. public MoveText()
  294. {
  295.     if(Pos > -1300.000000)
  296.     {
  297.         Pos -= 0.5;
  298.         TextDrawDestroy(Text:MOTD);
  299.         MOTD = TextDrawCreate(Pos, 434.000000, MOTDText[CurrentMOTD]);
  300.         TextDrawLetterSize(MOTD, 0.449999, 1.600000);
  301.         TextDrawAlignment(MOTD, 1);
  302.         TextDrawColor(MOTD, -1);
  303.         TextDrawSetShadow(MOTD, 0);
  304.         TextDrawSetOutline(MOTD, 1);
  305.         TextDrawBackgroundColor(MOTD, 51);
  306.         TextDrawFont(MOTD, 1);
  307.         TextDrawSetProportional(MOTD, 1);
  308.         TextDrawShowForAll(Text:MOTD);
  309.     }
  310.     else
  311.     {
  312.         KillTimer(MOTDMovingTimer);
  313.         Pos = 640.000000;
  314.         CurrentMOTD ++;
  315.         if(CurrentMOTD > MAX_MOTD)
  316.         {
  317.             CurrentMOTD = 0;
  318.         }
  319.         MOTDMovingTimer = SetTimer("MoveText", 10, true);
  320.     }
  321.     return 1;
  322. }
  323.  
  324. //////////////////////////////////////////////////////////////////////////////////////////
  325. //============================== COMMANDS ==============================================//
  326. //////////////////////////////////////////////////////////////////////////////////////////
  327.  
  328. CMD:setmotd(playerid, params[])
  329. {
  330.     new num;
  331.     new newmotd[128];
  332.     if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "[ERROR]: You need to be RCon Administrator to use this command!");
  333.     if(sscanf(params, "is[128]", num, newmotd)) return SendClientMessage(playerid, 0xFF0000FF, "[SYNTAX]: /setmotd [MOTD ID] [New MOTD]");
  334.     if(num > MAX_MOTD || num < 0)
  335.     {
  336.         new str[128];
  337.         format(str, sizeof(str), "[ERROR]: The MOTD Range is only from 0 to %d", MAX_MOTD);
  338.         return SendClientMessage(playerid, 0xFF0000FF, str);
  339.     }
  340.     new motdnum[10];
  341.     format(motdnum, sizeof(motdnum), "MOTD_%d", num);
  342.     format(MOTDText[num], 128, newmotd);
  343.     dini_Set(File, motdnum, MOTDText[num]);
  344.     new bigstr[200];
  345.     format(bigstr, sizeof(bigstr), "[INFO]: %s has been setted up into %s", motdnum, MOTDText[num]);
  346.     return 1;
  347. }
  348.  
  349. //////////////////////////////////////////////////////////////////////////////////////////
  350. //========================== END OF MOVING TEXTDRAW MOTD R2 ============================//
  351. //////////////////////////////////////////////////////////////////////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement