Pickup Issues.
#1

I have a tutorial which uses a series of pickups to determine what the user has to do to complete it, this system works except for one major flaw. The vehicle spawns on EVERY pickup that the user picks up inside the tutorial.

Here's the code:
pawn Код:
// TUTORIAL PICKUPS
    if(pickupid == tutorialpickup[playerid][0])
    {
        // Vehicle Interaction
        SendClientMessage(playerid, 0xFFFFFFFF, " ");
        SendClientMessage(playerid, 0xFFCC9999, "Tutorial #1: Vehicle interaction.");
        SendClientMessage(playerid, 0xFFCC9999, "To interact with vehicles, walk up beside one or get into one and press 'Y' or type '/vinteract'.");
        tutorialvehicle[playerid] = CreateVehicle(405, -2706.7336, 349.0867, 4.1325, 1.1084, 0, 0, -1);
        SetVehicleVirtualWorld(tutorialvehicle[playerid], playerid+100);
        SetVehicleParamsEx(tutorialvehicle[playerid], 0, 0, 0, 0, 0, 0, 0);
        SendClientMessage(playerid, 0xFFCC9999, "To interact with the lights and engine you can use: /eon, /eoff, /lon and /loff.");
        SendClientMessage(playerid, 0xFFCC9999, "To finish the tutorial you must break the window of the vehicle.");
    }
    if(pickupid == tutorialpickup[playerid][1])
    {
        // Basic Role-Play
        SendClientMessage(playerid, 0xFFFFFFFF, " ");
        SendClientMessage(playerid, 0xFFCC9999, "Tutorial #2: Basic Role-play.");
        SendClientMessage(playerid, 0xFFCC9999, "There are several commands that you can use to enhance roleplay, these are: /me and /do");
        SendClientMessage(playerid, 0xFFCC9999, "You can also try: /accent and /description to help describe your character.");
        SendClientMessage(playerid, 0xFFCC9999, "Here are some examples:");
        SendClientMessage(playerid, 0xC2A2DAAA, "Ben Karner holds his hand on the back of his neck, rolling his neck across his shoulders.");
        SendClientMessage(playerid, 0xC2A2DAAA, "You would hear a quiet cracking sound. ((Ben Karner))");
    }
    if(pickupid == tutorialpickup[playerid][2])
    {
        // Roleplaying Injuries
        SendClientMessage(playerid, 0xFFFFFFFF, " ");
        SendClientMessage(playerid, 0xFFCC9999, "Tutorial #3: Role-playing Injuries.");
        SendClientMessage(playerid, 0xFFCC9999, "Throughout your time in SF-RP you are bound to be shot, stabbed, punched and you might even fall over.");
        SendClientMessage(playerid, 0xFFCC9999, "During these occasions and others that would cause halm to your character you must RP injuries.");
        SendClientMessage(playerid, 0xFFCC9999, "You can do this by using /me's, /do's and animations.");
        TutInjuriesTimer[playerid] = SetTimerEx("TutorialInjuries", 3000, false, "i", playerid);
    }
    if(pickupid == tutorialpickup[playerid][3])
    {
        // Weapons
    }
    if(pickupid == tutorialpickup[playerid][4])
    {
        // Sidejobs
    }
Here's the code that the user needs to continue.
pawn Код:
// TUTORIAL
command(continue, playerid, params[])
{
    if(loggedin[playerid] == 0) return SendClientMessage(playerid, 0x66666666, "You must be logged in perform commands");
    if(pInTutorial[playerid] == 0) return SendClientMessage(playerid, 0x66666666, "You are not in the tutorial.");
    switch(tutorialsdone[playerid])
    {
        case 0:
        {
            SendClientMessage(playerid, 0x66666666, "You must meet the requirements for the tutorial.");
        }
        case 1:
        {
            DestroyVehicle(tutorialvehicle[playerid]);
            ResetVVar(tutorialvehicle[playerid]);
            SendClientMessage(playerid, 0xFFCC9999, "Thank you for finishing this part of the tutorial, please find the next pickup.");
            DestroyPickup(tutorialpickup[playerid][0]);
            tutorialpickup[playerid][1] = CreatePickup(1239, 8, -2706.5, 394.4166, 4.3672, playerid+100);
            RemovePlayerMapIcon(playerid, pTutorialMarker[playerid]);
            SetPlayerMapIcon(playerid, pTutorialMarker[playerid], -2706.5, 394.4166, 4.3672, 0, 0xFFCC9999, MAPICON_GLOBAL);
        }
        case 2:
        {
            DestroyPickup(tutorialpickup[playerid][1]);
            SendClientMessage(playerid, 0xFFCC9999, "Thank you for finishing this part of the tutorial, please find the next pickup.");
            tutorialpickup[playerid][2] = CreatePickup(1239, 8, -2685.5, 382.2196, 4.3672, playerid+100);
            RemovePlayerMapIcon(playerid, pTutorialMarker[playerid]);
            SetPlayerMapIcon(playerid, pTutorialMarker[playerid], -2685.5, 382.2196, 4.3672, 0, 0xFFCC9999, MAPICON_GLOBAL);
        }
        case 3:
        {
            DestroyPickup(tutorialpickup[playerid][2]);
            SendClientMessage(playerid, 0xFFCC9999, "Thank you for finishing this part of the tutorial, please find the next pickup.");
            tutorialpickup[playerid][3] = CreatePickup(1239, 8, -2685.5, 368.2350, 4.3964, playerid+100);
            RemovePlayerMapIcon(playerid, pTutorialMarker[playerid]);
            SetPlayerMapIcon(playerid, pTutorialMarker[playerid], -2685.5, 368.2350, 4.3964, 0, 0xFFCC9999, MAPICON_GLOBAL);
        }
        case 4:
        {
            DestroyPickup(tutorialpickup[playerid][3]);
            SendClientMessage(playerid, 0xFFCC9999, "Thank you for finishing this part of the tutorial, please find the next pickup.");
            tutorialpickup[playerid][4] = CreatePickup(1239, 8, -2722.25, 368.0362, 4.3970, playerid+100);
            RemovePlayerMapIcon(playerid, pTutorialMarker[playerid]);
            SetPlayerMapIcon(playerid, pTutorialMarker[playerid], -2722.25, 368.0362, 4.3970, 0, 0xFFCC9999, MAPICON_GLOBAL);
        }
        case 5:
        {
            DestroyPickup(tutorialpickup[playerid][4]);
            SendClientMessage(playerid, 0xFFCC9999, "Thank you for finishing the entire tutorial, you will be teleported to the main world.");
            SendClientMessage(playerid, 0xFFCC9999, "Where you can start role-playing, we wish you the best of luck, have fun.");
            RemovePlayerMapIcon(playerid, pTutorialMarker[playerid]);
        }
    }
    return 1;
}
// END OF TUTORIAL
So, as you can see the pickups are being deleted as and when the user doesn't need them anymore.

Any ideas why the car keeps respawning?
Reply
#2

Try this..:

pawn Код:
// TUTORIAL PICKUPS
    if(pickupid == tutorialpickup[playerid][0])
    {
        // Vehicle Interaction
        SendClientMessage(playerid, 0xFFFFFFFF, " ");
        SendClientMessage(playerid, 0xFFCC9999, "Tutorial #1: Vehicle interaction.");
        SendClientMessage(playerid, 0xFFCC9999, "To interact with vehicles, walk up beside one or get into one and press 'Y' or type '/vinteract'.");
        tutorialvehicle[playerid] = CreateVehicle(405, -2706.7336, 349.0867, 4.1325, 1.1084, 0, 0, -1);
        SetVehicleVirtualWorld(tutorialvehicle[playerid], playerid+100);
        SetVehicleParamsEx(tutorialvehicle[playerid], 0, 0, 0, 0, 0, 0, 0);
        SendClientMessage(playerid, 0xFFCC9999, "To interact with the lights and engine you can use: /eon, /eoff, /lon and /loff.");
        SendClientMessage(playerid, 0xFFCC9999, "To finish the tutorial you must break the window of the vehicle.");
        return 1;
    }
    if(pickupid == tutorialpickup[playerid][1])
    {
        // Basic Role-Play
        SendClientMessage(playerid, 0xFFFFFFFF, " ");
        SendClientMessage(playerid, 0xFFCC9999, "Tutorial #2: Basic Role-play.");
        SendClientMessage(playerid, 0xFFCC9999, "There are several commands that you can use to enhance roleplay, these are: /me and /do");
        SendClientMessage(playerid, 0xFFCC9999, "You can also try: /accent and /description to help describe your character.");
        SendClientMessage(playerid, 0xFFCC9999, "Here are some examples:");
        SendClientMessage(playerid, 0xC2A2DAAA, "Ben Karner holds his hand on the back of his neck, rolling his neck across his shoulders.");
        SendClientMessage(playerid, 0xC2A2DAAA, "You would hear a quiet cracking sound. ((Ben Karner))");
        return 1;
    }
    if(pickupid == tutorialpickup[playerid][2])
    {
        // Roleplaying Injuries
        SendClientMessage(playerid, 0xFFFFFFFF, " ");
        SendClientMessage(playerid, 0xFFCC9999, "Tutorial #3: Role-playing Injuries.");
        SendClientMessage(playerid, 0xFFCC9999, "Throughout your time in SF-RP you are bound to be shot, stabbed, punched and you might even fall over.");
        SendClientMessage(playerid, 0xFFCC9999, "During these occasions and others that would cause halm to your character you must RP injuries.");
        SendClientMessage(playerid, 0xFFCC9999, "You can do this by using /me's, /do's and animations.");
        TutInjuriesTimer[playerid] = SetTimerEx("TutorialInjuries", 3000, false, "i", playerid);
        return 1;
    }
    if(pickupid == tutorialpickup[playerid][3])
    {
        // Weapons
        return 1;
    }
    if(pickupid == tutorialpickup[playerid][4])
    {
        // Sidejobs
        return 1;
    }
Reply
#3

No, didn't work, it still calls back the code for:

if(pickupid == tutorialpickup[playerid][0])

when

tutorialpickup[playerid][1] is picked up.
Reply
#4

And where do you change tutorialsdone[playerid] to some value?
Reply
#5

pawn Код:
if(vwindowsdown[VehicleID] == 0)
                    {
                        vwindowsdown[VehicleID] = 2;
                        new Name[MAX_PLAYER_NAME], string[128];
                        GetPlayerName(playerid, Name, sizeof(Name));
                        format(string, sizeof(string), "* %s folds his arm up to his neck, holding his arm and swinging his elbow towards the car window. *", RemoveUnderScore(playerid));
                        ProxDetector(10.0, playerid, string, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA, 0xC2A2DAAA);
                        if(VehicleID == tutorialvehicle[playerid])
                        {
                            tutorialsdone[playerid]++;
                            SendClientMessage(playerid, 0xFFCC9999, "Congratulations on learning the basics of /vinteract.");
                            SendClientMessage(playerid, 0xFFCC9999, "Please continue to use /vinteract, when you are finished type: /continue.");
                            SendClientMessage(playerid, 0xFFFFFFFF, " ");
                        }
                        return 1;
                    }
                    if(vwindowsdown[VehicleID] == 1)
                    {
                        SendClientMessage(playerid, 0x66666666, "The window is down.");
                        return 1;
                    }
                    if(vwindowsdown[VehicleID] == 2)
                    {
                        SendClientMessage(playerid, 0x66666666, "The window is already smashed.");
                        return 1;
                    }
There's the snippet. If you need more of it, let me know.
Reply
#6

Anyone had any luck? Any change I make seems to make it worse. I'm deleting the pickups so It shouldn't even be calling the code for picking up a pickup that doesn't exist.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)