05.09.2013, 15:29
Hello
I got another problem :/
So I'm trying to make races, and the first checkpoint of all races should be shown to mark a race start there however nothing works as planned...
Here's the code:
SO no errors but it doesn't do what wanted...
So it should create a dynamic RaceCP on every first checkpoint of all the races, first of all it only creates a checkpoint at point 0,0,0 (race 2, the farm race) and not at the other race (the test race)
also there are 3D text labels created however they do not contain the wanted information, and there are multiple 3d text labels at one spot (the farm race) but none on the test race..
Also when I type /join and I'm in the Checkpoint, it does not call the wanted functions...
any help?
Thanks in advance
I got another problem :/
So I'm trying to make races, and the first checkpoint of all races should be shown to mark a race start there however nothing works as planned...
Here's the code:
pawn Код:
enum RaceInfo
{
Name, //Name
Tele,
ID, //The race ID
Float:RX, //The Tele cords
Float:RY,
Float:RZ,
Float:CPX[MAX_CHECKPOINTS], //The CP cords
Float:CPY[MAX_CHECKPOINTS],
Float:CPZ[MAX_CHECKPOINTS],
Timeout, //Time untill race ends
CheckPoints, //Amount of CP's
Running, //Race is busy
Joining, //you can still enter
Count, //Amount players still in the race
StartCount, //Amount of players that joined in the first place
rRaceTimer,
rRaceTime,
}
new RInfo[MAX_RACES][RaceInfo];
public OnGameModeInit()
{
new string[256];
for( new i = 0; i < MAX_RACES; i++ )
{
RaceCP[i] = CreateDynamicRaceCP(2, RInfo[ i ][ CPX ][ 0 ], RInfo[ i ][ CPY ][ 0 ], RInfo[ i ][ CPZ ][ 0 ], 0, 0, 0, 10.0, -1, -1, -1, 100.0);
format (string, sizeof string, "RACE: \"%s\" type /join to enter", RInfo[i][Name]);
CreateDynamic3DTextLabel(string, COLOR_GREEN_LABEL, RInfo[ i ][ CPX ][ 0 ], RInfo[ i ][ CPY ][ 0 ], RInfo[ i ][ CPZ ][ 0 ] + 5, 100.0,INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, -1, -1, -1, 100.0);
}
return 1;
}
stock AddCheckpointToRace(RaceID, CheckPointID, Float:CheckPointX, Float:CheckPointY, Float:CheckPointZ)
{
RInfo[RaceID][CPX][CheckPointID] = CheckPointX;
RInfo[RaceID][CPY][CheckPointID] = CheckPointY;
RInfo[RaceID][CPZ][CheckPointID] = CheckPointZ;
return 1;
}
stock CreateRace(RaceID,RaceName[], RaceTimeout, Float:TeleX,Float:TeleY,Float:TeleZ,cps)
{
format(RInfo[RaceID][Name], 100, "%s", RaceName);
RInfo[RaceID][Timeout] = RaceTimeout;
RInfo[RaceID][Running] = 0;
RInfo[RaceID][Joining] = 0;
RInfo[RaceID][RX] = TeleX;
RInfo[RaceID][RY] = TeleY;
RInfo[RaceID][RZ] = TeleZ;
RInfo[RaceID][ID] = RaceID;
RInfo[RaceID][CheckPoints] = cps; //Amount of CPS in the race
return 1;
}
CMD:join(playerid,params[])
{
if(PRInfo[playerid][RacingRace] == -1) //Player is not in any race
{
for(new i = 0; i < MAX_RACES; i++)
{
if (IsPlayerInDynamicRaceCP(playerid, RaceCP[i]))
{
new raceid;
raceid = i;
if(RInfo[raceid][Running] == 1 && RInfo[raceid][Joining] == 0)
SendClientMessage(playerid,COLOR_LIGHT_RED, "This race hasn't ended yet");
if(RInfo[raceid][Running] == 0 && RInfo[raceid][Joining] == 1)
JoinRace(playerid,raceid);
if(RInfo[raceid][Running] == 0 && RInfo[raceid][Joining] == 0)
StartRace(playerid,raceid);
break;
}
else
{
SendClientMessage(playerid,COLOR_LIGHT_RED, "You are not near any race starting point");
break;
}
}
}
else
SendClientMessage(playerid,COLOR_LIGHT_RED, "You are still racing, please finish it first");
return 1;
}
So it should create a dynamic RaceCP on every first checkpoint of all the races, first of all it only creates a checkpoint at point 0,0,0 (race 2, the farm race) and not at the other race (the test race)
also there are 3D text labels created however they do not contain the wanted information, and there are multiple 3d text labels at one spot (the farm race) but none on the test race..
Also when I type /join and I'm in the Checkpoint, it does not call the wanted functions...
any help?
Thanks in advance