Gangwars + Textdraws -
Twisted_Insane - 27.02.2012
'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.840332, 2643.306884, -1573.840332,GROVE},
{2380.865966, -2001.554565, 2644.865966, -1737.554565,GROVE},
{2145.166259, -1995.344848, 2385.166259, -1755.344848,GROVE},
{1783.376220, -1398.963745, 2327.376220, -1030.963745,BALLA},
{1564.102172, -1224.421264, 1892.102172, -1032.421264,BALLA},
{1556.644531, -1398.070190, 1788.644531, -1222.070190,BALLA},
{2389.563720, -1238.908569, 2893.563720, -1046.908569,VAGOS},
{2327.079345, -1324.859741, 2391.079345, -1044.859741,VAGOS},
{2369.286132, -1432.190307, 2705.286132, -1208.190307,VAGOS},
{1636.727661, -2174.682861, 2148.727539, -1950.682861,AZTECAS},
{1801.938842, -1965.281616, 2089.938964, -1741.281616,AZTECAS},
{2073.393798, -2143.447021, 2409.393798, -1991.447021,AZTECAS},
{1279.003295, -1740.605834, 1831.003295, -1588.605834,POLICE},
{1355.672607, -1599.537353, 1563.672607, -1007.537353,POLICE},
{1563.951049, -1595.397460, 1931.951049, -1499.397460,POLICE},
{1354.048217, -2387.176269, 1666.048217, -2179.176269,RIFAS},
{1648.131103, -2333.540039, 1888.131103, -2245.540039,RIFAS},
{1368.555419, -2624.943847, 2256.555419, -2376.943847,RIFAS},
{1029.579833, -1608.954956, 1357.579833, -1136.954956,LOCO},
{992.831542, -1859.543090, 1288.831542, -1603.543090,LOCO},
{1286.829345, -1878.977539, 1806.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=0; i < sizeof(ZoneInfo); i++)
{
if(IsPlayerInZone(playerid, i))
{
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(playerid, zoneid)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
return (x > ZoneInfo[zoneid][zMinX] && x < ZoneInfo[zoneid][zMaxX] && y > ZoneInfo[zoneid][zMinY] && y < ZoneInfo[zoneid][zMaxY]);
}
stock GetPlayersInZone(zoneid, teamid)
{
new count;
for(new i=0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i) && gTeam[i] == teamid && IsPlayerInZone(i, zoneid))
{
count++;
}
}
return count;
}
PHP код:
forward ZoneTimer();
public ZoneTimer()
{
for(new i=0; i < sizeof(ZoneInfo); i++) // loop all zones
{
if(ZoneAttacker[i] != -1) // zone is being attacked
{
if(GetPlayersInZone(i, ZoneAttacker[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!
Re: Gangwars + Textdraws - T0pAz - 27.02.2012
What is your problem?
Re: Gangwars + Textdraws -
Twisted_Insane - 27.02.2012
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!
Re: Gangwars + Textdraws -
Twisted_Insane - 27.02.2012
Man, anyone please?
Re: Gangwars + Textdraws -
new121 - 27.02.2012
Quote:
Originally Posted by Twisted_Insane
Man, anyone please?
|
So you want somebody to make textdraws for you?
Re: Gangwars + Textdraws -
Twisted_Insane - 27.02.2012
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!
Re: Gangwars + Textdraws -
Twisted_Insane - 28.02.2012
Anyone knows how to advance this system? :/
Re: Gangwars + Textdraws -
Twisted_Insane - 01.03.2012
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...
Re: Gangwars + Textdraws -
Deduction - 01.03.2012
Twisted, if you need more detailed help, add Jbosh123 on Skype.
Else Private Message me on forums
Re: Gangwars + Textdraws -
Twisted_Insane - 01.03.2012
Erm, I would thank you way more if you could explain it right here right now (if you know some way)...