SA-MP Forums Archive
(+REP For Help) Race Checkpoint [Streamer] - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: (+REP For Help) Race Checkpoint [Streamer] (/showthread.php?tid=545290)



(+REP For Help) Race Checkpoint [Streamer] - M0HAMMAD - 07.11.2014

if someone help me, i will be give hem +REP
hi guys :X
I created my auto race in server but there is a problem (bug).
Code:
pawn Код:
new CP0;
new CP1;
new CP2;
new CP3;
new CP4;
new CP5;
new CP6;
new CP7;
pawn Код:
CP0 = CreateDynamicRaceCP(0, -2018.7242,924.6336,45.1436, -2087.2236,930.4537,68.7196, 10.0, -1, -1, playerid, 1000000.0);// in the command
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 will be destroy and create. 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


Re: (+REP For Help) Race Checkpoint [Streamer] - 0x41726d79 - 07.11.2014

convert the variables for player variabile:

ex

pawn Код:
if(checkpointid == CP0 [ playerid ] )
        {
            DestroyDynamicRaceCP(CP0 [ playerid ]);
            GameTextForPlayer(playerid, "~r~1/8", 5000, 3);
            PlayerPlaySound(playerid,1053,0.0,0.0,0.0);
            CP1 [ playerid ] = CreateDynamicRaceCP(0, -2087.2236,930.4537,68.7196, -2142.8618,919.0911,79.4255, 10.0, -1, -1, playerid, 1000000.0);
            return 1;
        }
and you can check script with debug.


Re: (+REP For Help) Race Checkpoint [Streamer] - M0HAMMAD - 07.11.2014

Quote:
Originally Posted by 0x41726d79
Посмотреть сообщение
convert the variables for player variabile:

ex

pawn Код:
if(checkpointid == CP0 [ playerid ] )
        {
            DestroyDynamicRaceCP(CP0 [ playerid ]);
            GameTextForPlayer(playerid, "~r~1/8", 5000, 3);
            PlayerPlaySound(playerid,1053,0.0,0.0,0.0);
            CP1 [ playerid ] = CreateDynamicRaceCP(0, -2087.2236,930.4537,68.7196, -2142.8618,919.0911,79.4255, 10.0, -1, -1, playerid, 1000000.0);
            return 1;
        }
and you can check script with debug.
i do that but when player enter first cp will it's done race it's like he entered CP7[playerid]


Re: (+REP For Help) Race Checkpoint [Streamer] - M0HAMMAD - 08.11.2014

Up...


Re: (+REP For Help) Race Checkpoint [Streamer] - DavidBilla - 08.11.2014

Well
From what i understand, when a player enters checkpoint it disappears only for that player and it shows him second checkpoint, but for other players the first checkpoint will still be visible.
Is that what you want?


Re: (+REP For Help) Race Checkpoint [Streamer] - M0HAMMAD - 08.11.2014

Quote:
Originally Posted by DavidBilla
Посмотреть сообщение
Well
From what i understand, when a player enters checkpoint it disappears only for that player and it shows him second checkpoint, but for other players the first checkpoint will still be visible.
Is that what you want?
no, it's about all players.
when a player enter first checkpoint, that checkpoint will be destroy and second checkpoint will be show.
but when player enter second checkpoint, second checkpoint will destroy and show again. this checkpoint will be destroy,show,destroy,show ... .it's like repeating second checkpoint.