22.09.2014, 11:46
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.
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.
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;
}