Chage specific zone's color
#1

I want to change one zone's color after some code
PHP код:
    for(new 0sizeof(ZoneInfo);i++)
    {
        if(
IsPlayerInGangZone(playeridi) && IsPlayerInGangZone(killeridi) && gTeam[playerid] != gTeam[killerid] && ZoneInfo[i][zTeam] != gTeam[killerid] && ZoneInfo[i][zTeam] == gTeam[playerid] && gTeam[playerid] != && capturing[killerid] == false)
        {
            
capturing[killerid] = true;
            
CT2[killerid] = SetTimerEx("capture"3*60000false"i"killerid);
            
CT[killerid] = SetTimerEx("CaptureTime"1000true"i"killerid);
            
SendClientMessage(killeridCOLOR_GREEN"Stay in the zone for 3 minutes and avoid dying by the other team!");
            
OthersTeam[killerid] = TeamName[playerid];
        }
    } 
PHP код:
public capture(playerid)
{
    if(
capturing[playerid] == true)
    {
        new 
ToAllMe[128];
        
format(ToAllMesizeof(ToAllMe), "%s gang has captured a zone from %s",TeamName[playerid], OthersTeam[playerid]);
        
SendClientMessageToAll(COLOR_GREENToAllMe);
        for(new 
0sizeof(ZoneInfo);i++)
        {
            
GangZoneShowForAll(iGetPlayerColor(playerid));
            
ZoneInfo[i][zColor] = GetPlayerColor(playerid);
            
ZoneInfo[i][zTeam] = zPlayerTeam[playerid];
            
GivePlayerMoney(playerid2000);
            
SetPlayerScore(playeridGetPlayerScore(playerid)+2);
            
KillTimer(CT[playerid]);
            
captureTimer[playerid] = 180;
        }
    }
    return 
1;

But I know this will change all zones' color now only the zone that I'm in
Reply
#2

Quote:
Originally Posted by nezo2001
Посмотреть сообщение
I want to change one zone's color after some code
...
But I know this will change all zones' color now only the zone that I'm in
Updated, added comments to point out the changes
PHP код:
    for(new 0sizeof(ZoneInfo);i++)
    {
        if(
IsPlayerInGangZone(playeridi) && IsPlayerInGangZone(killeridi) && gTeam[playerid] != gTeam[killerid] && ZoneInfo[i][zTeam] != gTeam[killerid] && ZoneInfo[i][zTeam] == gTeam[playerid] && gTeam[playerid] != && capturing[killerid] == false)
        {
            
capturing[killerid] = true;
            
CT2[killerid] = SetTimerEx("capture"3*60000false"ii"killeridi); // UPDATED; now has 2 arguments, the second beeing zoneid
            
CT[killerid] = SetTimerEx("CaptureTime"1000true"i"killerid);
            
SendClientMessage(killeridCOLOR_GREEN"Stay in the zone for 3 minutes and avoid dying by the other team!");
            
OthersTeam[killerid] = TeamName[playerid];
        }
    } 
PHP код:
public capture(playeridzoneid)
{
    if(
capturing[playerid] == true)
    {
        new 
ToAllMe[128];
        
format(ToAllMesizeof(ToAllMe), "%s gang has captured a zone from %s",TeamName[playerid], OthersTeam[playerid]);
        
SendClientMessageToAll(COLOR_GREENToAllMe);
        
// UPDATED; the below used to be the for loop, now that the capture function gets a zoneid it doesnt need the loop anymore
        
GangZoneShowForAll(zoneidGetPlayerColor(playerid));
        
ZoneInfo[zoneid][zColor] = GetPlayerColor(playerid);
        
ZoneInfo[zoneid][zTeam] = zPlayerTeam[playerid];
        
GivePlayerMoney(playerid2000);
        
SetPlayerScore(playeridGetPlayerScore(playerid)+2);
        
KillTimer(CT[playerid]);
        
captureTimer[playerid] = 180;
    }
    return 
1;

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)