05.03.2014, 22:07
Dialogs not showing up when hosting a race or trying to join.
What's wrong with my code?
(THE FIRST DIALOG IS THE MAIN MENU IGNORE IT)
EDIT: I had listemitem 1 & 2 not 0 & 1 lol - Brain dead xD
What's wrong with my code?
(THE FIRST DIALOG IS THE MAIN MENU IGNORE IT)
pawn Код:
if(dialogid == DIALOG_MOTORCROSS)
{
if(!response)
{
ShowPlayerDialog(playerid, RACE_MENU, DIALOG_STYLE_LIST, "Race Menu - Select Your Choice:", "Motorcross\nGo-Karts\nDemolition Derby", "Select", "Cancel");
return 1;
}
if(listitem == 1)
{
new motorcross[256];
new name1[MAX_PLAYER_NAME];
new name2[MAX_PLAYER_NAME];
new name3[MAX_PLAYER_NAME];
new name4[MAX_PLAYER_NAME];
new name5[MAX_PLAYER_NAME];
for(new i = 0; i < sizeof(RaceInfo); i++)
{
if(RaceInfo[i][rCreated] == 0)
{
RaceInfo[i][rCreated] = 1;
RaceInfo[i][rHost] = playerid;
RaceInfo[i][rWait] = 1;
RaceInfo[i][rInProgress] = 0;
RaceInfo[i][rRacers] = 1;
RaceInfo[i][rType] = 1;
RaceInfo[i][rWorld] = playerid+2; //This has to be +2 or it will cause problems with interiors
RaceInfo[i][rInt] = 4;
RaceInfo[i][rDriver1] = playerid;
GetPlayerName(RaceInfo[i][rDriver1], name1, sizeof(name1));
RaceInfo[i][rDriver2] = -1;
GetPlayerName(RaceInfo[i][rDriver2], name2, sizeof(name2));
RaceInfo[i][rDriver3] = -1;
GetPlayerName(RaceInfo[i][rDriver3], name3, sizeof(name3));
RaceInfo[i][rDriver4] = -1;
GetPlayerName(RaceInfo[i][rDriver4], name4, sizeof(name4));
RaceInfo[i][rDriver5] = -1;
GetPlayerName(RaceInfo[i][rDriver5], name5, sizeof(name5));
RaceInfo[i][rPos1] = -1;
RaceInfo[i][rPos2] = -1;
RaceInfo[i][rPos3] = -1;
RaceInfo[i][rPos4] = -1;
RaceInfo[i][rPos5] = -1;
RaceInfo[i][rPos1A] = 1;
RaceInfo[i][rPos2A] = 1;
RaceInfo[i][rPos3A] = 1;
RaceInfo[i][rPos4A] = 1;
RaceInfo[i][rPos5A] = 1;
RaceInfo[i][rLaps] = 5;
RaceInfo[i][rWinner] = -1;
SetPlayerVirtualWorld(playerid, RaceInfo[i][rWorld]);
InLobby[playerid] = i;
InRace[playerid] = i;
RaceCheckp[playerid] = 0;
TotalRaceTime[playerid] = 0;
LapTime[playerid] = 0;
CountDown[playerid] = 5;
CheckpointArea[playerid] = 0;
CornerDetect[playerid] = 0;
format(motorcross, sizeof(motorcross), "%s [PLAYERS]\nDriver 1: %s\nDriver 2: %s\nDriver 3: %s\nDriver 4: %s\nDriver 5: %s\n[INFORMATION]\nLaps: %d", motorcross, name1, name2, name3, name4, name5, RaceInfo[i][rLaps]);
}
}
ShowPlayerDialog(playerid, DIALOG_MOTORCROSS_HOST, DIALOG_STYLE_MSGBOX, "Motorcross Host:", motorcross, "Start", "Leave");
return 1;
}
if(listitem == 2)
{
new motorcrossjoin[256];
new host[MAX_PLAYER_NAME];
for(new i = 0; i < sizeof(RaceInfo); i++)
{
if(RaceInfo[i][rCreated] == 1 && RaceInfo[i][rWait] == 1 && RaceInfo[i][rInProgress] == 0)
{
GetPlayerName(RaceInfo[i][rHost], host, sizeof(host));
format(motorcrossjoin, sizeof(motorcrossjoin), "%s Race: %d | Host: %s | Players: %d", motorcrossjoin, i, host, RaceInfo[i][rRacers]);
}
}
ShowPlayerDialog(playerid, DIALOG_MOTORCROSS_JOIN, DIALOG_STYLE_LIST, "Motorcross Join:", motorcrossjoin, "Join", "Cancel");
return 1;
}
}