Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define ROUND_MINUTES 10
- #define TEAM_GROVE_COLOR 0x00FF00AA
- #define TEAM_BALLA_COLOR 0xFF00FFAA
- new Text:Timeleft;
- new Text:CurrentMap;
- new timeleft = ROUND_MINUTES;
- new roundtimer;
- new seconds=0;
- new MAP = 0;
- new maptimer;
- new SPAWNED[MAX_PLAYERS];
- new Float:HEALTH[MAX_PLAYERS];
- new ALLOWCHAT[MAX_PLAYERS];
- new CHECKSPAM[MAX_PLAYERS];
- forward Second();
- forward ChangeMap();
- forward FloodCheck(playerid);
- main()
- {
- print("\n------------------------------------------");
- print("Grove Street vs Ballas by Remba031 loaded.");
- print("------------------------------------------\n");
- }
- public OnGameModeInit()
- {
- roundtimer = SetTimer("Second",1000,true);
- DisableInteriorEnterExits();
- UsePlayerPedAnims();
- SetGameModeText("TDM");
- SendRconCommand("mapname RC Battlefield");
- ShowPlayerMarkers(PLAYER_MARKERS_MODE_OFF);
- AddPlayerClass(105,-1132.0251,1041.6741,1345.7401,271.0460,31,500,24,200,0,0); // G
- AddPlayerClass(106,-1132.0251,1041.6741,1345.7401,271.0460,31,500,24,200,0,0); // G
- AddPlayerClass(107,-1132.0251,1041.6741,1345.7401,271.0460,31,500,24,200,0,0); // G
- AddPlayerClass(102,-973.3190,1077.4526,1344.9951,90.9010,31,500,24,200,0,0); // B
- AddPlayerClass(103,-973.3190,1077.4526,1344.9951,90.9010,31,500,24,200,0,0); // B
- AddPlayerClass(104,-973.3190,1077.4526,1344.9951,90.9010,31,500,24,200,0,0); // B
- Timeleft = TextDrawCreate(550.0,100.0,"00:00");
- TextDrawFont(Timeleft,2);
- TextDrawUseBox(Timeleft,1);
- TextDrawBoxColor(Timeleft,0x000000AA);
- TextDrawTextSize(Timeleft,1.0,60.0);
- TextDrawAlignment(Timeleft,2);
- CurrentMap = TextDrawCreate(550.0,80.0,"RC Battlefield");
- TextDrawFont(CurrentMap,2);
- TextDrawUseBox(CurrentMap,1);
- TextDrawBoxColor(CurrentMap,0x000000FF);
- TextDrawTextSize(CurrentMap,1.0,110.0);
- TextDrawAlignment(CurrentMap,2);
- TextDrawLetterSize(CurrentMap,0.25,1.75);
- return 1;
- }
- public OnGameModeExit()
- {
- print("\n-------------------------------------------");
- print("Grove Street vs Ballas by Remba031 unloaded.");
- print("-------------------------------------------\n");
- return 1;
- }
- public OnPlayerRequestClass(playerid, classid)
- {
- SPAWNED[playerid] = 0;
- TextDrawShowForPlayer(playerid,Timeleft);
- TextDrawShowForPlayer(playerid,CurrentMap);
- SetPlayerInterior(playerid,1);
- SetPlayerPos(playerid,292.9160,-30.6521,1001.5156);
- SetPlayerCameraPos(playerid,293.1492,-37.2610,1001.5156);
- SetPlayerCameraLookAt(playerid,292.9160,-30.6521,1001.5156);
- SetPlayerFacingAngle(playerid,177.3484);
- switch(classid)
- {
- case 0,1,2:
- {
- SetPlayerTeam(playerid,1);
- GameTextForPlayer(playerid,"~g~GROVE STREET",3000,4);
- SetPlayerColor(playerid,TEAM_GROVE_COLOR);
- }
- case 3,4,5:
- {
- SetPlayerTeam(playerid,2);
- GameTextForPlayer(playerid,"~p~BALLAS",3000,4);
- SetPlayerColor(playerid,TEAM_BALLA_COLOR);
- }
- }
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- SetPlayerColor(playerid,-1);
- SPAWNED[playerid] = 0;
- ALLOWCHAT[playerid] = 1;
- CHECKSPAM[playerid] = 0;
- SetTimerEx("FloodCheck",3000,true,"i",playerid);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- SetPlayerColor(playerid,-1);
- SPAWNED[playerid] = 0;
- ALLOWCHAT[playerid] = 1;
- CHECKSPAM[playerid] = 0;
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- if(MAP == 0) // Default map(RC Battlefield)
- {
- SetPlayerInterior(playerid,10);
- }
- else if(MAP == 1) // Jefferson Motel
- {
- SetPlayerInterior(playerid,15);
- if(GetPlayerTeam(playerid) == 1)
- {
- SetPlayerPos(playerid,2217.5869,-1151.1071,1025.7969);
- SetPlayerFacingAngle(playerid,272.2993);
- }
- else if(GetPlayerTeam(playerid) == 2)
- {
- SetPlayerPos(playerid,2195.3025,-1143.9893,1029.7969);
- SetPlayerFacingAngle(playerid,181.1184);
- }
- }
- else if(MAP == 2) //Liberty City
- {
- SetPlayerInterior(playerid,1);
- if(GetPlayerTeam(playerid) == 1)
- {
- SetPlayerPos(playerid,-795.0522,495.1387,1376.1953);
- SetPlayerFacingAngle(playerid,356.2731);
- }
- else if(GetPlayerTeam(playerid) == 2)
- {
- SetPlayerPos(playerid,-830.9671,515.4208,1357.6854);
- SetPlayerFacingAngle(playerid,182.6851);
- }
- }
- else if(MAP == 3) //Pleasure Domes
- {
- SetPlayerInterior(playerid,3);
- if(GetPlayerTeam(playerid) == 1)
- {
- SetPlayerPos(playerid,-2647.0217,1423.9025,906.4609);
- SetPlayerFacingAngle(playerid,127.1440);
- }
- else if(GetPlayerTeam(playerid) == 2)
- {
- SetPlayerPos(playerid,-2667.2332,1426.8282,906.4609);
- SetPlayerFacingAngle(playerid,179.7845);
- }
- }
- else if(MAP == 4) // Planning Department
- {
- SetPlayerInterior(playerid,3);
- if(GetPlayerTeam(playerid) == 1)
- {
- SetPlayerPos(playerid,349.0134,163.6172,1025.7891);
- SetPlayerFacingAngle(playerid,271.4312);
- }
- else if(GetPlayerTeam(playerid) == 2)
- {
- SetPlayerPos(playerid,-372.1458,180.4995,1008.3828);
- SetPlayerFacingAngle(playerid,179.8669);
- }
- }
- SetPlayerHP(playerid,100.0);
- SPAWNED[playerid] = 1;
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(killerid != INVALID_PLAYER_ID) // Valid kill
- {
- SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
- SetPlayerScore(playerid,GetPlayerScore(playerid)-1);
- if(reason == 34)
- {
- BanEx(killerid,"Cheat");
- SetPlayerScore(playerid,GetPlayerScore(playerid)+1);
- }
- else if(reason == 35)
- {
- BanEx(killerid,"Cheat");
- SetPlayerScore(playerid,GetPlayerScore(playerid)+1);
- }
- else if(reason == 36)
- {
- BanEx(killerid,"Cheat");
- SetPlayerScore(playerid,GetPlayerScore(playerid)+1);
- }
- else if(reason == 36)
- {
- BanEx(killerid,"Cheat");
- SetPlayerScore(playerid,GetPlayerScore(playerid)+1);
- }
- else if(reason == 38)
- {
- BanEx(killerid,"Cheat");
- SetPlayerScore(playerid,GetPlayerScore(playerid)+1);
- }
- }
- else
- {
- SetPlayerScore(playerid,GetPlayerScore(playerid)-1);
- }
- return 1;
- }
- public OnPlayerText(playerid, text[])
- {
- if(ALLOWCHAT[playerid] == 1)
- {
- new sendername[MAX_PLAYER_NAME];
- GetPlayerName(playerid,sendername,sizeof(sendername));
- new string[256];
- if(GetPlayerTeam(playerid) == 1)
- {
- if(SPAWNED[playerid] == 1)
- {
- format(string,sizeof(string),"{FFFFFF}[MAIN CHAT] {6EF83C}%s: {FFFFFF}%s",sendername,text);
- SendClientMessageToAll(-1,string);
- CHECKSPAM[playerid]++;
- }
- }
- else if(GetPlayerTeam(playerid) == 2)
- {
- if(SPAWNED[playerid] == 1)
- {
- format(string,sizeof(string),"{FFFFFF}[MAIN CHAT] {B700FF}%s: {FFFFFF}%s",sendername,text);
- SendClientMessageToAll(-1,string);
- CHECKSPAM[playerid]++;
- }
- }
- }
- return 0;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- if (strcmp("/help", cmdtext, true, 5) == 0)
- {
- if(SPAWNED[playerid] == 1)
- {
- SendClientMessage(playerid,-1,"{F9E8B7}COMMANDS: {FFFFFF}/help, /resetscore");
- }
- CHECKSPAM[playerid]++;
- return 1;
- }
- if (strcmp("/resetscore", cmdtext, true, 11) == 0)
- {
- if(SPAWNED[playerid] == 1)
- {
- SetPlayerScore(playerid,0);
- SendClientMessage(playerid,-1,"{F9E8B7}Your score is set back to {FFFFFF}0{F9E8B7}.");
- }
- CHECKSPAM[playerid]++;
- return 1;
- }
- return 0;
- }
- public OnPlayerUpdate(playerid)
- {
- if(SPAWNED[playerid] == 1)
- {
- if(GetPlayerWeapon(playerid) == 44) BanEx(playerid,"Cheat");
- else if(GetPlayerWeapon(playerid) == 45) BanEx(playerid,"Cheat");
- else if(GetPlayerWeapon(playerid) == 16) BanEx(playerid,"Cheat");
- if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK) BanEx(playerid,"Cheat");
- if(GetPlayerMoney(playerid) > 0) BanEx(playerid,"Cheat");
- new Float:pHealth;
- GetPlayerHealth(playerid,pHealth);
- new Float:pArmor;
- GetPlayerArmour(playerid,pArmor);
- if(pHealth != HEALTH[playerid])
- {
- if(pHealth > HEALTH[playerid])
- {
- BanEx(playerid,"Cheat");
- }
- else
- {
- }
- }
- else if(pArmor >= 1.0)
- {
- if(SPAWNED[playerid] == 1)
- {
- BanEx(playerid,"Cheat");
- }
- }
- }
- return 1;
- }
- public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
- {
- HEALTH[playerid] -= amount;
- return 1;
- }
- //==============================================================================
- public Second()
- {
- new timestr[32];
- seconds--;
- if(seconds <= 0)
- {
- if(timeleft <= 0)
- {
- KillTimer(roundtimer);
- seconds = 0;
- timeleft = 0;
- FreezeAll();
- SendClientMessageToAll(-1,"SERVER: {F9E8B7}Changing map...");
- maptimer = SetTimer("ChangeMap",5000,false);
- }
- else
- {
- seconds = 59;
- timeleft--;
- }
- }
- format(timestr,sizeof(timestr),"%02d:%02d",timeleft,seconds);
- TextDrawSetString(Timeleft,timestr);
- return 1;
- }
- public ChangeMap()
- {
- KillTimer(maptimer);
- if(MAP == 0)
- {
- MAP = 1;
- timeleft = ROUND_MINUTES;
- roundtimer = SetTimer("Second",1000,true);
- RespawnAll();
- UnFreezeAll();
- TextDrawSetString(CurrentMap,"Jefferson Motel");
- SendRconCommand("mapname Jefferson Motel");
- SendClientMessageToAll(-1,"SERVER: {F9E8B7}Map changed.");
- }
- else if(MAP == 1)
- {
- MAP = 2;
- timeleft = ROUND_MINUTES;
- roundtimer = SetTimer("Second",1000,true);
- RespawnAll();
- UnFreezeAll();
- TextDrawSetString(CurrentMap,"Liberty City");
- SendRconCommand("mapname Liberty City");
- SendClientMessageToAll(-1,"SERVER: {F9E8B7}Map changed.");
- }
- else if(MAP == 2)
- {
- MAP = 3;
- timeleft = ROUND_MINUTES;
- roundtimer = SetTimer("Second",1000,true);
- RespawnAll();
- UnFreezeAll();
- TextDrawSetString(CurrentMap,"Pleasure Domes");
- SendRconCommand("mapname Pleasure Domes");
- SendClientMessageToAll(-1,"SERVER: {F9E8B7}Map changed.");
- }
- else if(MAP == 3)
- {
- MAP = 4;
- timeleft = ROUND_MINUTES;
- roundtimer = SetTimer("Second",1000,true);
- RespawnAll();
- UnFreezeAll();
- TextDrawSetString(CurrentMap,"Planning Dept.");
- SendRconCommand("mapname Planning Department");
- SendClientMessageToAll(-1,"SERVER: {F9E8B7}Map changed.");
- }
- else if(MAP == 4)
- {
- MAP = 0;
- timeleft = ROUND_MINUTES;
- roundtimer = SetTimer("Second",1000,true);
- RespawnAll();
- UnFreezeAll();
- TextDrawSetString(CurrentMap,"RC Battlefield");
- SendRconCommand("mapname RC Battlefield");
- SendClientMessageToAll(-1,"SERVER: {F9E8B7}Map changed.");
- }
- UnFreezeAll();
- }
- public FloodCheck(playerid)
- {
- if(IsPlayerFlooding(playerid)) return Kick(playerid);
- else return 0;
- }
- //==============================================================================
- stock FreezeAll()
- {
- for(new i=0; i<MAX_PLAYERS; i++)
- {
- TogglePlayerControllable(i,0);
- }
- }
- stock UnFreezeAll()
- {
- for(new i=0; i<MAX_PLAYERS; i++)
- {
- TogglePlayerControllable(i,1);
- }
- }
- stock RespawnAll()
- {
- for(new i=0; i<MAX_PLAYERS; i++)
- {
- TogglePlayerSpectating(i,1);
- SPAWNED[i] = 0;
- TogglePlayerSpectating(i,0);
- }
- }
- stock IsPlayerFlooding(playerid)
- {
- if(CHECKSPAM[playerid] >= 3) return 1;
- else return CHECKSPAM[playerid] = 0;
- }
- stock SetPlayerHP(playerid,Float:amount)
- {
- HEALTH[playerid] = amount;
- SetPlayerHealth(playerid,amount);
- }
Advertisement
Add Comment
Please, Sign In to add comment