Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- *********************************
- * Maploader by Jstylezzz *
- * Keep the credits! *
- * *
- * V1.1 *
- *********************************
- Idea by zClaw - http://forum.sa-mp.com/member.php?u=190121
- Link to the Idea post - http://forum.sa-mp.com/showthread.php?t=415791
- Script by Jstylezzz - http://forum.sa-mp.com/member.php?u=140130
- I updated the release thread with a detailed explanation on how to add maps.
- Feel free to send me any script requests! ~ Jstylezzz
- Update marked as done - 7/5/13 - DD/MM/YY
- */
- #include <a_samp> //Credits to the SA-MP Team
- #include <zcmd> //Credits to Zeex
- #include <streamer> //Credits to Incognito
- #include <timerfix> //Credits to Slice
- #include <mapping> //All your mapping needs to be placed here, read the release thread for detailed instructions
- #define CHANGE_INTERVAL 15*60000 //change this to the amount of minutes to trigger the map change, change the first number (time in minutes)
- //default is 15 minutes
- #define MAX_FASES 3 //max number of maps, to add more maps, increase this number
- #define COLOR_RED 0xFF0000FF
- #define COLOR_ORANGE 0xFFA500FF
- public OnFilterScriptInit()
- {
- print("\n--------------------------------------");
- print(" Maploader by Jstylezzz ");
- print("--------------------------------------\n");
- if(!fexist("fase.txt"))
- {
- new File:fasenum=fopen("fase.txt", io_write);
- new text[128];
- format(text,128,"%d",0);
- fwrite(fasenum, text);
- fclose(fasenum);
- print("\n---------------------------------------------");
- print("Fase config file not existing.. Creating it now");
- print("---------------------------------------------\n");
- }
- new fase;
- new tempstring[64];
- new File:fasenum = fopen("fase.txt", io_read);
- fread(fasenum, tempstring);
- fclose(fasenum);
- fase = strval(tempstring);
- Changemap(fase);
- return 1;
- }
- forward Warnplayers();
- public Warnplayers()
- {
- SendClientMessageToAll(COLOR_ORANGE,"[Maploader]Attention all players! In 10 seconds the server will move on to the next map!");
- print("[Maploader]Switching to next map in 10 seconds!");
- }
- forward Changemap(fase);
- public Changemap(fase)
- {
- SendClientMessageToAll(COLOR_ORANGE,"[Maploader]Next map loaded!");
- DestroyAllDynamicObjects();
- switch(fase)
- {
- case 0:
- {
- Mapping_CreateFaseOne();
- }
- case 1:
- {
- Mapping_CreateFaseTwo();
- }
- case 2:
- {
- Mapping_CreateFaseThree();
- }
- }
- new File:fasenum=fopen("fase.txt", io_write);
- new text[128];
- format(text,128,"%d",random(MAX_FASES));
- fwrite(fasenum, text);
- fclose(fasenum);
- new nfase = strval(text);
- SetTimer("Warnplayers",CHANGE_INTERVAL-10000,false);
- SetTimerEx("Changemap",CHANGE_INTERVAL,false,"i",nfase);
- print("\n---------------------------------------------");
- printf("Maploader switching to next map in %d minutes.\nMap loaded: %d ",CHANGE_INTERVAL/60000,nfase);
- print("---------------------------------------------\n");
- }
- public OnPlayerConnect(playerid)
- {
- SendClientMessage(playerid,COLOR_ORANGE,"[Maploader] This server is powered by Jstylezzz' Maploader");
- return 1;
- }
- //commands
- CMD:changenow(playerid,params[])
- {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid,COLOR_RED,"Only RCON admins can use this command.");
- new File:fasenum=fopen("fase.txt", io_write);
- new text[128];
- format(text,128,"%d",random(MAX_FASES));
- fwrite(fasenum, text);
- fclose(fasenum);
- SendClientMessage(playerid,COLOR_ORANGE,"[Maploader] You have initiated the map changing process.");
- SendClientMessageToAll(COLOR_RED,"[Maploader] Map changing forced by admin.");
- SetTimerEx("Changemap",10000,false,"i",strval(text));
- Warnplayers();
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement