Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //////////////////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////////////////
- //======================== MOVING TEXTDRAW MOTD R2 BY AiRaLoKa =========================//
- //////////////////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////////////////
- //==================================== CREDITS =========================================//
- // PLEASE DO NOT REMOVE THE CREDITS //
- // SA-MP Teams - Wihout they all, this all will never exitst //
- // AiRaLoKa - For the whole script //
- // Y_Less - sscanf2 //
- // ZeeX - ZCMD //
- //////////////////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////////////////
- //////////////////////////////////////////////////////////////////////////////////////////
- //============================== INCLUDE ===============================================//
- //////////////////////////////////////////////////////////////////////////////////////////
- #include <a_samp>
- #include <dini>
- #include <sscanf>
- #include <zcmd>
- //////////////////////////////////////////////////////////////////////////////////////////
- //============================== DEFINES ===============================================//
- //////////////////////////////////////////////////////////////////////////////////////////
- #define FILTERSCRIPT
- #define File "MOTD.ini"
- #define MAX_MOTD 5
- //////////////////////////////////////////////////////////////////////////////////////////
- //============================== FORWARDS ==============================================//
- //////////////////////////////////////////////////////////////////////////////////////////
- forward MoveText(playerid);
- //////////////////////////////////////////////////////////////////////////////////////////
- //============================== NEWS ==================================================//
- //////////////////////////////////////////////////////////////////////////////////////////
- new Text:MOTDBack;
- new Text:MOTD;
- new MOTDMovingTimer;
- new Float:Pos = 640.000000;
- new MOTDText[MAX_MOTD][128];
- new CurrentMOTD;
- //////////////////////////////////////////////////////////////////////////////////////////
- //============================== PUBLICS ===============================================//
- //////////////////////////////////////////////////////////////////////////////////////////
- public OnFilterScriptInit()
- {
- if(dini_Exists(File))
- {
- for(new i; i < MAX_MOTD; i++)
- {
- new motdnum[10];
- format(motdnum, sizeof(motdnum), "MOTD_%d", i);
- format(MOTDText[i], 128, dini_Get(File, motdnum));
- }
- }
- else if(!dini_Exists(File))
- {
- dini_Create(File);
- for(new i; i < MAX_MOTD; i++)
- {
- new motdnum[10];
- format(motdnum, sizeof(motdnum), "MOTD_%d", i);
- format(MOTDText[i], 128, "Null");
- dini_Set(File, motdnum, MOTDText[i]);
- }
- }
- MOTDBack = TextDrawCreate(1270.000000, 433.750000, "usebox");
- TextDrawLetterSize(MOTDBack, 0.000000, 3.431018);
- TextDrawTextSize(MOTDBack, -2.100000, 0.000000);
- TextDrawAlignment(MOTDBack, 1);
- TextDrawColor(MOTDBack, 0);
- TextDrawUseBox(MOTDBack, true);
- TextDrawBoxColor(MOTDBack, 102);
- TextDrawSetShadow(MOTDBack, 0);
- TextDrawSetOutline(MOTDBack, 0);
- TextDrawFont(MOTDBack, 0);
- MOTD = TextDrawCreate(640.000000, 434.000000, MOTDText[0]);
- TextDrawLetterSize(MOTD, 0.449999, 1.600000);
- TextDrawAlignment(MOTD, 1);
- TextDrawColor(MOTD, -1);
- TextDrawSetShadow(MOTD, 0);
- TextDrawSetOutline(MOTD, 1);
- TextDrawBackgroundColor(MOTD, 51);
- TextDrawFont(MOTD, 1);
- TextDrawSetProportional(MOTD, 1);
- MOTDMovingTimer = SetTimer("MoveText", 10, true);
- print("\n/////////////////////////////////////////////////////////");
- print("//==== Moving TextDraw MOTD R2 By AiRaLoKa Loaded! ====//");
- print("/////////////////////////////////////////////////////////\n");
- return 1;
- }
- public OnFilterScriptExit()
- {
- KillTimer(MOTDMovingTimer);
- TextDrawDestroy(MOTD);
- TextDrawDestroy(MOTDBack);
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- TextDrawShowForPlayer(playerid, Text:MOTDBack);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- return 1;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- return 1;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- return 1;
- }
- public OnPlayerStateChange(playerid, newstate, oldstate)
- {
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerEnterRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnPlayerLeaveRaceCheckpoint(playerid)
- {
- return 1;
- }
- public OnRconCommand(cmd[])
- {
- return 1;
- }
- public OnPlayerRequestSpawn(playerid)
- {
- return 1;
- }
- public OnObjectMoved(objectid)
- {
- return 1;
- }
- public OnPlayerObjectMoved(playerid, objectid)
- {
- return 1;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- return 1;
- }
- public OnVehicleMod(playerid, vehicleid, componentid)
- {
- return 1;
- }
- public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
- {
- return 1;
- }
- public OnVehicleRespray(playerid, vehicleid, color1, color2)
- {
- return 1;
- }
- public OnPlayerSelectedMenuRow(playerid, row)
- {
- return 1;
- }
- public OnPlayerExitedMenu(playerid)
- {
- return 1;
- }
- public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
- {
- return 1;
- }
- public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
- {
- return 1;
- }
- public OnRconLoginAttempt(ip[], password[], success)
- {
- return 1;
- }
- public OnPlayerUpdate(playerid)
- {
- return 1;
- }
- public OnPlayerStreamIn(playerid, forplayerid)
- {
- return 1;
- }
- public OnPlayerStreamOut(playerid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamIn(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnVehicleStreamOut(vehicleid, forplayerid)
- {
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- return 1;
- }
- public OnPlayerClickPlayer(playerid, clickedplayerid, source)
- {
- return 1;
- }
- public MoveText()
- {
- if(Pos > -1300.000000)
- {
- Pos -= 0.5;
- TextDrawDestroy(Text:MOTD);
- MOTD = TextDrawCreate(Pos, 434.000000, MOTDText[CurrentMOTD]);
- TextDrawLetterSize(MOTD, 0.449999, 1.600000);
- TextDrawAlignment(MOTD, 1);
- TextDrawColor(MOTD, -1);
- TextDrawSetShadow(MOTD, 0);
- TextDrawSetOutline(MOTD, 1);
- TextDrawBackgroundColor(MOTD, 51);
- TextDrawFont(MOTD, 1);
- TextDrawSetProportional(MOTD, 1);
- TextDrawShowForAll(Text:MOTD);
- }
- else
- {
- KillTimer(MOTDMovingTimer);
- Pos = 640.000000;
- CurrentMOTD ++;
- if(CurrentMOTD > MAX_MOTD)
- {
- CurrentMOTD = 0;
- }
- MOTDMovingTimer = SetTimer("MoveText", 10, true);
- }
- return 1;
- }
- //////////////////////////////////////////////////////////////////////////////////////////
- //============================== COMMANDS ==============================================//
- //////////////////////////////////////////////////////////////////////////////////////////
- CMD:setmotd(playerid, params[])
- {
- new num;
- new newmotd[128];
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, 0xFF0000FF, "[ERROR]: You need to be RCon Administrator to use this command!");
- if(sscanf(params, "is[128]", num, newmotd)) return SendClientMessage(playerid, 0xFF0000FF, "[SYNTAX]: /setmotd [MOTD ID] [New MOTD]");
- if(num > MAX_MOTD || num < 0)
- {
- new str[128];
- format(str, sizeof(str), "[ERROR]: The MOTD Range is only from 0 to %d", MAX_MOTD);
- return SendClientMessage(playerid, 0xFF0000FF, str);
- }
- new motdnum[10];
- format(motdnum, sizeof(motdnum), "MOTD_%d", num);
- format(MOTDText[num], 128, newmotd);
- dini_Set(File, motdnum, MOTDText[num]);
- new bigstr[200];
- format(bigstr, sizeof(bigstr), "[INFO]: %s has been setted up into %s", motdnum, MOTDText[num]);
- return 1;
- }
- //////////////////////////////////////////////////////////////////////////////////////////
- //========================== END OF MOVING TEXTDRAW MOTD R2 ============================//
- //////////////////////////////////////////////////////////////////////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement