I created my auto race in server but there is a problem (bug).
pawn Код:
public OnPlayerEnterDynamicRaceCP(playerid, checkpointid)
{
if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 522)
{
if(checkpointid == CP0)
{
DestroyDynamicRaceCP(CP0);
GameTextForPlayer(playerid, "~r~1/8", 5000, 3);
PlayerPlaySound(playerid,1053,0.0,0.0,0.0);
CP1 = CreateDynamicRaceCP(0, -2087.2236,930.4537,68.7196, -2142.8618,919.0911,79.4255, 10.0, -1, -1, playerid, 1000000.0);
return 1;
}
if(checkpointid == CP1)
{
DestroyDynamicRaceCP(CP1);
PlayerPlaySound(playerid,1053,0.0,0.0,0.0);
GameTextForPlayer(playerid, "~r~2/8", 5000, 3);
CP2 = CreateDynamicRaceCP(0, -2142.8618,919.0911,79.4255, -2037.5515,1175.8153,44.8528, 10.0, -1, -1, playerid, 1000000.0);
return 1;
}
if(checkpointid == CP2)
{
DestroyDynamicRaceCP(CP2);
GameTextForPlayer(playerid, "~r~3/8", 5000, 3);
PlayerPlaySound(playerid,1053,0.0,0.0,0.0);
CP3 = CreateDynamicRaceCP(0, -2037.5515,1175.8153,44.8528, -1966.5742,1104.3687,55.0706, 10.0, -1, -1, playerid, 1000000.0);
return 1;
}
if(checkpointid == CP3)
{
DestroyDynamicRaceCP(CP3);
PlayerPlaySound(playerid,1053,0.0,0.0,0.0);
GameTextForPlayer(playerid, "~r~4/8", 5000, 3);
CP4 = CreateDynamicRaceCP(0, -1966.5742,1104.3687,55.0706, -1884.3412,1053.7308,44.8704, 10.0, -1, -1, playerid, 1000000.0);
return 1;
}
if(checkpointid == CP4)
{
DestroyDynamicRaceCP(CP4);
PlayerPlaySound(playerid,1053,0.0,0.0,0.0);
GameTextForPlayer(playerid, "~r~5/8", 5000, 3);
CP5 = CreateDynamicRaceCP(0, -1884.3412,1053.7308,44.8704, -1902.6556,924.7991,34.5872, 10.0, -1, -1, playerid, 1000000.0);
return 1;
}
if(checkpointid == CP5)
{
DestroyDynamicRaceCP(CP5);
PlayerPlaySound(playerid,1053,0.0,0.0,0.0);
GameTextForPlayer(playerid, "~r~6/8", 5000, 3);
CP6 = CreateDynamicRaceCP(0, -1902.6556,924.7991,34.5872, -1984.4913,941.0320,45.0158, 10.0, -1, -1, playerid, 1000000.0);
return 1;
}
if(checkpointid == CP6)
{
DestroyDynamicRaceCP(CP6);
PlayerPlaySound(playerid,1053,0.0,0.0,0.0);
GameTextForPlayer(playerid, "~r~7/8", 5000, 3);
CP7 = CreateDynamicRaceCP(0, -1984.4913,941.0320,45.0158, -1884.3412,1053.7308,44.8704,10.0, -1, -1, playerid, 1000000.0);
return 1;
}
if(checkpointid == CP7)
{
DestroyDynamicRaceCP(CP7);
GameTextForPlayer(playerid,"You Won The Race",5000,3);
PlayerPlaySound(playerid,1052,0.0,0.0,0.0);
return 1;
}
}
return 1;
}
So, the problem is. when player use a command. the first cp will be show. as you see in the second pawn code.
and when player enter first cp (CP0) second cp will be show ! but when player enter second cp (CP1) the race checkpoint not destroy and will be stay.
like not destroy and player stay on that, every Second will be delete and show. i don't know how to Explanation.but
Not Work !.