Displaying Text from an Array?
#1

Hi guys and I'm stuck with something... I just dont know how to do it say the PizzaRoute text doesn't show randomly... when i enter the specific random checkpoint it gives me, i want it to display the route name set in the array... but RandomPizza[rand][PizzaRoute]; just displays one of the routes at random, it isn't specific to those co-ords. Anyone? Would really appreciate it

So, here's my code, my Array, OnPlayerEnterCheckpoint, and my commands
Array

pawn Код:
new Float:RandomPizza[][pRandomPizza] =
{
    {1, "1st Grove Street have ordered a pizza, deliver it!", 2518.1140,-1671.5006,14.1522, 52},
    {2, "25th Grove Street have ordered a pizza, deliver it!", 2281.3716,-1647.2424,15.2126, 55},
    {3, "42nd Harwood Avenue have ordered a pizza, deliver it!", 2518.2646,-1673.5457,14.2398, 60},
    {4, "23 Lingle Land have ordered a pizza, deliver it!", 2281.3184,-1646.0638,15.2346, 70},
    {5, "112 Foxwood Stret have ordered a pizza, deliver it!", 2144.1565,-1687.3113,15.0859, 75},
    {6, "1st Beach Avenue have ordered a pizza, deliver it!", 2004.0918,-1597.6462,13.5707, 82},
    {7, "2nd Beach Avenue have ordered a pizza, deliver it!", 1910.0042,-1601.4474,13.5495, 89},
    {8, "3rd Beach Avenue have ordered a pizza, deliver it!", 305.4549,-1771.0791,4.5385, 71},
    {9, "1st Vinewood Avenue have ordered a pizza, deliver it!", 230.3020,-1769.8105,4.4607, 120},
    {10, "2nd Vinewood Avenue have ordered a pizza, deliver it!", 206.2525,-1770.7755,4.3215, 122},
    {11, "3rd Vinewood Avenue have ordered a pizza, deliver it!", 146.3418,-1463.4011,25.8743, 124},
    {12, "4th Vinewood Avenue have ordered a pizza, deliver it!", 162.8660,-1436.8154,36.7348, 126},
    {13, "17th Vinewood Avenue have ordered a pizza, deliver it!", 220.1526,-1394.8793,51.5926, 137},
    {14, "27th Vinewood Avenue have ordered a pizza, deliver it!", 193.8189,-1308.7412,70.2478, 140},
    {15, "30 HillRoad Lane have ordered a pizza, deliver it!", 253.9261,-1223.4774,75.0592, 140},
    {16, "30 Vinewood Avenue have ordered a pizza, deliver it!", 276.4745,-1266.4725,73.9453, 143},
    {17, "23rd Alpha Close have ordered a pizza, deliver it!", 299.1823,-1157.2172,80.9099, 123},
    {18, "52 Highway Street have ordered a pizza, deliver it!", 1396.9774,-1386.8838,13.5547, 174},
    {19, "55 Highway Street have ordered a pizza, deliver it!", 1184.3090,-1263.8997,15.1797, 182},
    {20, "LS Ammunation have ordered a pizza, deliver it!", 1364.0483,-1279.8840,13.5469, 200},
    {21, "82 Vinewood Avenue have ordered a pizza, deliver it!", 1528.4548,-813.4754,71.7887, 213},
    {22, "12 Rockway Lane have ordered a pizza, deliver it!", 744.2677,-550.4037,17.1396, 250}
   
};
Command:

pawn Код:
stock PizzaBoy(playerid)
{
    if(!IsPlayerInVehicle(playerid, pizzabike)) return SendClientMessage(playerid, COLOR_GREY, "You're not on a Pizza Delivery Bike!"); //change
    new string[128];
    new rand = random(sizeof(RandomPizza));
    new Float:x, Float:y, Float:z;
    x = RandomPizza[rand][PizzaX];
    y = RandomPizza[rand][PizzaY];
    z = RandomPizza[rand][PizzaZ];
    pizzapay[playerid] = RandomPizza[rand][pizzamoney];
    PizzaCP1[playerid] = CreateDynamicCP(x, y, z, 1.0, 0, 0,playerid, 999999999.0);
    TogglePlayerControllable(playerid, 1);
    format(string, sizeof(string), "%s", RandomPizza[rand][PizzaRoute]);
    SendClientMessage(playerid, COLOR_GREY, string);
    return 1;
}
Checkpoint Enter

pawn Код:
stock CheckpointEntered(playerid)
{
    new string[128];
    new rand = random(sizeof(RandomPizza));
    if(JobStatus[playerid] == 1) // pizza deliver.
    {
        DestroyDynamicCP(PizzaCP1[playerid]);
        PizzaPlace[playerid] = CreateDynamicCP(2097.1772,-1806.7275,13.5533, 1.0, 0,0, playerid, 999999999.0);
        SetTimerEx("PizzaLoad", 5000, false, "i", playerid);
        TogglePlayerControllable(playerid, 0);
        GameTextForPlayer(playerid, "~g~ Delivering Pizza...", 5, 1); //for you to change
        JobStatus[playerid] = 2;
    }
    else if(JobStatus[playerid] == 2) // pizza return
    {
        DestroyDynamicCP(PizzaPlace[playerid]);
        GivePlayerMoney(playerid, pizzapay[playerid]);
        format(string, 512, "You have completed the job: %s Earning: %d. Would you like another?", RandomPizza[rand][PizzaRoute], pizzapay[playerid]);
        ShowPlayerDialog(playerid, DIALOG_PIZZADONE, DIALOG_STYLE_MSGBOX, "Well Done:", string, "Yes", "No");
        format(string,512, "You earned %d for completing route %s", pizzapay[playerid], RandomPizza[rand][PizzaRoute]);
        SendClientMessage(playerid, COLOR_GREY, string);
        JobStatus[playerid] = 0;
        TogglePlayerControllable(playerid, 0);
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)