Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define COLOR_GREY 0xAFAFAFAA
- #define COLOR_RED 0xFF000096
- #define COLOR_YELLOW 0xFFFF00AA
- #define COLOR_PINK 0xFF66FFAA
- #define COLOR_BLUE 0x0000BBAA
- #define COLOR_WHITE 0xFFFFFFAA
- #define COLOR_ORANGE 0xFF9900AA
- #define COLOR_VIOLET 0x9955DEEE
- #define COLOR_LEMON 0xDDDD2357
- #define COLOR_BLACK 0x00000000
- #define COLOR_PINK 0xFF66FFAA
- #define COLOR_PURPLE 0x800080AA
- #define COLOR_GREEN 0x33AA33AA
- #define COLOR_YELLOW 0xFFFF00AA
- #define COLOR_WHITE 0xFFFFFFAA
- #define COLOR_BROWN 0x993300AA
- #define COLOR_LIME 0x99FF00AA
- #define COLOR_SYSTEM 0xEFEFF7AA
- #define COLOR_AQUA 0x7CFC00AA
- #define COLOR_GOLD 0xB8860BAA
- #define COLOR_MAV 0xF5704996
- #define COLOR_BKV 0xFF800096
- #define COLOR_INAS 0x40808096
- #define COLOR_TAXI 0xFFFF0096
- #define COLOR_MENTOS 0xAE111196
- #define COLOR_BANKOS 0x5E5EA296
- #define COLOR_RABLO 0x5B9EAC96
- #define COLOR_KAMIONOS 0x80FF8096
- #define COLOR_ZSARU 0x00408096
- #define COLOR_POLITIKUS 0x00FF0096
- #define COLOR_KATONA 0x5F772D96
- #define COLOR_RIFA 0x00FFFF96
- #define COLOR_TRIAD 0x44005596
- #define COLOR_MAFFIA 0xFF800096
- #define COLOR_DANANG 0x65868796
- #define COLOR_NEON 0x00FF00AA
- #define COLOR_SYSTEM 0xEFEFF7AA
- #define HOMER 0x33AA33AA
- #define ORANGE 0xFFFFFFAA
- #define TEAM_RIFA 0
- #define TEAM_TRIAD 1
- #define TEAM_MAFFIA 2
- #define TEAM_DANANG 3
- #define dcmd(%1,%2,%3) if((strcmp((%3)[1],#%1,true,(%2))==0)&&((((%3)[(%2)+1]==0)&&(dcmd_%1(playerid,"")))||(((%3)[(%2)+1]==32)&&(dcmd_%1(playerid,(%3)[(%2)+2]))))) return 1
- #define MAX_TURFS 2
- #define MAX_TEAMS 4
- new msg3[ 256 ];
- new pom[128];
- static gTeam[MAX_PLAYERS];
- enum teaminfo
- {
- TeamName[ 32 ],
- TeamColor
- }
- new TeamInfo[ MAX_TEAMS ][ teaminfo ]= {
- { "Rifa", COLOR_RIFA},
- { "Triad", COLOR_TRIAD},
- { "Maffia", COLOR_MAFFIA},
- { "Danang", COLOR_DANANG}
- };
- #define SLOTS 100
- enum tinfo
- {
- turfID,
- turfName[ 40 ],
- Float:zMinX,
- Float:zMinY,
- Float:zMaxX,
- Float:zMaxY,
- TurfColor,
- TurfOwner,
- TurfAttacker,
- TurfWarStarted,
- attacktime
- }
- new turfs[ MAX_TURFS ][ tinfo ] = {
- { 0, "Ganton", -2267.21, -64.74, -1992.96, 124.61, COLOR_TRIAD, TEAM_TRIAD, -1, 0, 0},
- { 1, "Ganton", 2222.50, -1722.30, 2632.80, -1628.50, COLOR_TRIAD, TEAM_TRIAD, -1, 0, 0}
- };
- forward isPlayerInArea( playerID, Float:data[ 4 ] );
- forward IsPlayerInTurf( playerid, Float:min_x, Float:min_y, Float:max_x, Float:max_y );
- forward CheckPlayers( );
- forward TimeTextForPlayer( playerid, Text:text, time );
- forward DelayTimeTextForPlayer( playerid, Text:text, time );
- forward DestroyTextTimer( playerid, Text:text );
- public OnGameModeInit()
- {
- for (new t=0; t<MAX_TURFS; t++)
- {
- GangZoneCreate( turfs[ t ][zMinX], turfs[ t ][zMinY], turfs[ t ][zMaxX], turfs[ t ][zMaxY] );
- }
- SetTimer( "CheckPlayers", 1000, 1 );
- return 1;
- }
- dcmd_attack(playerid,params[]) {
- #pragma unused params
- new Float:x, Float:y, Float:z;
- new killerteam = gTeam[playerid];
- GetPlayerPos(playerid, x, y, z);
- for (new i = 0; i < MAX_TURFS; i++)
- {
- if (IsPlayerInTurf(playerid, turfs[i][zMinX], turfs[i][zMinY], turfs[i][zMaxX], turfs[i][zMaxY]) )
- {
- if (turfs[ i ][ TurfWarStarted ] != 1 && !IsPlayerInAnyVehicle(playerid))
- {
- turfs[ i ][ TurfAttacker ] = killerteam;
- GangZoneFlashForAll(turfs[ i ][turfID],COLOR_RED);
- for (new b=0; b<SLOTS; b++)
- {
- if (gTeam[b] == turfs[ i ][ TurfAttacker ])
- {
- new msg1[ 256 ];
- format(msg1,sizeof(msg1), "~w~We have provokated a gang war for %s with ~r~%s ~w~gang.",
- turfs[ i ][ turfName ], TeamInfo[ turfs[ i ][ TurfOwner ] ][ TeamName ]);
- new Text:txt1 = TextDrawCreate( 200.0, 385.0, msg1 );
- TextDrawFont( txt1, 0 );
- TextDrawSetShadow( txt1, 0 );
- TextDrawSetOutline( txt1, 1 );
- TextDrawColor( txt1, 0xDFDFDFFF );
- TimeTextForPlayer( b, txt1, 6000 );
- GangZoneFlashForPlayer( b, turfs[ i ][turfID], COLOR_RED );
- }
- else if (gTeam[b] == turfs[ i ][ TurfOwner ])
- {
- new msg2[ 256 ];
- format(msg2,sizeof(msg2), "Team ~y~%s ~r~has attacked our~y~%s~r~gang zone!",
- TeamInfo[ turfs[ i ][ TurfAttacker ] ][ TeamName ], turfs[ i ][ turfName ]);
- new Text:txt2 = TextDrawCreate( 200.0, 370.0, msg2 );
- TextDrawFont( txt2, 0 );
- TextDrawSetShadow( txt2, 0 );
- TextDrawSetOutline( txt2, 1 );
- TextDrawColor( txt2, COLOR_RED );
- TimeTextForPlayer( b, txt2, 6000 );
- GangZoneFlashForPlayer( b, turfs[ i ][turfID], COLOR_RED );
- }
- turfs[ i ][ TurfWarStarted ] = 1;
- turfs[i][attacktime] = 120000;
- }
- }
- }
- }
- return true;
- }
- public OnPlayerCommandText(playerid, cmdtext[])
- {
- dcmd(attack,6,cmdtext);
- return 0;
- }
- public isPlayerInArea(playerID, Float:data[4])
- {
- new Float:X, Float:Y, Float:Z;
- GetPlayerPos(playerID, X, Y, Z);
- if(X >= data[0] && X <= data[2] && Y >= data[1] && Y <= data[3]) {
- return 1;
- }
- return 0;
- }
- //==============================================================================
- public IsPlayerInTurf(playerid,Float:min_x,Float:min_y,Float:max_x,Float:max_y)
- {
- new Float:X,Float:Y,Float:Z;
- GetPlayerPos(playerid, X, Y, Z);
- if((X <= max_x && X >= min_x) && (Y <= max_y && Y >= min_y)) return 1;
- return 0;
- }
- //==============================================================================
- public TimeTextForPlayer( playerid, Text:text, time )
- {
- TextDrawShowForPlayer( playerid, text );
- SetTimerEx( "DestroyTextTimer", time, 0, "ii", playerid, _:text );
- }
- //------------------------------------------------------------------------------
- public DelayTimeTextForPlayer( playerid, Text:text, time )
- {
- SetTimerEx( "TimeTextForPlayer", time, 0, "iii", playerid, _:text, 4000 );
- }
- //------------------------------------------------------------------------------
- public DestroyTextTimer( playerid, Text:text )
- {
- TextDrawDestroy( text );
- }
- FlashZoneForPlayer( playerid )
- {
- for (new i = 0; i < MAX_TURFS; i++)
- {
- if (turfs[ i ][ TurfWarStarted ] == 1)
- {
- if (gTeam[playerid] == turfs[ i ][ TurfAttacker ]) GangZoneFlashForPlayer( playerid, i, COLOR_RED );
- else if (gTeam[playerid] == turfs[ i ][ TurfOwner ]) GangZoneFlashForPlayer( playerid, i, COLOR_RED );
- else GangZoneFlashForPlayer( playerid, i, COLOR_RED );
- }
- }
- }
- public CheckPlayers( )
- {
- for (new i = 0; i < MAX_TURFS; i++)
- {
- for (new g = 0; g < SLOTS; g++)
- {
- for (new a = 0; a < SLOTS; a++)
- {
- for (new d = 0; d < SLOTS; d++)
- {
- if (turfs[ i ][ TurfWarStarted ] == 1)
- {
- if(gTeam[g] == TEAM_RIFA || gTeam[g] == TEAM_TRIAD || gTeam[g] == TEAM_DANANG || gTeam[g] == TEAM_MAFFIA)
- {
- if (gTeam[a] == turfs[ i ][ TurfAttacker ])
- {
- if (gTeam[d] == turfs[ i ][ TurfOwner ])
- {
- if (turfs[ i ][ attacktime ] > 0)
- {
- if (IsPlayerInTurf(a, turfs[i][zMinX], turfs[i][zMinY], turfs[i][zMaxX], turfs[i][zMaxY] ))
- {
- SendClientMessage(105,COLOR_RED,"FUCK YOU!!!!!");
- }else{
- GangZoneStopFlashForAll(i);
- SendClientMessage(a,COLOR_RED,"We have lost the war");
- format(msg3,sizeof(msg3), "~g~We have defended the ~y~%s ~g~zone.", turfs[ i ][ turfName ]);
- new Text:txt3 = TextDrawCreate(200.0, 355.0, msg3);
- TextDrawFont( txt3, 0 );
- TextDrawSetShadow( txt3, 0 );
- TextDrawSetOutline( txt3, 1 );
- TextDrawColor( txt3, COLOR_GREEN );
- TimeTextForPlayer( d, txt3, 6000 );
- }
- }
- if (1 > turfs[ i ][ attacktime ])
- {
- if (IsPlayerInTurf(d, turfs[i][zMinX], turfs[i][zMinY], turfs[i][zMaxX], turfs[i][zMaxY]))
- {
- SendClientMessage(a,COLOR_YELLOW,"Kill the rival gang members");
- SendClientMessage(d,COLOR_YELLOW,"Kill the rival gang members");
- }else{
- GangZoneStopFlashForAll(i);
- SendClientMessage(d,COLOR_RED,"We have lost the war");
- format(msg3,sizeof(msg3), "~g~We have get ~y~%s ~g~zone.", turfs[ i ][ turfName ]);
- new Text:txt3 = TextDrawCreate(200.0, 355.0, msg3);
- TextDrawFont( txt3, 0 );
- TextDrawSetShadow( txt3, 0 );
- TextDrawSetOutline( txt3, 1 );
- TextDrawColor( txt3, COLOR_GREEN );
- TimeTextForPlayer( d, txt3, 6000 );
- turfs[ i ][ TurfOwner ] = a;
- turfs[ i ][ TurfColor ] = GetPlayerColor(a);
- GangZoneShowForPlayer(g, i, turfs[ i ][ TurfColor ] );
- turfs[ i ][ TurfAttacker ] = -1;
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- }
- public SecondTimer()
- {
- for (new i = 0; i < MAX_TURFS; i++)
- {
- for (new b=0; b<SLOTS; b++)
- {
- if (gTeam[b] == turfs[ i ][ TurfAttacker ] || gTeam[b] == turfs[ i ][ TurfOwner ])
- {
- if(turfs[i][attacktime] > 0)
- {
- turfs[i][attacktime]--;
- }
- if(turfs[i][attacktime]<60)
- {
- if(turfs[i][attacktime]<10)
- format(pom,sizeof(pom),"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~~w~00:0%d",turfs[i][attacktime]);
- else
- format(pom,sizeof(pom),"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~~w~00:%d",turfs[i][attacktime]);
- }else{
- new minutes = floatround(turfs[i][attacktime]/60);
- new seconds = turfs[i][attacktime]-minutes*60;
- if(minutes < 10 && seconds < 10)
- format(pom,sizeof(pom),"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~~w~0%d:0%d",minutes,seconds);
- else if(minutes < 10 && seconds >= 10)
- format(pom,sizeof(pom),"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~~w~0%d:%d",minutes,seconds);
- else if(minutes >= 10 && seconds < 10)
- format(pom,sizeof(pom),"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~~w~%d:0%d",minutes,seconds);
- else if(minutes >= 10 && seconds >= 10)
- format(pom,sizeof(pom),"~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~g~~w~%d:%d",minutes,seconds);
- }
- GameTextForPlayer(b,pom,2000,3);
- if(0>turfs[i][attacktime])
- {
- turfs[i][attacktime] = 0;
- }
- }
- }
- }
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment