18.07.2009, 02:33
hi i've scripted a gangwar script but the gangwar dont starts..
please help its very important for me.
If you need more informationen about the variables etc. please say it!
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
...
if(playerGang[killerid] != playerGang[playerid])
{
new Float:x, Float:y, Float:z; GetPlayerPos(playerid,x,y,z);
for(new zone = 0; zone < MAX_ZONES; zone++)
{
if(x >= ZoneInfo[zone][zPosition][0] && x < ZoneInfo[zone][zPosition][2] && y >= ZoneInfo[zone][zPosition][1] && y < ZoneInfo[zone][zPosition][3])
{
// The Killer who kills on his own turf
if(ZoneInfo[zone][zTeamid] == playerGang[killerid] )
{
if(ZoneInfo[zone][GangWarInProgress] == 1)
{
if(playerGang[killerid] == ZoneInfo[zone][ZoneAttackers]) Gangs[playerGang[killerid]][DefendCount]++;
if(Gangs[playerGang[killerid]][DefendCount] == GANGAREA_DEFEND )
{
// send the message
GetPlayerName(killerid, playername, sizeof(playername));
SendClientMessageToAll(COLOR_RED," ");
format(string, sizeof(string), "*** GangZone Message: %s von %s hat seine Gangzone von %s verteidigt!", playername,Gangs[playerGang[killerid]][gName], Gangs[playerGang[playerid]][gName] );
SendClientMessageToAll(GetPlayerColor(killerid), string);
SendClientMessageToAll(COLOR_RED," ");
// change the zone colour
GangZoneStopFlashForAll(zone);
GangZoneHideForAll(zone);
GangZoneShowForAll(zone, GetPlayerColor(killerid));
// reset the counters
Gangs[playerGang[killerid]][UnderAttackCount] = 0;
Gangs[playerGang[playerid]][UnderAttackCount] = 0;
Gangs[playerGang[killerid]][DefendCount] = 0;
ZoneInfo[zone][GangWarInProgress] = 0;
ZoneInfo[zone][ZoneAttackers] = -1;
// save the current zone colour for new players to see DONT REALLY NEED ALL THIS AGAIN
ZoneInfo[zone][zColor] = GetPlayerColor(killerid);
// save the 'new' owner of the zone
strmid(ZoneInfo[zone][zGangname], Gangs[playerGang[killerid]][gName], 0, strlen(Gangs[playerGang[killerid]][gName]), MAX_PLAYER_NAME);
ZoneInfo[zone][zTeamid] = playerGang[killerid];
// Save to file
SaveZones();
//kill timer
KillTimer(GangWarTimer[zone]);
}
}
}
// The Player who dies on his own turf
else if(ZoneInfo[zone][zTeamid] == playerGang[playerid])
{
Gangs[playerGang[playerid]][UnderAttackCount]++;
// start the gang war
if(Gangs[playerGang[playerid]][UnderAttackCount] == GANGAREA_WARNINGS)
{
GetPlayerName(killerid, playername, sizeof(playername));
SendClientMessageToAll(COLOR_RED," ");
format(string, sizeof(string), "*** GangZone Message: %s von %s hat einen Gangwar mit %s gestartet!", playername,Gangs[playerGang[killerid]][gName], Gangs[playerGang[playerid]][gName] );
SendClientMessageToAll(GetPlayerColor(killerid), string);
SendClientMessageToAll(COLOR_RED," ");
GangZoneFlashForAll(zone, GetPlayerColor(killerid) );
ZoneInfo[zone][GangWarInProgress] = 1;
ZoneInfo[zone][ZoneAttackers] = playerGang[killerid];
// If after x minutes the zone isnt taken then the defending gang keep their turf
GangWarTimer[zone] = SetTimerEx("EndGangWar",GANGWAR_LENGTH,false,"iii",zone, playerGang[killerid], playerGang[playerid] );
return 1;
}
// Gang has taken the other gangs turf
if((Gangs[playerGang[playerid]][UnderAttackCount] == GANGAREA_TAKE) && (ZoneInfo[zone][ZoneAttackers] == playerGang[killerid]) )
{
// send the message
GetPlayerName(killerid, playername, sizeof(playername));
SendClientMessageToAll(COLOR_RED," ");
format(string, sizeof(string), "*** GangZone Message: %s von %s hat die Gangzone von %s eingenommen", playername,Gangs[playerGang[killerid]][gName], Gangs[playerGang[playerid]][gName]);
SendClientMessageToAll(GetPlayerColor(killerid), string);
SendClientMessageToAll(COLOR_RED," ");
format(string, sizeof(string), "~n~~n~~n~~n~~n~~n~~n~~n~~n~ %s hat die gangzone von ~n~ %s eingenommen",Gangs[playerGang[killerid]][gName], Gangs[playerGang[playerid]][gName] );
GameTextForAll(string,3000,3);
// kill the end gangwar timer
if( GangWarTimer[zone] ) KillTimer( GangWarTimer[zone] );
// change the zone colour
GangZoneStopFlashForAll( zone );
GangZoneHideForAll( zone );
GangZoneShowForAll( zone, GetPlayerColor(killerid) );
// reset the counter
Gangs[playerGang[killerid]][UnderAttackCount] = 0;
Gangs[playerGang[playerid]][UnderAttackCount] = 0;
// save the current zone colour for new players to see
ZoneInfo[zone][zColor] = GetPlayerColor(killerid);
// save the new owner of the zone
strmid(ZoneInfo[zone][zGangname], Gangs[playerGang[killerid]][gName], 0, strlen(Gangs[playerGang[killerid]][gName]), MAX_PLAYER_NAME);
ZoneInfo[zone][zTeamid] = playerGang[killerid];
//save zones to file
SaveZones();
}
}
}
}
return 1;
}
please help its very important for me.
If you need more informationen about the variables etc. please say it!