Random Checkpont will sich nich aufruften lassen :(

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • Hallo,
    ich hab ein random Checkpoint Sys. gemacht...
    aber sobald men im ersten Checkpoint drine ist, geht es nicht mehr weiter...


    Also mein CP:
    new Float:gRandomPlayerCP[45][3] = {
    {2364.4772949219, -1751.0255126953, 13.032037734985},
    {2291.4365234375, -1896.9169921875, 13.061582565308},
    {2291.7487792969, -1892.2996826172, 13.023300170898},
    {1935.8353271484, -1930.3823242188, 13.032037734985},
    {1890.3601074219, -1929.6978759766, 13.033489227295},
    {1944.2687988281, -1709.2122802734, 13.032037734985},
    {1944.8284912109, -1667.9130859375, 13.032037734985},
    {1944.4468994141, -1658.1247558594, 16.5530128479},
    {1936.4881591797, -1576.2615966797, 13.231058120728},
    {1819.9201660156, -1577.7873535156, 13.005800247192},
    {1803.2514648438, -1263.2023925781, 13.117975234985},
    {1609.4954833984, -1351.4642333984, 15.898483276367},
    {1712.8291015625, -1202.2996826172, 21.544691085815},
    {1712.6879882813, -1347.9342041016, 13.032037734985},
    {1751.0179443359, -1444.5291748047, 13.010147094727},
    {1989.5373535156, -1439.3624267578, 13.258422851563},
    {2131.271484375, -1408.9215087891, 23.485122680664},
    {2131.5563964844, -1446.6090087891, 23.477350234985},
    {2228.7746582031, -1298.1243896484, 23.469537734985},
    {2009.0532226563, -1263.1497802734, 23.469537734985},
    {2030.8240966797, -1295.4389648438, 20.576459884644},
    {1439.70703125, -1328.7415771484, 13.206150054932},
    {1365.306640625, -1655.1085205078, 13.032037734985},
    {1339.7796630859, -1768.7904052734, 13.184169769287},
    {1155.5731201172, -1744.1081542969, 13.047662734985},
    {983.68646240234, -1804.4989013672, 13.714994430542},
    {757.18048095703, -1748.3116455078, 12.128135681152},
    {755.94329833984, -1686.3442382813, 3.7031145095825},
    {754.29650878906, -1650.2410888672, 4.5493979454041},
    {858.83624267578, -1445.8765869141, 13.275415420532},
    {798.84088134766, -1349.3864746094, 13.032037734985},
    {738.10577392578, -1334.1674804688, 13.190357208252},
    {945.52032470703, -1237.6319580078, 16.072589874268},
    {1032.3974609375, -1042.3940429688, 31.195672988892},
    {952.76751708984, -918.27655029297, 44.575855255127},
    {915.80700683594, -997.16906738281, 37.778057098389},
    {592.32824707031, -1231.4736328125, 17.422758102417},
    {400.14025878906, -1250.2613525391, 51.665935516357},
    {415.77307128906, -1245.6508789063, 50.932460784912},
    {547.59112548828, -1195.5853271484, 44.149429321289},
    {620.41082763672, -1107.8244628906, 46.254905700684},
    {680.29614257813, -1060.2786865234, 49.13289642334},
    {666.29510498047, -1066.3829345703, 48.557609558105},
    {689.32592773438, -1027.3431396484, 50.891716003418},
    {1421.2938232422, -1350.1951904297, 13.217109680176}
    };


    Hier, wo ich es aufrufe:
    SetPlayerRandomCheckpoints(playerid);


    Und hier die erklärung zu SetPlayerRandomCheckpoints
    public SetPlayerRandomCheckpoints(playerid)
    {
    new rand = random(sizeof(gRandomPlayerCP));
    SetPlayerCheckpoint(playerid, gRandomPlayerCP[rand][0], gRandomPlayerCP[rand][1], gRandomPlayerCP[rand][2], 8.0);
    return 1;
    }


    Am schluss hab ich noch abgefragt ob der Spieler in diesen CP ist:
    public OnPlayerEnterCheckpoint(playerid)
    {
    new rand = random(sizeof(gRandomPlayerCP));
    if (IsPlayerInRangeOfPoint(playerid, 8.0,gRandomPlayerCP[rand][0], gRandomPlayerCP[rand][1], gRandomPlayerCP[rand][2]))
    {
    SetTimerEx("auf", 6000, 0, "is", playerid);
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~y~Bitte warten...",6000,3);
    TogglePlayerControllable(playerid, 1);
    PlayerPlaySound(playerid, 1056, 0.0, 0.0, 0.0);
    }
    return 1;
    }
    public auf(playerid)
    {
    TogglePlayerControllable(playerid, 0);
    new rand = random(sizeof(gRandomPlayerCP));
    SetPlayerCheckpoint(playerid, gRandomPlayerCP[rand][0], gRandomPlayerCP[rand][1], gRandomPlayerCP[rand][2], 8.0);
    return 1;
    }


    PS: Ich hab die forward's nicht mit rein geschrieben!


    Frage:
    Wieso geht es nicht weiter, wenn man in dem CP ist?


    Danke
    Mfg Pascal

    3 Mal editiert, zuletzt von iVirtual ()

  • wieso lässt du random nochmal durchlaufen kein wunder das es nich weiter geht das 2 random nimmt ne andere ID und du stehst im vohrrigen CP


    //edit mach es so


    ganz oben irgendwo

    new CPP[MAX_PLAYERS];



    public SetPlayerRandomCheckpoints(playerid)
    {
    CPP[playerid] = random(sizeof(gRandomPlayerCP));
    SetPlayerCheckpoint(playerid, gRandomPlayerCP[CPP[playerid]][0], gRandomPlayerCP[CPP[playerid]][1], gRandomPlayerCP[CPP[playerid]][2], 8.0);
    return 1;
    }




    public OnPlayerEnterCheckpoint(playerid)
    {


    if (CPP[playerid])
    {
    SetTimerEx("auf", 6000, 0, "i", playerid);
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~y~Bitte warten...",6000,3);
    TogglePlayerControllable(playerid, 1);
    PlayerPlaySound(playerid, 1056, 0.0, 0.0, 0.0);
    DisablePlayerCheckpoint(playerid);
    }
    return 1;
    }
    public auf(playerid)
    {
    TogglePlayerControllable(playerid, 0);
    CPP[playerid] = random(sizeof(gRandomPlayerCP));
    SetPlayerCheckpoint(playerid, gRandomPlayerCP[CPP[playerid]][0], gRandomPlayerCP[CPP[playerid]][1], gRandomPlayerCP[CPP[playerid]][2], 8.0);
    return 1;
    }

    RFT

    Einmal editiert, zuletzt von RFT ()