Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- #include <sscanf2>
- #include <foreach>
- //Redefine SAMP variables //
- #undef MAX_PLAYERS
- #define MAX_PLAYERS 50
- #undef MAX_VEHICLES
- #define MAX_VEHICLES 2000 // SA-MP limit as of 0.3x is 2000.
- //Teams//
- #define TEAM_CIV 0
- #define TEAM_COP 1
- #define TEAM_SOLD 2
- /*--[Colors]--*/
- #define COLOR_YELLOW 0xE4FF33AA
- #define COLOR_WHITE 0xFFFFFFFF
- #define COLOR_COP 0x0059FFFF
- #define COLOR_SOLDIER 0x2D9402FF
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_RED 0xFF0000AA
- #include <zcmd>
- #include <foreach>
- /*#include <a_mysql>
- #include <sscanf2>
- #include <DiniSarp>
- #include <a_http>
- #include <streamer>
- #include <yom_buttons>
- #include <zones>*/ //includes i havent used yet
- new str[3000];
- new Text3D:civpickup, Text3D:coppickup, Text3D:solderpickup;
- main()
- {
- }
- /*new GPSOn[MAX_PLAYERS];
- forward DefineGPS(playerid);
- DefineGPS(playerid)
- {
- GPSOn[playerid] = 0;
- }*/
- enum pInfo
- {
- pFaction,
- pGPS
- }
- new PlayerInfo[MAX_PLAYERS][pInfo];
- public OnGameModeInit()
- {
- #pragma unused civpickup, coppickup, solderpickup
- SetGameModeText("Day"); //gamemode
- // Add Player Classes
- AddPlayerClass(299, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
- AddPlayerClass(265, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
- AddPlayerClass(287, 1958.3783, 1343.1572, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
- //Add Vehicles
- AddStaticVehicle(425, -1454.3373,501.5115,18.2650,269.0268,43,0); //hunter for soldier spawn
- AddStaticVehicle(426, 1986.5759,150.8554,27.3533,179.8385,171,152); //car for civ spawn
- AddStaticVehicle(597, -1572.8947,730.6797,-5.2422,88.6973,0,1); //car for cop spawn
- /*--[Spawn Icons]--*/
- format(str, sizeof(str), "--------\nCivilian Spawn\nThere are {FF6060}NULL{FFFFFF} Civilians\n--------");
- civpickup = Create3DTextLabel(str, COLOR_WHITE, -1969.2399, 120.1662, 27.6875, 30, 0);
- format(str, sizeof(str), "--------\nCop Spawn\nThere are {FF6060}NULL{0059FF} Cops\n--------");
- coppickup = Create3DTextLabel(str, COLOR_COP, -1588.1664, 719.0873, -5.2422, 30, 0);
- format(str, sizeof(str), "--------\nSoldier Spawn\nThere are {2D9402}NULL{2D9402} Soldier\n--------");
- solderpickup = Create3DTextLabel(str, COLOR_SOLDIER, -1395.9022, 499.5081, 18.2344, 30, 0);
- /*----------------*/
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SetPlayerPos(playerid, -1753.6973,884.7565,295.8750);
- SetPlayerFacingAngle(playerid, 177.3350);
- SetPlayerCameraPos(playerid, -1753.5608,874.4424,300.7809);
- SetPlayerCameraLookAt(playerid, -1753.6973,884.7565,295.8750);
- switch(classid)
- {
- case TEAM_CIV:
- GameTextForPlayer(playerid,"~w~Civilian", 20000, 3);
- case TEAM_COP:
- GameTextForPlayer(playerid,"~b~Cop", 20000, 3);
- case TEAM_SOLD:
- GameTextForPlayer(playerid,"~g~Soldier", 20000, 3);
- }
- PlayerInfo[playerid][pFaction] = classid;
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- format(str, sizeof(str), "[Connection]: %s has joined the server, there are now %d players.", PlayerName(playerid), GetPlayerCount());
- SendClientMessageToAll(COLOR_YELLOW, str);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- new str2[16];
- switch(reason)
- {
- case 0:
- str2 = "Timeout";
- case 1:
- str2 = "Quit";
- case 2:
- str2 = "Kick";
- }
- format(str, sizeof(str), "[%s]: %s has disconnected from the server, there are now %d players.", str2, PlayerName(playerid), GetPlayerCount());
- SendClientMessageToAll(COLOR_YELLOW, str);
- }
- public OnPlayerSpawn(playerid)
- {
- if(IsPlayerConnected(playerid))
- {
- format(str, sizeof(str), "[Team]: %s has spawned as a %s", PlayerName(playerid), GetPlayerFaction(playerid));
- SendClientMessageToAll(COLOR_YELLOW, str);
- switch(PlayerInfo[playerid][pFaction])
- {
- case 0://Civilian
- {
- SetPlayerPos(playerid, -1968.5970,110.6172,27.6875);
- SetPlayerFacingAngle(playerid, 355.38);
- }
- case 1://Cop
- {
- SetPlayerPos(playerid, -1593.7192,716.2565,-5.2422);
- SetPlayerFacingAngle(playerid, 263.62);
- }
- case 2://Army
- {
- SetPlayerPos(playerid, -1390.5062,497.4170,18.2344);
- SetPlayerFacingAngle(playerid, 25.53);
- }
- default://In case of errors
- {
- SetPlayerPos(playerid, -1968.5970,110.6172,27.6875);
- SetPlayerFacingAngle(playerid, 355.38);
- }
- }
- SetCameraBehindPlayer(playerid);
- UpdateTeamText();
- }
- return 1;
- }
- forward GetPlayerCount();
- public GetPlayerCount()
- {
- new PlayerCount;
- foreach(Player, i)
- {
- if(IsPlayerConnected(i))
- {
- PlayerCount ++;
- }
- }
- return PlayerCount;
- }
- forward GetPlayerFaction(playerid);
- GetPlayerFaction(playerid)
- {
- new PlayerFaction[32];
- switch(PlayerInfo[playerid][pFaction])
- {
- case TEAM_CIV:
- PlayerFaction = "Civilian";
- case TEAM_COP:
- PlayerFaction = "Cop";
- case TEAM_SOLD:
- PlayerFaction = "Soldier";
- default:
- PlayerFaction = "Error";
- }
- return PlayerFaction;
- }
- forward PlayerName(playerid);
- PlayerName(playerid)
- {
- new PlayerNamee[MAX_PLAYER_NAME];
- if(IsPlayerConnected(playerid))
- {
- GetPlayerName(playerid, PlayerNamee, sizeof(PlayerNamee));
- }
- return PlayerNamee;
- }
- forward UpdateTeamText();
- UpdateTeamText()
- {
- new team;
- /*--[Spawn Icons]--*/
- team = 0;
- format(str, sizeof(str), "--------\nCivilian Spawn\nThere are {FF6060}%d{FFFFFF} Civilians\n--------", GetTeamCount(team));
- Update3DTextLabelText(civpickup, COLOR_WHITE, str);
- team = 1;
- format(str, sizeof(str), "--------\nCop Spawn\nThere are {FF6060}%d{0059FF} Cops\n--------", GetTeamCount(team));
- Update3DTextLabelText(coppickup, COLOR_COP, str);
- team = 2;
- format(str, sizeof(str), "--------\nSoldier Spawn\nThere are {FF6060}%d{2D9402} Soldier\n--------", GetTeamCount(team));
- Update3DTextLabelText(solderpickup, COLOR_SOLDIER, str);
- /*----------------*/
- }
- forward GetTeamCount(team);
- GetTeamCount(team)
- {
- new count;
- switch(team)
- {
- case 0://Civilians
- {
- foreach(Player, i)
- {
- if(IsPlayerConnected(i))
- {
- if(PlayerInfo[i][pFaction] == 0) count ++;
- }
- }
- }
- case 1://Cop
- {
- foreach(Player, i)
- {
- if(IsPlayerConnected(i))
- {
- if(PlayerInfo[i][pFaction] == 1) count ++;
- }
- }
- }
- case 2://Soldier
- {
- foreach(Player, i)
- {
- if(IsPlayerConnected(i))
- {
- if(PlayerInfo[i][pFaction] == 2) count ++;
- }
- }
- }
- }
- return count;
- }
- CMD:goto(playerid, params[])
- {
- new tmp[10];
- if(!IsPlayerConnected(playerid)) return 1;
- if(sscanf(params, "s[10]", tmp)) return SendClientMessage(playerid, COLOR_WHITE, "Usage: /goto (civ, cop, soldier)");
- if(!strcmp(tmp, "civ"))//goto civ
- {
- SendClientMessage(playerid, COLOR_WHITE, "[Teleport]: You have been teleported to the civilian spawn.");
- SetPlayerPos(playerid, -1968.5970,110.6172,27.6875);
- SetPlayerFacingAngle(playerid, 355.38);
- SetCameraBehindPlayer(playerid);
- }
- else if(!strcmp(tmp, "cop"))//goto cop
- {
- SendClientMessage(playerid, COLOR_COP, "[Teleport]: You have been teleported to the cop spawn.");
- SetPlayerPos(playerid, -1593.7192,716.2565,-5.2422);
- SetPlayerFacingAngle(playerid, 263.62);
- SetCameraBehindPlayer(playerid);
- }
- else if(!strcmp(tmp, "soldier"))//goto cop
- {
- SendClientMessage(playerid, COLOR_SOLDIER, "[Teleport]: You have been teleported to the soldier spawn.");
- SetPlayerPos(playerid, -1390.5062,497.4170,18.2344);
- SetPlayerFacingAngle(playerid, 25.53);
- SetCameraBehindPlayer(playerid);
- }
- return 1;
- }
- CMD:myclassid(playerid)
- {
- new strid[100];
- format(strid, 100, "Team ID: %s", GetPlayerFaction(playerid));
- SendClientMessage(playerid, COLOR_GREY, strid);
- return 1;
- }
- CMD:gps(playerid)
- {
- SendClientMessage(playerid, COLOR_GREY, GetPlayerFaction(playerid)); //temp to check where class is being changed
- if(!IsPlayerConnected(playerid)) return 1;
- if(PlayerInfo[playerid][pGPS])
- {
- PlayerInfo[playerid][pGPS] = 0;
- PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
- SendClientMessage(playerid, COLOR_RED, "GPS disabled.");
- foreach(Player, i)
- {
- new player1[128], player2[64];
- player1 = GetPlayerFaction(playerid);
- player2 = GetPlayerFaction(i);
- if(!strcmp(player1, "Civilian") && !strcmp(player2, "Civilian"))
- {
- SetPlayerMarkerForPlayer(playerid, i, COLOR_WHITE);
- return 1;
- }
- if(!strcmp(player1, "Cop") && !strcmp(player2, "Cop"))
- {
- SetPlayerMarkerForPlayer(playerid, i, COLOR_COP);
- return 1;
- }
- if(!strcmp(player1, "Soldier") && !strcmp(player2, "Soldier"))
- {
- SetPlayerMarkerForPlayer(playerid, i, COLOR_SOLDIER);
- return 1;
- }
- }
- return 1;
- }
- else
- {
- PlayerInfo[playerid][pGPS] = 1;
- SendClientMessage(playerid, COLOR_GREY, GetPlayerFaction(playerid)); //temp to check where class is being changed
- PlayerPlaySound(playerid, 1058, 0.0, 0.0, 0.0);
- foreach(Player, i)
- {
- new player1[128], player2[64];
- player1 = GetPlayerFaction(playerid);
- player2 = GetPlayerFaction(i);
- if(!strcmp(player1, "Civilian") && !strcmp(player2, "Civilian"))
- {
- SendClientMessage(playerid, COLOR_WHITE, "GPS enabled, your team can now see your location.");
- SetPlayerMarkerForPlayer(playerid, i, COLOR_WHITE);
- return 1;
- }
- if(!strcmp(player1, "Cop") && !strcmp(player2, "Cop"))
- {
- SendClientMessage(playerid, COLOR_GREY, GetPlayerFaction(playerid)); //temp to check where class is being changed
- SendClientMessage(playerid, COLOR_COP, "GPS enabled, your team can now see your location.");
- SetPlayerMarkerForPlayer(playerid, i, COLOR_COP);
- return 1;
- }
- if(!strcmp(player1, "Soldier") && !strcmp(player2, "Soldier"))
- {
- SendClientMessage(playerid, COLOR_SOLDIER, "GPS enabled, your team can now see your location.");
- SetPlayerMarkerForPlayer(playerid, i, COLOR_SOLDIER);
- return 1;
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement