Problem mit RandomCP's

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
  • Tag Leute,
    ich wollte für meinen RL Server einen Job einbauen(Post).
    Dafür habe ich mir dann Koordinaten rausgesucht und gespeichert.
    Dann habe ich es so gemacht:
    //-----CONTAINER-----//
    new Post_CPS_TMONEY[][1]=
    {
    {5},
    {10},
    {15},
    {20},
    {25},
    {30},
    {35},
    {40},
    {45},
    {50}
    };
    new Post_CPS_MONEY[12][1]=
    {
    {300},
    {275},
    {250},
    {225},
    {200},
    {175},
    {150},
    {125},
    {100},
    {75},
    {50},
    {25}
    };
    new Float:Post_CPS[97][3]=
    {
    {-2438.0481,1140.9764,55.7266},
    {-1915.5581,1189.8358,45.4453},
    {-1659.3951,1368.9312,7.1722},
    {-1691.5985,1367.4069,7.1797},
    {-2152.7190,1249.1903,25.6959},
    {1111.4575,-974.6480,42.7656},
    {1227.4785,-1017.3041,36.3359},
    {1189.4508,-1011.3931,32.5469},
    {1141.9579,-1069.6278,31.7656},
    {785.1894,-1435.8190,13.5469},
    {813.5455,-1456.6952,14.1603},
    {772.1112,-1511.2312,13.5469},
    {693.2756,-1602.7585,15.0469},
    {656.4202,-1635.8872,15.8617},
    {315.6073,-1770.3557,4.6514},
    {263.8965,-1765.9746,4.7558},
    {168.4735,-1768.4110,4.4875},
    {192.2639,-1769.7361,4.3148},
    {776.4816,-1036.6438,24.2722},
    {1246.6077,-909.4555,46.6016},
    {1242.9791,-879.0223,42.8753},
    {1287.5052,-867.5288,46.8361},
    {1284.2279,-897.0466,42.8753},
    {1468.4846,-904.9361,54.8359},
    {1539.9172,-851.4675,64.3361},
    {1497.0217,-688.6494,95.3254},
    {1280.2489,-814.4827,83.7707},
    {1093.9806,-807.0804,107.4190},
    {828.0313,-858.7499,70.3308},
    {553.0963,-1200.2129,44.8315},
    {252.0162,-1220.6615,75.8889},
    {-265.9600,-2213.5513,29.0420},
    {-2053.0920,-2544.4756,31.0668},
    {-2081.3433,-2548.0850,30.6250},
    {-2075.2422,-2526.3726,31.0668},
    {-2134.6414,-2504.4353,31.8163},
    {-2220.0383,-2400.3484,32.5823},
    {-2224.3069,-2481.9065,31.8163},
    {-2180.4209,-2258.9512,33.3203},
    {-2199.3091,-2243.7239,33.3203},
    {-2505.0313,-665.8595,139.3203},
    {-2505.2429,-676.5744,139.3203},
    {-2514.6436,-171.3743,25.1317},
    {-2558.6062,-119.7054,10.8958},
    {-2619.7998,-134.5801,4.7925},
    {-2621.0627,-198.0241,4.3359},
    {-2620.8257,102.8433,7.2031},
    {-2624.5798,733.1963,28.1287},
    {-2640.2991,730.4122,30.0757},
    {-2640.9497,935.4998,71.9531},
    {-2661.6431,876.3749,79.7738},
    {-2721.1941,924.9036,67.5938},
    {-2710.8567,968.4779,54.4609},
    {-2451.2466,1141.2861,55.7333},
    {-2523.5349,2239.6941,5.3627},
    {-2582.6128,2307.7163,7.0029},
    {-2582.3667,2300.6079,7.0029},
    {-2634.6636,2401.6855,11.2203},
    {-1479.1107,2546.4810,56.2543},
    {-1445.1365,2652.8430,56.2699},
    {-1458.1737,2653.5413,55.8359},
    {-910.7388,2686.9607,42.3703},
    {-278.9425,2722.3972,62.5030},
    {-275.1135,2735.6455,62.7543},
    {-169.6920,2707.1245,62.5245},
    {-150.3621,2688.5015,62.4297},
    {1223.7539,2616.8123,10.8203},
    {1284.8690,2609.8174,10.8203},
    {1800.9994,2638.3274,10.8203},
    {2544.7124,2213.2659,14.1161},
    {2579.7512,2213.4524,14.1161},
    {2787.9993,2261.0935,14.6615},
    {2794.6636,2222.5901,10.8203},
    {2534.1084,997.9191,14.2725},
    {2532.2888,749.8929,14.7396},
    {2526.4907,742.7042,10.8203},
    {2578.3396,719.8706,10.8203},
    {2571.7461,713.1672,14.7396},
    {2347.2576,692.8940,11.4609},
    {2368.2065,691.1781,11.4605},
    {2362.8835,736.0402,11.4609},
    {1845.7440,690.1196,11.4531},
    {1844.7404,718.8307,11.4683},
    {1931.6866,664.8736,10.8203},
    {1955.2577,670.8901,10.8203},
    {1956.1293,715.1597,10.8203},
    {1956.1990,731.4802,14.2811},
    {1943.3383,742.0002,14.2734},
    {1294.8531,174.7634,20.9106},
    {1283.8381,158.7334,20.7934},
    {313.3469,-121.4461,3.5354},
    {374.2791,-77.6480,1.3828},
    {271.5083,-49.4927,2.7772},
    {744.9005,-555.1354,18.0129},
    {743.2955,-510.4850,18.0129},
    {776.2691,-504.5086,18.0129},
    {795.0171,-492.4357,18.0133}
    };


    Und beim Job:
    SetPlayerCheckpoint(playerid,Post_CPS[random(sizeof(Post_CPS))][0],Post_CPS[random(sizeof(Post_CPS))][1],Post_CPS[random(sizeof(Post_CPS))][2],5);


    Beim Enter dann:
    new amoney[150];
    new atmoney[150];
    new money=GivePlayerMoney(playerid,Post_CPS_MONEY[random(sizeof(Post_CPS_MONEY))][0]);
    new tmoney=GivePlayerMoney(playerid,Post_CPS_TMONEY[random(sizeof(Post_CPS_TMONEY))][0]);
    format(amoney,sizeof(amoney),"Du hast %i$ für das Paket erhalten!",money);
    format(atmoney,sizeof(atmoney),"Du hast %i$ Trinkgeld erhalten!",tmoney);
    SendClientMessage(playerid,GREEN,amoney);
    SendClientMessage(playerid,GREEN,atmoney);
    DisablePlayerCheckpoint(playerid);
    SetPlayerCheckpoint(playerid,Post_CPS[random(sizeof(Post_CPS))][0],Post_CPS[random(sizeof(Post_CPS))][1],Post_CPS[random(sizeof(Post_CPS))][2],5);


    Und beim Job beenden dann:
    DisablePlayerCheckpoint(playerid);


    Mein Problem ist nun, das die CP Koordninaten alle durcheinander geraten, das heißt das die Y Werte zum Beispiel garnicht zu dem CP gehören und manche dadurch in der Wüste oder im Wasser liegen :-x
    Zudem wird bei der ClientMessage nicht der richtige Wert angezeigt, sondern oft mal du hast 1$ und 1$ Trinkgeld erhalten, obwohl dies garnicht möglich ist, da diese Werte garnicht oben im Container drinne sind.


    Ich hoffe mir kann jemand helfen.
    Gruß,
    Nicorotom

    Einmal editiert, zuletzt von Nicorotom ()


  • new rand =random(sizeof(Post_CPS));
    SetPlayerCheckpoint(playerid,Post_CPS[rand][0],Post_CPS[rand][1],Post_CPS[rand][2],5);


    das wars auch scohn xD


    have fun! :thumbup:

    I'm Sorry For Your Mistake!
    but it's yours

  • Danke das funzt schonmal.
    Habe nun noch das Problem mit der ClientMessage.
    Habe es nun so versucht:
    new randompost=random(sizeof(Post_CPS));
    new randommoney=random(sizeof(Post_CPS_MONEY));
    new randomtmoney=random(sizeof(Post_CPS_TMONEY));
    new amoney[150];
    new atmoney[150];
    GivePlayerMoney(playerid,Post_CPS_MONEY[randommoney][0]);
    GivePlayerMoney(playerid,Post_CPS_TMONEY[randomtmoney][0]);
    format(amoney,sizeof(amoney),"Du hast %i$ für das Paket erhalten!",randommoney);
    format(atmoney,sizeof(atmoney),"Du hast %i$ Trinkgeld erhalten!",randomtmoney);
    SendClientMessage(playerid,GREEN,amoney);
    SendClientMessage(playerid,GREEN,atmoney);
    DisablePlayerCheckpoint(playerid);
    SetPlayerCheckpoint(playerid,Post_CPS[randompost][0],Post_CPS[randompost][1],Post_CPS[randompost][2],2);


    Allerdings sendet der immernoch nicht den richtigen Betrag :-x

    2 Mal editiert, zuletzt von Nicorotom ()