Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // All credits go to Wups!
- // Includes
- #include <a_samp>
- // End
- // Defines
- #define ForEachPlayer(%0) for(new index_%0=0, %0=ConnectedPlayerList[0]; index_%0<ConnectedPlayers; index_%0++, %0=ConnectedPlayerList[index_%0])
- #define GREY 0xB4B5B7FF
- #define ORANGE 0xFF8C00AA
- #define Orange 0xFF8C00AA
- #define GREEN 0x33AA33AA
- #define YELLOW 0xFFFF00AA
- #define HOMER 0xFF0000AA
- #define BLUE 0x33CCFFAA
- #define ABLUE 0x2641FEAA
- #define SYNTAX 0xAA3333AA
- #define OTHER 0xFF6347AA
- #define WHITE 0xFFFFFFAA
- #define PURPLE 0xC2A2DAAA
- // Costumization
- #define LAUNCH_TIME 90 // Rocket Lauch time in seconds. For me it is best 90.
- #define ROUND_RESTART // Comment if you don't want the game mode auto restarting.
- #define RESTART_TIME 3600 // If GM is auto restarting - time to auto restart. Time is in seconds.
- // End
- // Forwards
- forward Check();
- forward Restart();
- forward Restart1();
- forward Launched();
- forward IsOnRocket();
- forward CountDown();
- // values
- new rocket,timeleft = LAUNCH_TIME,timer;
- new
- item1,
- item2,
- item3,
- item4;
- new
- place1,
- place2,
- place3,
- place4;
- enum Items
- {
- Money,
- XP,
- LVL,
- holding
- }
- new DB[MAX_PLAYERS][Items];
- enum Pos
- {
- Float:IntX,
- Float:IntY,
- Float:IntZ
- }
- #define MUCH 19
- new const
- Pickups[MUCH][ Pos ] =
- {
- {240.6358,1859.8672,17.8985}, // place
- {153.1655,1845.0262,17.6406}, // place
- {277.4870,1836.9594,11.5239}, // place
- {237.9041,1801.4854,7.4141}, // place
- {246.8211,1860.9368,14.0840}, // place
- {281.5044,1820.5909,4.7114}, // place
- {266.4630,1895.4285,25.4985}, // place
- {245.1866,1869.4648,8.7650}, // place
- {142.1472,1875.2747,17.8434}, // place
- {293.4821,1820.6752,4.7109}, // place
- {246.0950,1831.4540,12.3509}, // place
- {210.8548,1820.6373,7.4141}, // place
- {257.7172,1818.7261,1.0078}, // place
- {255.4552,1810.5033,4.7109}, // place
- {277.5846,1874.0669,8.7578}, // place
- {256.3776,1802.4285,7.5214}, // place
- {158.7069,1929.8846,27.8438}, // place
- {211.5485,1811.4919,21.8594}, // place
- {249.8331,1816.3413,12.2463} // place
- };
- new
- ConnectedPlayers,
- ConnectedPlayerList[MAX_PLAYERS+1];
- main()
- {
- print("\n----------------------------------");
- print(" Escape from AREA 51");
- print("----------------------------------\n");
- }
- public OnGameModeInit()
- {
- SetGameModeText("Escape from");
- SendRconCommand("mapname Area 51");
- rocket = CreateObject(17050,268.78613281,1883.78320312,-31.09375000,0.00000000,0.00000000,0.00000000); //foguete
- Create3DTextLabel( "1st Battery Cell", WHITE, 268.6331,1891.3718,5.9139, 20.0, 0, 1 );
- Create3DTextLabel( "2nd Battery Cell", WHITE, 268.7466,1876.6882,-3.4694, 20.0, 0, 1 );
- Create3DTextLabel( "3rd Battery Cell", WHITE, 268.6223,1891.2946,-12.8596, 20.0, 0, 1 );
- Create3DTextLabel( "4th Battery Cell", WHITE, 269.0400,1876.5714,-22.2449, 20.0, 0, 1 );
- new id = random(15);
- id++;
- item1 = AddCell(Pickups[id][IntX],Pickups[id][IntY],Pickups[id][IntZ]);
- id++;
- item2 = AddCell(Pickups[id][IntX],Pickups[id][IntY],Pickups[id][IntZ]);
- id++;
- item3 = AddCell(Pickups[id][IntX],Pickups[id][IntY],Pickups[id][IntZ]);
- id++;
- item4 = AddCell(Pickups[id][IntX],Pickups[id][IntY],Pickups[id][IntZ]);
- SetTimer("Check",2000,true);
- AddPlayerClass(165,117.0963,1813.4122,33.4975,10.1864,24,20,25,100,34,10); // Spawn
- AddPlayerClass(166,107.6730,1900.1848,33.4982,356.5878,24,20,25,100,34,10); // Spawn
- AddPlayerClass(284,265.6358,1806.5851,33.4972,2.2907,24,20,25,100,34,10); // Spawn6
- AddPlayerClass(285,165.7563,1931.8768,33.4964,176.2942,24,20,25,100,34,10); // Spawn
- AddPlayerClass(286,236.9397,1934.3514,33.5008,182.8743,24,20,25,100,34,10); // Spawn
- AddPlayerClass(287,270.9631,1894.2793,33.4976,96.8948,24,20,25,100,34,10); // Spawn5
- #if defined ROUND_RESTART
- SetTimer("Restart",RESTART_TIME*1000,false);
- #endif
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerPos(playerid, 180.3154,1919.8483,17.9419);
- SetPlayerFacingAngle(playerid,47.1800);
- SetPlayerCameraPos(playerid, 174.3843,1925.4944,20.1752);
- SetPlayerCameraLookAt(playerid, 180.3154,1919.8483,17.9419);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- if(IsPlayerNPC(playerid)) return 1;
- DB[playerid][holding]=0;
- ConnectedPlayerList[ConnectedPlayers++]=playerid;
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- for(new i=0;i<ConnectedPlayers;i++)
- {
- if(ConnectedPlayerList[i]==playerid)
- {
- ConnectedPlayers--;
- ConnectedPlayerList[i]=ConnectedPlayerList[ConnectedPlayers];
- }
- }
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(killerid != INVALID_PLAYER_ID)
- {
- SendClientMessage(killerid,ORANGE," Oh noes! You killed a player! Bad kitty..");
- SetPlayerScore(killerid,GetPlayerScore(killerid)-10);
- }
- if(DB[playerid][holding]!=0)
- {
- new Float:Coo[3];
- GetPlayerPos(playerid,Coo[0],Coo[1],Coo[2]);
- StopPlayerHoldingObject(playerid);
- new i = DB[playerid][holding];
- switch(i)
- {
- case 1: item1 = CreatePickup(1252,2,Coo[0],Coo[1],Coo[2]);
- case 2: item2 = CreatePickup(1252,2,Coo[0],Coo[1],Coo[2]);
- case 3: item3 = CreatePickup(1252,2,Coo[0],Coo[1],Coo[2]);
- case 4: item4 = CreatePickup(1252,2,Coo[0],Coo[1],Coo[2]);
- }
- DB[playerid][holding]=0;
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if(strcmp(cmdtext, "/help", true)==0)
- {
- SendClientMessage(playerid,BLUE,".:' Escape from AREA 51 ':.");
- SendClientMessage(playerid,ORANGE,".:' Objective: ':.");
- SendClientMessage(playerid,YELLOW," Your objective is to get all cells, and place them.");
- SendClientMessage(playerid,WHITE,"Bonus: Put the last cell, Jump on a rocket when it is launching.");
- SendClientMessage(playerid,BLUE,"If another player has taken a cell - kill him, and take the cell.");
- SendClientMessage(playerid,BLUE,"The cells are placed all around AREA 51.");
- SendClientMessage(playerid,GREEN,"GameMode Credits: Wups!");
- return 1;
- }
- return SendClientMessage(playerid,BLUE," There is no such command. Write /help !");
- }
- public OnPlayerUpdate(playerid)
- {
- if(DB[playerid][holding]!=0)
- {
- if(GetPlayerWeapon(playerid)) SetPlayerArmedWeapon(playerid,0);
- }
- return 1;
- }
- stock AddCell(Float:X,Float:Y,Float:Z)
- {
- new id = CreatePickup(1252,2,X,Y,Z);
- return id;
- }
- public OnPlayerPickUpPickup(playerid, pickupid)
- {
- if(DB[playerid][holding]!=0) return SendClientMessage(playerid,PURPLE," * You are already holding a cell!");
- if(pickupid == item1)
- {
- DestroyPickup(pickupid);
- item1 = -1;
- SendClientMessageToAll(YELLOW," The first cell was taken!");
- SetPlayerHoldingObject(playerid,1252,5);
- DB[playerid][holding]=1;
- return 1;
- }
- if(pickupid == item2)
- {
- DestroyPickup(pickupid);
- item2 = -1;
- SendClientMessageToAll(YELLOW," The second cell was taken!");
- SetPlayerHoldingObject(playerid,1252,5);
- DB[playerid][holding]=2;
- return 1;
- }
- if(pickupid == item3)
- {
- DestroyPickup(pickupid);
- item3 = -1;
- SendClientMessageToAll(YELLOW," The third cell was taken!");
- SetPlayerHoldingObject(playerid,1252,5);
- DB[playerid][holding]=3;
- return 1;
- }
- if(pickupid == item4)
- {
- DestroyPickup(pickupid);
- item4 = -1;
- SendClientMessageToAll(YELLOW," The fourth cell was taken!");
- SetPlayerHoldingObject(playerid,1252,5);
- DB[playerid][holding]=4;
- return 1;
- }
- return 1;
- }
- public Check()
- {
- ForEachPlayer(playerid)
- {
- if(DB[playerid][holding]!=0)
- {
- if(PlayerToPoint(2,playerid,268.6331,1891.3718,5.9139)) // first place
- {
- if(place1==1)
- {
- SendClientMessage(playerid,GREEN," * A cell is already placed here.");
- }
- else
- {
- place1=1;
- DB[playerid][holding]=0;
- StopPlayerHoldingObject(playerid);
- SendClientMessage(playerid,GREEN," * You placed a cell.");
- SetPlayerScore(playerid,GetPlayerScore(playerid)+50+random(10));
- if(place1==1 && place2==1 && place3==1 && place4==1) return LastItem(playerid);
- }
- }
- if(PlayerToPoint(2,playerid,268.7466,1876.6882,-3.4694)) // second place
- {
- if(place2==1)
- {
- SendClientMessage(playerid,GREEN," * A cell is already placed here.");
- }
- else
- {
- place2=1;
- DB[playerid][holding]=0;
- StopPlayerHoldingObject(playerid);
- SendClientMessage(playerid,GREEN," * You placed a cell.");
- SetPlayerScore(playerid,GetPlayerScore(playerid)+50+random(10));
- if(place1==1 && place2==1 && place3==1 && place4==1) return LastItem(playerid);
- }
- }
- if(PlayerToPoint(2,playerid,268.6223,1891.2946,-12.8596)) // third place
- {
- if(place3==1)
- {
- SendClientMessage(playerid,GREEN," * A cell is already placed here.");
- }
- else
- {
- place3=1;
- DB[playerid][holding]=0;
- StopPlayerHoldingObject(playerid);
- SendClientMessage(playerid,GREEN," * You placed a cell.");
- SetPlayerScore(playerid,GetPlayerScore(playerid)+50+random(10));
- if(place1==1 && place2==1 && place3==1 && place4==1) return LastItem(playerid);
- }
- }
- if(PlayerToPoint(2,playerid,269.0400,1876.5714,-22.2449)) // fourth place
- {
- if(place4==1)
- {
- SendClientMessage(playerid,GREEN," * A cell is already placed here.");
- }
- else
- {
- place4=1;
- DB[playerid][holding]=0;
- StopPlayerHoldingObject(playerid);
- SendClientMessage(playerid,GREEN," * You placed a cell.");
- SetPlayerScore(playerid,GetPlayerScore(playerid)+50+random(10));
- if(place1==1 && place2==1 && place3==1 && place4==1) return LastItem(playerid);
- }
- }
- }
- }
- return 1;
- }
- stock PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
- {
- if(IsPlayerConnected(playerid))
- {
- new Float:oldposx, Float:oldposy, Float:oldposz;
- new Float:tempposx, Float:tempposy, Float:tempposz;
- GetPlayerPos(playerid, oldposx, oldposy, oldposz);
- tempposx = (oldposx -x);
- tempposy = (oldposy -y);
- tempposz = (oldposz -z);
- if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
- {
- return 1;
- }
- }
- return 0;
- }
- stock LastItem(playerid)
- {
- new msg[128],name[24];
- GetPlayerName(playerid,name,24);
- SetPlayerScore(playerid,GetPlayerScore(playerid)+100+random(10));
- format(msg,128," *** %s Placed the last cell! Count Down started!! ***",name);
- SendClientMessageToAll(ORANGE,msg);
- SendClientMessageToAll(GREEN," * Objective : Jump on the rocked, and fly to the air!");
- timer = SetTimer("CountDown",1000,true);
- return 1;
- }
- public Restart()
- {
- SendClientMessageToAll(PURPLE," * Server is restarting in 5 seconds.");
- SendClientMessageToAll(PURPLE," * Server is restarting in 5 seconds.");
- SendClientMessageToAll(PURPLE," * Server is restarting in 5 seconds.");
- SetTimer("Restart1",5000,false);
- }
- public Restart1()
- {
- SendRconCommand("gmx");
- return 1;
- }
- public Launched()
- {
- MoveObject(rocket,268.78613281,1883.78320312,864.84967041,40.0);
- SetObjectRot(rocket,0.00000000,0.00000000,0.00000000);
- SendClientMessageToAll(GREEN," *** The rocked has launched!! *** ");
- SetTimer("IsOnRocket",5000,false);
- return 1;
- }
- public IsOnRocket()
- {
- ForEachPlayer(playerid)
- {
- new Float:Coo[3];
- GetPlayerPos(playerid,Coo[0],Coo[1],Coo[2]);
- if(Coo[2] > 100)
- {
- SendClientMessage(playerid,GREEN," * You made it on time! Congratz!");
- SetPlayerScore(playerid,GetPlayerScore(playerid)+30+random(10));
- }
- else
- {
- SendClientMessage(playerid,PURPLE," * You didn't make it on time!!");
- }
- }
- SendClientMessageToAll(YELLOW," * Check your score and get ready for a restart!");
- SetTimer("Restart",1000,false);
- }
- public CountDown()
- {
- if(!timeleft)
- {
- KillTimer(timer);
- Launched();
- }
- timeleft --;
- new msg[128];
- new minutess = timeleft / 60;
- new atsakimas = minutess * 60;
- new sekunde = timeleft - atsakimas;
- new valanda = minutess / 60;
- new atsakimas2 = valanda * 60;
- if (minutess > 60){ minutess = minutess - atsakimas2; }
- if(sekunde <= 9)
- {
- format(msg,sizeof(msg)," ~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~Rocket launches after~y~ %i:%i:0%i",valanda,minutess,sekunde);
- GameTextForAll(msg, 5000, 3);
- }else{
- format(msg,sizeof(msg)," ~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~Rocket launches after~y~ %i:%i:%i",valanda,minutess,sekunde);
- GameTextForAll(msg, 5000, 3);
- }
- }
- // Do NOT remove the credits.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement