Vehicle Selection
#1

Hello, i need help on something here .. I'm trying to make an vehicle selector.

Here's what i got so far:

pawn Код:
// The range of cars
new CarModels[7] = {
    562,
    400,
    402,
    424,
    426,
    603
};
// The function
function ShowCars(playerid)
{
PlayerInfo[playerid][CreatedCar] = CreateVehicle(PlayerInfo[playerid][ShowingCar], -     1953.5547,257.6832,40.7763,290.3900, Color, Color, 60*10000);
    LinkVehicleToInterior(PlayerInfo[playerid][CreatedCar], GetPlayerInterior(playerid));
    SetVehicleVirtualWorld(PlayerInfo[playerid][CreatedCar], GetPlayerVirtualWorld(playerid));
}

// OnPlayerKey callbck
if(PRESSED(KEY_ANALOG_LEFT))
    {
        SendInfoMessage(playerid, "Left");
        PlayerInfo[playerid][ShowingCar] = CarModels[PlayerInfo[playerid][ShowingCar]-1];
        ShowCars(playerid);
    }
    if(PRESSED(KEY_ANALOG_RIGHT))
    {
        SendInfoMessage(playerid, "Right");
        PlayerInfo[playerid][ShowingCar] = CarModels[PlayerInfo[playerid][ShowingCar]+1];
        ShowCars(playerid);
    }
I'm trying to make a Vehicle selection script, just like class selection but with vehicles, i been trying for days without any luck .. so i decided to try here

Thanks
Reply
#2

pawn Код:
if(PRESSED(KEY_ANALOG_LEFT))
    {
        SendInfoMessage(playerid, "Left");
        PlayerInfo[playerid][ShowingCar] = CarModels[PlayerInfo[playerid][ShowingCar]-1];
        ShowCars(playerid);
        return 1;
    }
    if(PRESSED(KEY_ANALOG_RIGHT))
    {
        SendInfoMessage(playerid, "Right");
        PlayerInfo[playerid][ShowingCar] = CarModels[PlayerInfo[playerid][ShowingCar]+1];
        ShowCars(playerid);
        return 1;
    }
Pretty unsure though, try.

Just to be sure, you know KEY_ANALOG_RIGHT and KEY_ANALOG_LEFT are num4 and num6 keys right?
Reply
#3

Quote:
Originally Posted by [XST]O_x
Посмотреть сообщение
Pretty unsure though, try.
- Thanks for trying, The problem isn't the keystrokes, the keys are being pressed as the message gets sent, but it just doesn't change model ..
Reply
#4

You sure you aint missing any brackets?
Reply
#5

Quote:
Originally Posted by Will77
Посмотреть сообщение
You sure you aint missing any brackets?
- Thanks, really this just wont work.....
Reply
#6

I once made something like this myself, but never finished.
I dno if it will help you any, but take a look at it:

http://pastebin.com/AkqtFhg7
Reply
#7

Quote:
Originally Posted by LarzI
Посмотреть сообщение
I once made something like this myself, but never finished.
I dno if it will help you any, but take a look at it:

http://pastebin.com/AkqtFhg7
Yeah lol, we came to the exact same place!
Reply
#8

Hmm, yeah I saw, but I think I figured it out..
Check it out yourself:

http://pastebin.com/jQ8n96W2
Reply
#9

Quote:
Originally Posted by LarzI
Посмотреть сообщение
Hmm, yeah I saw, but I think I figured it out..
Check it out yourself:

http://pastebin.com/jQ8n96W2
Yeah just a sec lol, struggling with "world boundries" without even setting them in the firstplace xD lol.
Reply
#10

Got it working now thanks for ideas!
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)