Gangwars + Textdraws
#1

'Sup y'all!

Yeah, after a time, I was worried about a problem:

I am making a gangwar server, no question! So now, I've followed the tutorial of MadeMan a long time ago to make the gangzones attackable! What I still need is:

When for example Team Grove gets attacked from the Ballas, there should be written for the Groves:

The %s have attacked our turf in Ganton!

and for the Ballas:

We have provoked a gangwar in Ganton against %s!

Of course it should not be everytime Ganton, in the place where it happened simply! This is what I got so far:


pawn Код:
#define MIN_DEATHS_TO_START_WAR 3 // how many team members must be killed in a zone to start a war
PHP код:
       enum eZone
    
{
    
Float:zMinX,
    
Float:zMinY,
    
Float:zMaxX,
    
Float:zMaxY,
    
zTeam
    
}
    
       new 
ZoneInfo[][eZone] = {
    {
2083.306884, -1757.8403322643.306884, -1573.840332,GROVE},
    {
2380.865966, -2001.5545652644.865966, -1737.554565,GROVE},
    {
2145.166259, -1995.3448482385.166259, -1755.344848,GROVE},
    {
1783.376220, -1398.9637452327.376220, -1030.963745,BALLA},
    {
1564.102172, -1224.4212641892.102172, -1032.421264,BALLA},
    {
1556.644531, -1398.0701901788.644531, -1222.070190,BALLA},
    {
2389.563720, -1238.9085692893.563720, -1046.908569,VAGOS},
    {
2327.079345, -1324.8597412391.079345, -1044.859741,VAGOS},
    {
2369.286132, -1432.1903072705.286132, -1208.190307,VAGOS},
    {
1636.727661, -2174.6828612148.727539, -1950.682861,AZTECAS},
    {
1801.938842, -1965.2816162089.938964, -1741.281616,AZTECAS},
    {
2073.393798, -2143.4470212409.393798, -1991.447021,AZTECAS},
    {
1279.003295, -1740.6058341831.003295, -1588.605834,POLICE},
    {
1355.672607, -1599.5373531563.672607, -1007.537353,POLICE},
    {
1563.951049, -1595.3974601931.951049, -1499.397460,POLICE},
    {
1354.048217, -2387.1762691666.048217, -2179.176269,RIFAS},
    {
1648.131103, -2333.5400391888.131103, -2245.540039,RIFAS},
    {
1368.555419, -2624.9438472256.555419, -2376.943847,RIFAS},
    {
1029.579833, -1608.9549561357.579833, -1136.954956,LOCO},
    {
992.831542, -1859.5430901288.831542, -1603.543090,LOCO},
    {
1286.829345, -1878.9775391806.829345, -1726.977539,LOCO}
    };
    
//attacking gangzones
    
new ZoneAttacker[sizeof(ZoneInfo)] = {-1, ...};
    new 
ZoneAttackTime[sizeof(ZoneInfo)];
    new 
ZoneDeaths[sizeof(ZoneInfo)];
    new 
ZoneID[sizeof(ZoneInfo)]; 
PHP код:
            stock GetPlayerZone(playerid)
            {
                for(new 
i=0sizeof(ZoneInfo); i++)
                {
                    if(
IsPlayerInZone(playeridi))
                    {
                        return 
i;
                    }
                }
                    return -
1;
            }
            
            
stock GetTeamZoneColor(teamid)
            {
                switch(
teamid)
                {
                case 
GROVE: return  0x00FF007A;
                case 
BALLA: return 0x800080AA//0xFF00FFAA;
                
case VAGOS: return 0xFFFF00AA;
                case 
AZTECAS: return 0x00FFFFAA;
                case 
POLICE: return 0x0000BBAA;
                case 
RIFAS: return 0xFFFFFFAA;
                case 
LOCO: return 0x000000AA;
                }
                return -
1;
            }
            
            
stock IsPlayerInZone(playeridzoneid)
            {
                new 
Float:xFloat:yFloat:z;
                
GetPlayerPos(playeridxyz);
                return (
ZoneInfo[zoneid][zMinX] && ZoneInfo[zoneid][zMaxX] && ZoneInfo[zoneid][zMinY] && ZoneInfo[zoneid][zMaxY]);
            }
            
stock GetPlayersInZone(zoneidteamid)
            {
                new 
count;
                for(new 
i=0MAX_PLAYERSi++)
                {
           if(
IsPlayerConnected(i) && gTeam[i] == teamid && IsPlayerInZone(izoneid))
                    {
                        
count++;
                    }
                }
                return 
count;
            } 
PHP код:
forward ZoneTimer();
public 
ZoneTimer()
{
    for(new 
i=0sizeof(ZoneInfo); i++) // loop all zones
    
{
        if(
ZoneAttacker[i] != -1// zone is being attacked
        
{
            if(
GetPlayersInZone(iZoneAttacker[i]) >= 1// there must be at least 1 attacker left
            
{
                
ZoneAttackTime[i]++;
                if(
ZoneAttackTime[i] == TAKEOVER_TIME// zone has been under attack for enough time and attackers take over the zone
                
{
                    
GangZoneStopFlashForAll(ZoneID[i]);
                    
ZoneInfo[i][zTeam] = ZoneAttacker[i];
                    
GangZoneShowForAll(ZoneID[i], GetTeamZoneColor(ZoneInfo[i][zTeam])); // update the zone color for new team
                    
ZoneAttacker[i] = -1;
                }
            }
            else 
// attackers failed to take over the zone
            
{
                
GangZoneStopFlashForAll(ZoneID[i]);
                
ZoneAttacker[i] = -1;
            }
        }
    }

I'm a total noob in textdraws, never worked with them, never touched 'em! I know that this isn't an easy task to complete, and I'd be very thankful to people who could help me!
Reply
#2

What is your problem?
Reply
#3

Man look, didn't you understand?

When gangzone X is under attack, there should be a textdraw for attacker + victim! Example:

Grove gets attacked in Ganton!

For the Groves should be written now:

The Ballas have attacked our turf in Ganton (GANTON could be any place where it's getting attacked)!

For the Ballas:

We've provoked a turfwar in Ganton against Grove Street!

Of course, this should be for every single team the same, I just dunno how to do that!
Reply
#4

Man, anyone please?
Reply
#5

Quote:
Originally Posted by Twisted_Insane
Посмотреть сообщение
Man, anyone please?
So you want somebody to make textdraws for you?
Reply
#6

Dude, I don't need such smartass-answers! The textdraws are the smaller problem, the main one is how to send the message for the attacking/provoking as I described!
Reply
#7

Anyone knows how to advance this system? :/
Reply
#8

Oh my god, I think I figured out myself, that I can use "if([gteam])" to check the teams and then send the textdraws? I just wanna know the start...
Reply
#9

Twisted, if you need more detailed help, add Jbosh123 on Skype.

Else Private Message me on forums
Reply
#10

Erm, I would thank you way more if you could explain it right here right now (if you know some way)...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)