SA-MP Forums Archive
Random checkpoints - 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: Random checkpoints (/showthread.php?tid=292288)



Random checkpoints - Madsen - 23.10.2011

so i want to make random checkpoints, but i do not know how to save the location of the random checkpoint here is what i got so far

pawn Код:
new Float:locesc[][3] =
{
    {1429.0435,-1872.7736,13.1115},
    {1935.4012,-1773.3212,13.1099},
    {1961.9923,-2188.9326,13.2740},
    {2676.4375,-2502.9500,13.2783},
    {2222.2273,-1339.5552,23.7110},
    {2727.4810,-1259.9392,59.2934},
    {2170.8638,-1004.4625,62.5303},
    {1639.8905,-1169.4454,55.4806},
    {1297.7617,-1570.0330,13.1100},
    {839.8412,-1610.1801,13.1112},
    {371.1917,-1646.8229,32.4500},
    {524.4382,-1421.0612,15.6804},
    {1058.3478,-1329.7805,13.1099},
    {1372.9076,-942.0881,33.9146},
    {1337.7911,-2458.1152,7.5310}
};

Onplayeentercheckpoint

if (IsPlayerInRangeOfPoint(playerid, 12, 1027.8938,-1038.5903,31.0843)) // checkpoint 1 escaper
        {
            new pointesc = random(sizeof(locesc));
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid, locesc[pointesc][0], locesc[pointesc][1],locesc [pointesc][2], 12);
        }



Re: Random checkpoints - Zonoya - 23.10.2011

looks about right to me Madsen are there any problems?


Re: Random checkpoints - Madsen - 23.10.2011

Quote:
Originally Posted by Zonoya
Посмотреть сообщение
looks about right to me Madsen are there any problems?
creating the checkpoint is easy and works fine. but how can i enter the checkpoint when i have created it like that?


Re: Random checkpoints - Madsen - 30.10.2011

bumb(week ago)


Re: Random checkpoints - Madsen - 05.11.2011

i have changed it a bit under OnPlayerEnterCheckpoint.
pawn Код:
new escapertest[MAX_PLAYERS];
        new pointesc = random(sizeof(locesc));
        if (IsPlayerInRangeOfPoint(playerid, 12, 79.8441, -1531.5741, 2413.0000)) //offroadmap fix
        {
            SetVehiclePos(vehicleid, 383.7876, -1602.9878, 2553.0000+2);
            SetVehicleZAngle(vehicleid, 307.0482);
            DisablePlayerCheckpoint(playerid);
        }
        if (IsPlayerInRangeOfPoint(playerid, 12, 1027.8938,-1038.5903,31.0843)) // checkpoint 1 escaper
        {
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid, locesc[pointesc][0], locesc[pointesc][1],locesc [pointesc][2], 12);
            escapertest[playerid] = 1;
        }
       
        if (escapertest[playerid] == 1) // checkpoint 2 escaper
        {
            DisablePlayerCheckpoint(playerid);
            SetPlayerCheckpoint(playerid, locesc[pointesc][0], locesc[pointesc][1],locesc [pointesc][2], 12);
        }



Re: Random checkpoints - MP2 - 06.11.2011

Why are you using IsPlayerInRangeOfPoint? Use variables?


Re: Random checkpoints - Madsen - 06.11.2011

Quote:
Originally Posted by MP2
Посмотреть сообщение
Why are you using IsPlayerInRangeOfPoint? Use variables?
i actually tried with that but it does not work
pawn Код:
new escapertest[MAX_PLAYERS];
        new pointesc = random(sizeof(locesc));
       
        if (IsPlayerInRangeOfPoint(playerid, 12, 1027.8938,-1038.5903,31.0843)) // checkpoint 1 escaper
        {
            DisablePlayerCheckpoint(playerid);
            escapertest = SetPlayerCheckpoint(playerid, locesc[pointesc][0], locesc[pointesc][1],locesc [pointesc][2], 12);
        }
        if (escapertest) // checkpoint 2 escaper
        {
            DisablePlayerCheckpoint(playerid);
            SendClientMessage(playerid,COLOR_GREEN,"it worked");
        }
I get the message "it worked" on the checkpoint above..