Little help.
#1

Hello everybody. I spotted new bug. But I don`t see any problem. This codes are for ordering one zone for spawn random zone.
pawn Код:
printf("0");
    for(new i = 1; i < 5; i++)
    {
        new RandomZone;
        printf("1");
        GenerateRandomZone:
        printf("2");
        RandomZone = random(sizeof(GangZones));
        printf("3");

        if(GangZones[RandomZone][OwnerTeam] != 0)
            goto GenerateRandomZone;
        printf("4");
        GangZones[RandomZone][OwnerTeam] = i;
        printf("5");
    }
Debug stucks at number 2.. please help me.
Reply
#2

Anyone? Sorry for double posting but it`s urgent
Reply
#3

First of all, avoid using 'goto.' (probably a recursive func) (AFAIK, that's what is USUALLY suggested)

Secondly, I have no idea what you're trying to do (If GangZones array is reset, I guess the first time you run this code, it will never be satisfied, right?)

Can you explain more? (where you set it, etc)
Reply
#4

Quote:
Originally Posted by RajatPawar
Посмотреть сообщение
First of all, avoid using 'goto.' (probably a recursive func) (AFAIK, that's what is USUALLY suggested)

Secondly, I have no idea what you're trying to do (If GangZones array is reset, I guess the first time you run this code, it will never be satisfied, right?)

Can you explain more?
Look code says. It`s taking random zone from array. In that array are coordinates of spawn,zone cordinates,then code is checking if team don`t have zone then it will generate zone automaticly and gave it to team. And bug is on point 2 that means on generating random zone.
Reply
#5

That's not helpful, I know what it does, I asked what you wanted it to do, and where you set 'OwnerTeam', etc. Why don't you add prints as to what "GangZones[RandomZone][OwnerTeam]" is, below where you use goto, it will kind of really help you resolve the issue.

pawn Код:
printf("Condition check: GangZones[%d][OwnerTeam]: Checking if (%d != 0)", RandomZone, GangZones[RandomZone][OwnerTeam]);
Reply
#6

Quote:
Originally Posted by RajatPawar
Посмотреть сообщение
That's not helpful, I know what it does, I asked what you wanted it to do, and where you set 'OwnerTeam', etc. Why don't you add prints as to what "GangZones[RandomZone][OwnerTeam]" is, below where you use goto, it will kind of really help you resolve the issue.

pawn Код:
printf("Condition check: GangZones[%d][OwnerTeam]: Checking if (%d != 0)", RandomZone, GangZones[RandomZone][OwnerTeam]);
Well here is print results
Код:
[13:03:58] 0
[13:03:58] 1
[13:03:58] Condition check: GangZones[0][OwnerTeam]: Checking if (0 != 0)
OwnerTeam is variable which checks who is owner of the zone which team.I have 4 teams on the server.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)