Never experienced such a weird problem.
#1

So bassicly I'm working a new gamemode scracth made that is focused on warfare between continents something sick.

Anyways, I have finished my whole class system and my team system though I'm experiencing an issue in the team system.

Bassicly everytime I change a team, etc it make the variable of that team go -1 and when I enter that team it goes +1 so it works for two times and then it writes for all the teams that they are full, IO can not find a fix for it I've tried for like an hour already yet no success.

Here's the code, this is just one part, consider this the code because it's bassicly the same when you are trying to choose each team just that some parts are changed, like checking if the team is full, etc.

pawn Код:
case 5:
                {
                    if(g_Antarctica > g_Europe || g_America || g_Asia || g_Australia || g_Africa)
                    {
                        SendClientMessage(playerid, COLOR_RED, "This team is full. Please choose a different one.");
                        ShowPlayerDialog(playerid, DIALOG_CHOOSE_TEAM, DIALOG_STYLE_LIST, "Choose A Team", "Europe\nAmerica\nAfrica\nAsia\nAustralia\nAntarctica\n", "Join", "Quit");
                    }
                    else
                    {
                        if(pInfo[playerid][Team] == EUROPE)
                        {
                            g_Europe--;
                            pInfo[playerid][LastTeam] = EUROPE;

                            pInfo[playerid][Team] = ANTARCTICA;
                            g_Antarctica++;
                            ShowPlayerDialog(playerid, DIALOG_CHOOSE_CLASS, DIALOG_STYLE_LIST, "Choose A Class", "Private\nOfficer\nEngineer\nSergeant\nRecon\nLieutenant\nPilot\n\n", "Choose", "Quit");
                        }
                        else if(pInfo[playerid][Team] == AMERICA)
                        {
                            g_America--;
                            pInfo[playerid][LastTeam] = AMERICA;
                           
                            pInfo[playerid][Team] = ANTARCTICA;
                            g_Antarctica++;
                            ShowPlayerDialog(playerid, DIALOG_CHOOSE_CLASS, DIALOG_STYLE_LIST, "Choose A Class", "Private\nOfficer\nEngineer\nSergeant\nRecon\nLieutenant\nPilot\n\n", "Choose", "Quit");
                        }
                        else if(pInfo[playerid][Team] == AFRICA)
                        {
                            g_Africa--;
                            pInfo[playerid][LastTeam] = AFRICA;
                       
                            pInfo[playerid][Team] = ANTARCTICA;
                            g_Antarctica++;
                            ShowPlayerDialog(playerid, DIALOG_CHOOSE_CLASS, DIALOG_STYLE_LIST, "Choose A Class", "Private\nOfficer\nEngineer\nSergeant\nRecon\nLieutenant\nPilot\n\n", "Choose", "Quit");
                        }
                        else if(pInfo[playerid][Team] == ASIA)
                        {
                            g_Asia--;
                            pInfo[playerid][LastTeam] = ASIA;

                            pInfo[playerid][Team] = ANTARCTICA;
                            g_Antarctica++;
                            ShowPlayerDialog(playerid, DIALOG_CHOOSE_CLASS, DIALOG_STYLE_LIST, "Choose A Class", "Private\nOfficer\nEngineer\nSergeant\nRecon\nLieutenant\nPilot\n\n", "Choose", "Quit");
                        }
                        else if(pInfo[playerid][Team] == AUSTRALIA)
                        {
                            g_Australia--;
                            pInfo[playerid][LastTeam] = AUSTRALIA;
                       
                            pInfo[playerid][Team] = ANTARCTICA;
                            g_Antarctica++;
                            ShowPlayerDialog(playerid, DIALOG_CHOOSE_CLASS, DIALOG_STYLE_LIST, "Choose A Class", "Private\nOfficer\nEngineer\nSergeant\nRecon\nLieutenant\nPilot\n\n", "Choose", "Quit");
                        }
                        else if(pInfo[playerid][Team] == ANTARCTICA)
                        {
                            SendClientMessage(playerid, COLOR_RED, "You are already in the Antarctica team. To change class write /ChangeClass.");
                        }
                        else
                        {  
                            pInfo[playerid][Team] = ANTARCTICA;
                            g_Antarctica++;
                            ShowPlayerDialog(playerid, DIALOG_CHOOSE_CLASS, DIALOG_STYLE_LIST, "Choose A Class", "Private\nOfficer\nEngineer\nSergeant\nRecon\nLieutenant\nPilot\n\n", "Choose", "Quit");
                        }
                    }      
                }
            }
        }
        printf("There are currently %d members in europe", g_Europe);
        printf("There are currently %d members in america", g_America);
        printf("There are currently %d members in africa", g_Africa);
        printf("There are currently %d members in asia", g_Asia);
        printf("There are currently %d members in australia", g_Australia);
        printf("There are currently %d members in Antarctica", g_Antarctica);
        printf("user %s is currently in team %d", GetName(playerid), pInfo[playerid][Team]);
        return 1;
    }
        return 0;
}
I'd like to thank the people who help me with the situation, btw I'm printing the result and EVERYTHING IS GOOD when it's being printed yet in game it's not.
Reply
#2

Did you set each variable to 0 before the classselection starts ?
Reply
#3

When disconnection occurs, yes.
Reply
#4

try it on connect too not sure if it works though
Reply
#5

I didn't understand what your problem is? if a player goes in and out the team being full?
However, I do see something wrong is your code. This:
PHP код:
if(g_Antarctica g_Europe || g_America || g_Asia || g_Australia || g_Africa
Should become:
PHP код:
if(g_Antarctica > (g_Europe g_America g_Asia g_Australia g_Africa)) 
Reply
#6

Alright, just came back home gonna try both of your guys' comments.



Quote:
Originally Posted by ranme15
Посмотреть сообщение
I didn't understand what your problem is? if a player goes in and out the team being full?
However, I do see something wrong is your code. This:
PHP код:
if(g_Antarctica g_Europe || g_America || g_Asia || g_Australia || g_Africa
Should become:
PHP код:
if(g_Antarctica > (g_Europe g_America g_Asia g_Australia g_Africa)) 
Thanks bro, your thing worked like magic! Appereciate it brother!
Reply
#7

Quote:
Originally Posted by Ox1gEN
Посмотреть сообщение
Alright, just came back home gonna try both of your guys' comments.






Thanks bro, your thing worked like magic! Appereciate it brother!
Your welcome (aka RaNN)
Reply
#8

Quote:
Originally Posted by ranme15
Посмотреть сообщение
Your welcome (aka RaNN)
RaNN? hhhh toda ah sheli
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)