Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include "../include/gl_common.inc"
- #include <streamer>
- #include <YSI\y_ini>
- #define TEAM_GROVE 1
- #define TEAM_BALLAS 2
- #define TEAM_GROVE_COLOR 0x00FF00AA
- #define TEAM_BALLAS_COLOR 0xFF00FFAA
- #define DIALOG_CARSHOP 1
- #define DIALOG_JETPACKANDPARACHUTESHOP 2
- #define DIALOG_AIRCRAFTSHOP 3
- #define DIALOG_HEAVYWEAPONSSHOP 4
- #define DIALOG_NOTENOUGHMONEY 5
- #define DIALOG_RULES 6
- new total_vehicles_from_files=0;
- new gTeam[MAX_PLAYERS];
- new Checkpoint[4];
- new CarShopCar[MAX_PLAYERS];
- new AircraftShopVehicle[MAX_PLAYERS];
- new iniplayermoney, iniplayerscore;
- new rulesnotaccepted;
- main()
- {
- print("\n----------------------------------");
- print(" Grove vs Ballas by Sydcul");
- print("----------------------------------\n");
- }
- public OnGameModeInit()
- {
- SetGameModeText("Grove vs Ballas");
- AddPlayerClass(105, 2512.0581, -1672.3823, 13.4813, 66.2349, WEAPON_KNIFE, 1, WEAPON_COLT45, 0x7FFFFFFF, WEAPON_TEC9, 0x7FFFFFFF);
- AddPlayerClass(106, 2512.0581, -1672.3823, 13.4813, 66.2349, WEAPON_KNIFE, 1, WEAPON_COLT45, 0x7FFFFFFF, WEAPON_TEC9, 0x7FFFFFFF);
- AddPlayerClass(107, 2512.0581, -1672.3823, 13.4813, 66.2349, WEAPON_KNIFE, 1, WEAPON_COLT45, 0x7FFFFFFF, WEAPON_TEC9, 0x7FFFFFFF);
- AddPlayerClass(102, 2172.8787, -1672.7426, 15.0859, 286.4139, WEAPON_BAT, 1, WEAPON_COLT45, 0x7FFFFFFF, WEAPON_UZI, 0x7FFFFFFF);
- AddPlayerClass(103, 2172.8787, -1672.7426, 15.0859, 286.4139, WEAPON_BAT, 1, WEAPON_COLT45, 0x7FFFFFFF, WEAPON_UZI, 0x7FFFFFFF);
- AddPlayerClass(104, 2172.8787, -1672.7426, 15.0859, 286.4139, WEAPON_BAT, 1, WEAPON_COLT45, 0x7FFFFFFF, WEAPON_UZI, 0x7FFFFFFF);
- total_vehicles_from_files += LoadStaticVehiclesFromFile("tdm/vehicles.txt");
- return 1;
- }
- public OnGameModeExit() {
- for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
- {
- new playername[MAX_PLAYER_NAME+1], filename[16+MAX_PLAYER_NAME];
- GetPlayerName(playerid, playername, sizeof(playername));
- format(filename, sizeof(filename), "tdm/players/%s.ini", playername);
- new INI:iniFile = INI_Open(filename);
- INI_SetTag(iniFile, "playerdata");
- INI_WriteInt(iniFile, "money", GetPlayerMoney(playerid));
- INI_WriteInt(iniFile, "score", GetPlayerScore(playerid));
- INI_Close(iniFile);
- }
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerPos(playerid, 2121.7322, -1623.2563, 26.8368);
- SetPlayerFacingAngle(playerid, 60.2360);
- SetPlayerCameraPos(playerid, 2111.9089 ,-1623.7340, 24.2307);
- SetPlayerCameraLookAt(playerid, 2121.7322, -1623.2563, 26.8368);
- switch(classid)
- {
- case 0,1,2:
- {
- GameTextForPlayer(playerid, "~g~GROVE~w~", 3000, 5);
- gTeam[playerid] = TEAM_GROVE;
- }
- case 3,4,5:
- {
- GameTextForPlayer(playerid, "~b~BALLAS~w~", 3000, 5);
- gTeam[playerid] = TEAM_BALLAS;
- }
- }
- return 1;
- }
- SetPlayerToTeamColor(playerid)
- {
- if (gTeam[playerid] == TEAM_GROVE)
- {
- SetPlayerColor(playerid, TEAM_GROVE_COLOR);
- }
- else if (gTeam[playerid] == TEAM_BALLAS)
- {
- SetPlayerColor(playerid, TEAM_BALLAS_COLOR);
- }
- }
- forward ini_playerdata(name[], value[]);
- public ini_playerdata(name[], value[])
- {
- INI_Int("money", iniplayermoney);
- INI_Int("score", iniplayerscore);
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- new playername[MAX_PLAYER_NAME+1], filename[16+MAX_PLAYER_NAME];
- rulesnotaccepted = 0;
- GetPlayerName(playerid, playername, sizeof(playername));
- format(filename, sizeof(filename), "tdm/players/%s.ini", playername);
- if(!fexist(filename))
- {
- ShowPlayerDialog(playerid, DIALOG_RULES, DIALOG_STYLE_MSGBOX, "Welcome!", "Welcome to Grove vs Ballas TDM!\nYou can do pretty much everything you want here, but there are some rules!\n\n1. No cheating/hacking\n2. No spawnkilling/trolling\n3. Behave like a normal human being and use your brains!\n\nDo you accept these rules?", "No", "Yes");
- } else {
- INI_ParseFile(filename, "ini_%s");
- CarShopCar[playerid] = -1;
- AircraftShopVehicle[playerid] = -1;
- SendDeathMessage(INVALID_PLAYER_ID, playerid, 200);
- GivePlayerMoney(playerid, iniplayermoney);
- SetPlayerScore(playerid, iniplayerscore);
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- if (rulesnotaccepted==0) {
- new playername[MAX_PLAYER_NAME+1], filename[16+MAX_PLAYER_NAME];
- GetPlayerName(playerid, playername, sizeof(playername));
- format(filename, sizeof(filename), "tdm/players/%s.ini", playername);
- new INI:iniFile = INI_Open(filename);
- INI_SetTag(iniFile, "playerdata");
- INI_WriteInt(iniFile, "money", GetPlayerMoney(playerid));
- INI_WriteInt(iniFile, "score", GetPlayerScore(playerid));
- INI_Close(iniFile);
- }
- SendDeathMessage(INVALID_PLAYER_ID, playerid, 201);
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- SetPlayerToTeamColor(playerid);
- Checkpoint[0] = CreateDynamicCP(1772.1460,-1929.1642,13.5534, 2, -1, -1, -1, 100); //Car shop
- SetPlayerMapIcon(playerid, 0, 1772.1460,-1929.1642,13.5534, 55, 0, MAPICON_GLOBAL);
- Checkpoint[1] = CreateDynamicCP(1954.6067,-2188.5210,13.5469, 2, -1, -1, -1, 100); //Jetpack and parachute shop
- SetPlayerMapIcon(playerid, 1, 1954.6067,-2188.5210,13.5469, 5, 0, MAPICON_GLOBAL);
- Checkpoint[2] = CreateDynamicCP(1683.3267,-2638.3318,13.5469, 2, -1, -1, -1, 100); //Aircraft shop
- SetPlayerMapIcon(playerid, 2, 1683.3267,-2638.3318,13.5469, 5, 0, MAPICON_GLOBAL);
- Checkpoint[3] = CreateDynamicCP(2444.6648,-1975.5310,13.5469, 2, -1, -1, -1, 100); //Heavy weapons shop
- SetPlayerMapIcon(playerid, 3, 2444.6648,-1975.5310,13.5469, 18, 0, MAPICON_GLOBAL);
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(killerid == INVALID_PLAYER_ID) {
- SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
- GivePlayerMoney(playerid, -100);
- SetPlayerScore(playerid,GetPlayerScore(playerid)-1);
- } else if(gTeam[killerid] == gTeam[playerid]) {
- SetPlayerScore(killerid,GetPlayerScore(killerid)-2);
- GivePlayerMoney(killerid, -50);
- SendDeathMessage(killerid,playerid,reason);
- } else {
- GivePlayerMoney(playerid, -100);
- SetPlayerScore(playerid,GetPlayerScore(playerid)-1);
- SendDeathMessage(killerid,playerid,reason);
- SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
- GivePlayerMoney(killerid, 100);
- }
- return 1;
- }
- public OnPlayerEnterDynamicCP(playerid, checkpointid)
- {
- if(checkpointid == Checkpoint[0]) //Car shop
- {
- if (!IsPlayerInAnyVehicle(playerid)) {
- ShowPlayerDialog(playerid, DIALOG_CARSHOP, DIALOG_STYLE_LIST, "Car shop", "Infernus ($250)\nTurismo ($350)", "Buy", "Cancel");
- } else {
- SendClientMessage(playerid, 0xFF0000AA, "You must be on foot to use this shop!");
- }
- }
- if(checkpointid == Checkpoint[1]) //Jetpack and parachute shop
- {
- if (!IsPlayerInAnyVehicle(playerid)) {
- ShowPlayerDialog(playerid, DIALOG_JETPACKANDPARACHUTESHOP, DIALOG_STYLE_LIST, "Jetpack and parachute shop", "Jetpack ($300)\nParachute ($50)", "Buy", "Cancel");
- } else {
- SendClientMessage(playerid, 0xFF0000AA, "You must be on foot to use this shop!");
- }
- }
- if(checkpointid == Checkpoint[2]) //Aircraft shop
- {
- if (!IsPlayerInAnyVehicle(playerid)) {
- ShowPlayerDialog(playerid, DIALOG_AIRCRAFTSHOP, DIALOG_STYLE_LIST, "Aircraft shop", "Hydra ($500)\nHunter ($600)", "Buy", "Cancel");
- } else {
- SendClientMessage(playerid, 0xFF0000AA, "You must be on foot to use this shop!");
- }
- }
- if(checkpointid == Checkpoint[3]) //Heavy weapons shop
- {
- if (!IsPlayerInAnyVehicle(playerid)) {
- ShowPlayerDialog(playerid, DIALOG_HEAVYWEAPONSSHOP, DIALOG_STYLE_LIST, "Heavy weapons shop", "Minigun ($800)\nRPG ($400)\nFlamethrower ($200)", "Buy", "Cancel");
- } else {
- SendClientMessage(playerid, 0xFF0000AA, "You must be on foot to use this shop!");
- }
- }
- return 1;
- }
- public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
- {
- if(dialogid == DIALOG_CARSHOP)
- {
- if(response)
- {
- if(listitem == 0)
- {
- new playermoney;
- playermoney = GetPlayerMoney(playerid);
- if (playermoney >= 250) {
- if (CarShopCar[playerid] != -1) {
- DestroyVehicle(CarShopCar[playerid]);
- CarShopCar[playerid] = -1;
- }
- CarShopCar[playerid] = CreateVehicle(411,1776.6417,-1929.3938,13.1665,0.6010,-1,-1,-1);
- GivePlayerMoney(playerid, -250);
- } else {
- ShowPlayerDialog(playerid, DIALOG_NOTENOUGHMONEY, DIALOG_STYLE_MSGBOX, "Notice", "You don't have enough money to but this item!", "Close", "");
- }
- }
- if(listitem == 1)
- {
- new playermoney;
- playermoney = GetPlayerMoney(playerid);
- if (playermoney >= 350) {
- if (CarShopCar[playerid] != -1) {
- DestroyVehicle(CarShopCar[playerid]);
- CarShopCar[playerid] = -1;
- }
- CarShopCar[playerid] = CreateVehicle(451,1776.6417,-1929.3938,13.1665,0.6010,-1,-1,-1);
- GivePlayerMoney(playerid, -350);
- } else {
- ShowPlayerDialog(playerid, DIALOG_NOTENOUGHMONEY, DIALOG_STYLE_MSGBOX, "Notice", "You don't have enough money to but this item!", "Close", "");
- }
- }
- }
- return 1;
- }
- if(dialogid == DIALOG_JETPACKANDPARACHUTESHOP)
- {
- if(response)
- {
- if(listitem == 0)
- {
- new playermoney;
- playermoney = GetPlayerMoney(playerid);
- if (playermoney >= 300) {
- SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USEJETPACK);
- GivePlayerMoney(playerid, -300);
- } else {
- ShowPlayerDialog(playerid, DIALOG_NOTENOUGHMONEY, DIALOG_STYLE_MSGBOX, "Notice", "You don't have enough money to but this item!", "Close", "");
- }
- }
- if(listitem == 1)
- {
- new playermoney;
- playermoney = GetPlayerMoney(playerid);
- if (playermoney >= 50) {
- GivePlayerWeapon(playerid, 46, 1);
- GivePlayerMoney(playerid, -50);
- } else {
- ShowPlayerDialog(playerid, DIALOG_NOTENOUGHMONEY, DIALOG_STYLE_MSGBOX, "Notice", "You don't have enough money to but this item!", "Close", "");
- }
- }
- }
- return 1;
- }
- if(dialogid == DIALOG_AIRCRAFTSHOP)
- {
- if(response)
- {
- if(listitem == 0)
- {
- new playermoney;
- playermoney = GetPlayerMoney(playerid);
- if (playermoney >= 500) {
- if (AircraftShopVehicle[playerid] != -1) {
- DestroyVehicle(AircraftShopVehicle[playerid]);
- AircraftShopVehicle[playerid] = -1;
- }
- AircraftShopVehicle[playerid] = CreateVehicle(520,1681.7134,-2612.5090,14.2579,2.3501,-1,-1,-1);
- GivePlayerMoney(playerid, -500);
- } else {
- ShowPlayerDialog(playerid, DIALOG_NOTENOUGHMONEY, DIALOG_STYLE_MSGBOX, "Notice", "You don't have enough money to but this item!", "Close", "");
- }
- }
- if(listitem == 1)
- {
- new playermoney;
- playermoney = GetPlayerMoney(playerid);
- if (playermoney >= 600) {
- if (AircraftShopVehicle[playerid] != -1) {
- DestroyVehicle(AircraftShopVehicle[playerid]);
- AircraftShopVehicle[playerid] = -1;
- }
- AircraftShopVehicle[playerid] = CreateVehicle(425,1681.7134,-2612.5090,14.2579,2.3501,-1,-1,-1);
- GivePlayerMoney(playerid, -600);
- } else {
- ShowPlayerDialog(playerid, DIALOG_NOTENOUGHMONEY, DIALOG_STYLE_MSGBOX, "Notice", "You don't have enough money to but this item!", "Close", "");
- }
- }
- return 1;
- }
- }
- if(dialogid == DIALOG_HEAVYWEAPONSSHOP)
- {
- if(response)
- {
- if(listitem == 0)
- {
- new playermoney;
- playermoney = GetPlayerMoney(playerid);
- if (playermoney >= 50) {
- GivePlayerWeapon(playerid, 38, 150);
- GivePlayerMoney(playerid, -50);
- } else {
- ShowPlayerDialog(playerid, DIALOG_NOTENOUGHMONEY, DIALOG_STYLE_MSGBOX, "Notice", "You don't have enough money to but this item!", "Close", "");
- }
- }
- if(listitem == 1)
- {
- new playermoney;
- playermoney = GetPlayerMoney(playerid);
- if (playermoney >= 50) {
- GivePlayerWeapon(playerid, 35, 10);
- GivePlayerMoney(playerid, -50);
- } else {
- ShowPlayerDialog(playerid, DIALOG_NOTENOUGHMONEY, DIALOG_STYLE_MSGBOX, "Notice", "You don't have enough money to but this item!", "Close", "");
- }
- }
- if(listitem == 2)
- {
- new playermoney;
- playermoney = GetPlayerMoney(playerid);
- if (playermoney >= 50) {
- GivePlayerWeapon(playerid, 37, 150);
- GivePlayerMoney(playerid, -50);
- } else {
- ShowPlayerDialog(playerid, DIALOG_NOTENOUGHMONEY, DIALOG_STYLE_MSGBOX, "Notice", "You don't have enough money to but this item!", "Close", "");
- }
- }
- }
- return 1;
- }
- if(dialogid == DIALOG_RULES)
- {
- if(response)
- {
- rulesnotaccepted = 1;
- SendClientMessage(playerid, 0xFF0000AA, "You must read and accept the rules to play on Grove vs Ballas!");
- Kick(playerid);
- }
- return 1;
- }
- return 0;
- }
- public OnVehicleDeath(vehicleid, killerid)
- {
- for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
- {
- if (vehicleid == CarShopCar[playerid]) {
- DestroyVehicle(CarShopCar[playerid]);
- CarShopCar[playerid] = -1;
- }
- if (vehicleid == AircraftShopVehicle[playerid]) {
- DestroyVehicle(AircraftShopVehicle[playerid]);
- AircraftShopVehicle[playerid] = -1;
- }
- }
- return 1;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/suicide", cmdtext, true, 8) == 0)
- {
- SetPlayerHealth(playerid, 0);
- return 1;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment