Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <core>
- #include <float>
- #include "../include/gl_common.inc"
- #pragma tabsize 0
- #define TEAM_GROVE_COLOR 0x33AA33AA
- #define TEAM_AZTECA_COLOR 0x00FFFFFF
- #define TEAM_VAGOS_COLOR 0xFFFF22FF
- #define TEAM_COPS_COLOR 0x0000C4FF
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_GREEN 0x33AA33AA
- #define COLOR_RED 0xAA3333AA
- #define COLOR_YELLOW 0xFFFF00AA
- #define COLOR_WHITE 0xFFFFFFAA
- #define PocketMoney 1000 // Amount player recieves on spawn.
- #define INACTIVE_PLAYER_ID 255
- #define GIVECASH_DELAY 5000 // Time in ms between /givecash commands.
- #define NUMVALUES 4
- #define TEAM_GROVE 1
- #define TEAM_AZTECA 2
- #define TEAM_VAGOS 3
- #define TEAM_COPS 4
- forward MoneyGrubScoreUpdate();
- forward Givecashdelaytimer(playerid);
- forward SetPlayerRandomSpawn(playerid);
- forward SetupPlayerForClassSelection(playerid);
- forward GameModeExitFunc();
- forward SendPlayerFormattedText(playerid, const str[], define);
- forward public SendAllFormattedText(playerid, const str[], define);
- //----------------------------------------------------------------------
- new gTeam[MAX_PLAYERS];
- new total_vehicles_from_files=0;
- new gActivePlayers[MAX_PLAYERS];
- new gLastGaveCash[MAX_PLAYERS];
- new CashScoreOld;
- new iSpawnSet[MAX_PLAYERS];
- new Float:gGrovePlayerSpawns[9][4] = {
- {1751.1097,-2106.4529,13.5469,183.1979},
- {2652.6418,-1989.9175,13.9988,182.7107},
- {2689.5203,-1695.9354,10.0517,39.5312},
- {1654.7091,-1656.8516,22.5156,177.9729},
- {1299.1859,-801.4249,84.1406,269.5274},
- {842.5260,-1007.7679,28.4185,213.9953},
- {2495.0720,-1687.5278,13.5150,359.6696},
- {2807.9282,-1176.8883,25.3805,173.6018},
- {1219.0851,-1812.8058,16.5938,190.0045}
- };
- new Float:gAztecaPlayerSpawns[9][4] = {
- {-2723.4639,-314.8138,7.1839,43.5562},
- {-2694.5344,64.5550,4.3359,95.0190},
- {-2796.6589,219.5733,7.1875,88.8288},
- {-2764.9543,785.6434,52.7813,357.6817},
- {-1674.1964,430.3246,7.1797,226.1357},
- {-1983.3458,1117.0645,53.1243,271.2390},
- {-1427.0858,-288.9430,14.1484,137.0812},
- {-2173.0654,-392.7444,35.3359,237.0159},
- {-1867.5022,-141.9203,11.8984,22.4499}
- };
- new Float:gVagosPlayerSpawns[6][4] = {
- {2097.6855,2491.3313,14.8390,181.8117},
- {1893.1000,2423.2412,11.1782,269.4385},
- {1860.9672,1030.2910,10.8203,271.6988},
- {1673.2345,1316.1067,10.8203,177.7294},
- {2633.3203,2349.7061,10.6719,178.7175},
- {1435.8024,2662.3647,11.3926,1.1650}
- };
- new Float:gCopPlayerSpawns[3][4] = {
- {1568.2250,-1693.5483,5.8906,177.0983},
- {-1604.8442,732.9442,-5.2344,37.6041},
- {2343.4553,2455.5994,14.9688,96.5022}
- };
- //------------------------------------------------------------------------------------------------------
- main()
- {
- print("\n----------------------------------");
- print(" Running LVDMod ~MoneyGrub\n");
- print(" Modded By");
- print(" LuCiD");
- print("----------------------------------\n");
- }
- //------------------------------------------------------------------------------------------------------
- public OnPlayerRequestSpawn(playerid)
- {
- //printf("OnPlayerRequestSpawn(%d)",playerid);
- return 1;
- }
- //------------------------------------------------------------------------------------------------------
- public MoneyGrubScoreUpdate()
- {
- new CashScore;
- new name[MAX_PLAYER_NAME];
- //new string[256];
- for(new i=0; i<MAX_PLAYERS; i++)
- {
- if (IsPlayerConnected(i))
- {
- GetPlayerName(i, name, sizeof(name));
- CashScore = GetPlayerMoney(i);
- SetPlayerScore(i, CashScore);
- if (CashScore > CashScoreOld)
- {
- CashScoreOld = CashScore;
- //format(string, sizeof(string), "$$$ %s is now in the lead $$$", name);
- //SendClientMessageToAll(COLOR_YELLOW, string);
- }
- }
- }
- }
- //------------------------------------------------------------------------------------------------------
- /*public GrubModeReset()
- {
- for(new i=0; i<MAX_PLAYERS; i++)
- {
- if (IsPlayerConnected(i))
- {
- SetPlayerScore(i, PocketMoney);
- SetPlayerRandomSpawn(i, classid);
- }
- }
- }*/
- //------------------------------------------------------------------------------------------------------
- public OnPlayerConnect(playerid)
- {
- GameTextForPlayer(playerid,"~w~SA-MP: ~r~Las Venturas ~g~MoneyGrub",5000,5);
- SendPlayerFormattedText(playerid, "Welcome to Las Venturas MoneyGrub, For help type /help.", 0);
- gActivePlayers[playerid]++;
- gLastGaveCash[playerid] = GetTickCount();
- return 1;
- }
- //------------------------------------------------------------------------------------------------------
- public OnPlayerDisconnect(playerid)
- {
- gActivePlayers[playerid]--;
- }
- //------------------------------------------------------------------------------------------------------
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- new string[256];
- new playermoney;
- new sendername[MAX_PLAYER_NAME];
- new giveplayer[MAX_PLAYER_NAME];
- new cmd[256];
- new giveplayerid, moneys, idx;
- cmd = strtok(cmdtext, idx);
- if(strcmp(cmd, "/help", true) == 0) {
- SendPlayerFormattedText(playerid,"Las Venturas Deathmatch: Money Grub Coded By Jax and the SA-MP Team.",0);
- SendPlayerFormattedText(playerid,"Type: /objective : to find out what to do in this gamemode.",0);
- SendPlayerFormattedText(playerid,"Type: /givecash [playerid] [money-amount] to send money to other players.",0);
- SendPlayerFormattedText(playerid,"Type: /tips : to see some tips from the creator of the gamemode.", 0);
- return 1;
- }
- if(strcmp(cmd, "/objective", true) == 0) {
- SendPlayerFormattedText(playerid,"This gamemode is faily open, there's no specific win / endgame conditions to meet.",0);
- SendPlayerFormattedText(playerid,"In LVDM:Money Grub, when you kill a player, you will receive whatever money they have.",0);
- SendPlayerFormattedText(playerid,"Consequently, if you have lots of money, and you die, your killer gets your cash.",0);
- SendPlayerFormattedText(playerid,"However, you're not forced to kill players for money, you can always gamble in the", 0);
- SendPlayerFormattedText(playerid,"Casino's.", 0);
- return 1;
- }
- if(strcmp(cmd, "/tips", true) == 0) {
- SendPlayerFormattedText(playerid,"Spawning with just a desert eagle might sound lame, however the idea of this",0);
- SendPlayerFormattedText(playerid,"gamemode is to get some cash, get better guns, then go after whoever has the",0);
- SendPlayerFormattedText(playerid,"most cash. Once you've got the most cash, the idea is to stay alive(with the",0);
- SendPlayerFormattedText(playerid,"cash intact)until the game ends, simple right? But make sure to store money in a Bank.", 0);
- return 1;
- }
- if(strcmp(cmd, "/p", true) == 0) {
- GivePlayerWeapon(playerid, 46, 1);
- return 1;
- }
- if(strcmp(cmd, "/givecash", true) == 0) {
- new tmp[256];
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) {
- SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]");
- return 1;
- }
- giveplayerid = strval(tmp);
- tmp = strtok(cmdtext, idx);
- if(!strlen(tmp)) {
- SendClientMessage(playerid, COLOR_WHITE, "USAGE: /givecash [playerid] [amount]");
- return 1;
- }
- moneys = strval(tmp);
- //printf("givecash_command: %d %d",giveplayerid,moneys);
- if (IsPlayerConnected(giveplayerid)) {
- GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
- GetPlayerName(playerid, sendername, sizeof(sendername));
- playermoney = GetPlayerMoney(playerid);
- if (moneys > 0 && playermoney >= moneys) {
- GivePlayerMoney(playerid, (0 - moneys));
- GivePlayerMoney(giveplayerid, moneys);
- format(string, sizeof(string), "You have sent %s(player: %d), $%d.", giveplayer,giveplayerid, moneys);
- SendClientMessage(playerid, COLOR_YELLOW, string);
- format(string, sizeof(string), "You have recieved $%d from %s(player: %d).", moneys, sendername, playerid);
- SendClientMessage(giveplayerid, COLOR_YELLOW, string);
- printf("%s(playerid:%d) has transfered %d to %s(playerid:%d)",sendername, playerid, moneys, giveplayer, giveplayerid);
- }
- else {
- SendClientMessage(playerid, COLOR_YELLOW, "Invalid transaction amount.");
- }
- }
- else {
- format(string, sizeof(string), "%d is not an active player.", giveplayerid);
- SendClientMessage(playerid, COLOR_YELLOW, string);
- }
- return 1;
- }
- // PROCESS OTHER COMMANDS
- return 0;
- }
- //------------------------------------------------------------------------------------------------------
- public OnPlayerSpawn(playerid)
- {
- GivePlayerMoney(playerid, PocketMoney);
- SetPlayerInterior(playerid,0);
- SetPlayerRandomSpawn(playerid);
- TogglePlayerClock(playerid,1);
- return 1;
- }
- forward SetPlayerToTeamColor(playerid);
- public SetPlayerToTeamColor(playerid)
- {
- if (gTeam[playerid] == TEAM_GROVE) //|| GetPlayerTeam(playerid) == 1)
- {
- SetPlayerColor(playerid, TEAM_GROVE_COLOR);
- SetPlayerInterior(playerid,0);
- }
- else if (gTeam[playerid] == TEAM_AZTECA)
- {
- SetPlayerColor(playerid, TEAM_AZTECA_COLOR);
- SetPlayerInterior(playerid,0);
- }
- else if (gTeam[playerid] == TEAM_VAGOS)
- {
- SetPlayerColor(playerid, TEAM_VAGOS_COLOR);
- SetPlayerInterior(playerid,0);
- }
- else if (gTeam[playerid] == TEAM_COPS)
- {
- SetPlayerColor(playerid, TEAM_COPS_COLOR);
- SetPlayerInterior(playerid,0);
- }
- }
- //------------------------------------------------------------------------------
- public SetPlayerRandomSpawn(playerid)
- {
- if (iSpawnSet[playerid] == 1)
- {
- new rand = random(sizeof(gGrovePlayerSpawns));
- SetPlayerPos(playerid, gGrovePlayerSpawns[rand][0], gGrovePlayerSpawns[rand][1], gGrovePlayerSpawns[rand][2]); // Warp the player
- SetPlayerFacingAngle(playerid, 270.0);
- }
- else if (iSpawnSet[playerid] == 0)
- {
- new rand = random(sizeof(gAztecaPlayerSpawns));
- SetPlayerPos(playerid, gAztecaPlayerSpawns[rand][0], gAztecaSpawns[rand][1], gAztecePlayerSpawns[rand][2]); // Warp the player
- SetPlayerFacingAngle(playerid, 270.0);
- }
- else if (iSpawnSet[playerid] == 2)
- {
- new rand = random(sizeof(gVagoPlayerSpawns));
- SetPlayerPos(playerid, gVagoPlayerSpawns[rand][0], gVagoPlayerSpawns[rand][1], gVagoPlayerSpawns[rand][2]);
- SetPlayerFacingAngle(playerid, 270.0);
- }
- else if (iSpawnSet[playerid] == 3)
- {
- new rand = random(sizeof(gCopsPlayerSpawns));
- SetPlayerPos(playerid, gCopsPlayerSpawns[rand][0], gCopsPlayerSpawns[rand][1], gCopsPlayerSpawns[rand][2]);
- }
- return 1;
- }
- //------------------------------------------------------------------------------------------------------
- public OnPlayerDeath(playerid, killerid, reason)
- {
- new playercash;
- if(killerid == INVALID_PLAYER_ID) {
- SendDeathMessage(INVALID_PLAYER_ID,playerid,reason);
- ResetPlayerMoney(playerid);
- } else {
- SendDeathMessage(killerid,playerid,reason);
- SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
- playercash = GetPlayerMoney(playerid);
- if (playercash > 0) {
- GivePlayerMoney(killerid, playercash);
- ResetPlayerMoney(playerid);
- }
- else
- {
- }
- }
- return 1;
- }
- //------------------------------------------------------------------------------------------------------
- public OnPlayerRequestClass(playerid, classid)
- {
- iSpawnSet[playerid] = 0;
- SetupPlayerForClassSelection(playerid);
- return 1;
- }
- public SetupPlayerForClassSelection(playerid)
- {
- SetPlayerInterior(playerid,14);
- SetPlayerPos(playerid,258.4893,-41.4008,1002.0234);
- SetPlayerFacingAngle(playerid, 270.0);
- SetPlayerCameraPos(playerid,256.0815,-43.0475,1004.0234);
- SetPlayerCameraLookAt(playerid,258.4893,-41.4008,1002.0234);
- }
- public GameModeExitFunc()
- {
- GameModeExit();
- }
- public OnGameModeInit()
- {
- SetGameModeText("LVDMod ~LuCiD~");
- ShowPlayerMarkers(1);
- ShowNameTags(1);
- EnableStuntBonusForAll(0);
- DisableInteriorEnterExits();
- // Player Class's
- AddPlayerClass(266,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1);
- AddPlayerClass(267,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1);
- AddPlayerClass(280,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1);
- AddPlayerClass(281,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1);
- AddPlayerClass(282,1958.3783,1343.1572,15.3746,270.1425,0,0,24,300,-1,-1);
- AddPlayerClass(283,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
- AddPlayerClass(284,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
- AddPlayerClass(285,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
- AddPlayerClass(286,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
- AddPlayerClass(287,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
- AddPlayerClass(1,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
- AddPlayerClass(105,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
- AddPlayerClass(106,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
- AddPlayerClass(107,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
- AddPlayerClass(108,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
- AddPlayerClass(109,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
- AddPlayerClass(110,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
- AddPlayerClass(114,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
- AddPlayerClass(115,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
- AddPlayerClass(116,1958.3783,1343.1572,15.3746,269.1425,0,0,24,300,-1,-1);
- // Car Spawns
- // SPECIAL
- total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/trains.txt");
- total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/pilots.txt");
- // LAS VENTURAS
- total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/lv_law.txt");
- total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/lv_airport.txt");
- total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/lv_gen.txt");
- // SAN FIERRO
- total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/sf_law.txt");
- total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/sf_airport.txt");
- total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/sf_gen.txt");
- // LOS SANTOS
- total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_law.txt");
- total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_airport.txt");
- total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_gen_inner.txt");
- total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/ls_gen_outer.txt");
- // OTHER AREAS
- total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/whetstone.txt");
- total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/bone.txt");
- total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/flint.txt");
- total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/tierra.txt");
- total_vehicles_from_files += LoadStaticVehiclesFromFile("vehicles/red_county.txt");
- printf("Total vehicles from files: %d",total_vehicles_from_files);
- return 1;
- }
- public SendPlayerFormattedText(playerid, const str[], define)
- {
- new tmpbuf[256];
- format(tmpbuf, sizeof(tmpbuf), str, define);
- SendClientMessage(playerid, 0xFF004040, tmpbuf);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement