need help with carshop
#6

Try using if and else if

Something like this

On the top of your script

pawn Code:
#define LATEST_VEHID 3 // change this
new vehid = 0;
pawn Code:
if(!strcmp(cmdtext, "/pirmyn", true))
{
        DestroyVehicle(GetPlayerVehicleID(playerid));
        vehid++;
        if(vehid == 1)
        {
            CreateVehicle(400,-1954.6177,260.2105,35.5101,33.9648,0,0,-1);
        }
        else if(vehid == 2)
        {
            CreateVehicle(450,-1954.6177,260.2105,35.5101,33.9648,0,0,-1);
        }
        else if(vehid == 3)
        {
            CreateVehicle(511,-1954.6177,260.2105,35.5101,33.9648,0,0,-1);
        }
        return 1;
}
And at OnPlayerKeyStateChange you can do something like

pawn Code:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    new keys, ud, lr;
    GetPlayerKeys(playerid, keys, ud, lr);
    if(lr > 0)
    {
        vehid++;
    }
    else if(lr < 0)
    {
        if(vehid <= 0)
        {
            vehid = LATEST_VEHID;
        }
        else
        {
            vehid--;
        }
    }
    return 1;
}
Reply


Messages In This Thread
need help with carshop - by ancezas - 31.08.2011, 13:41
Re: need help with carshop - by TouR - 31.08.2011, 13:44
Re: need help with carshop - by ancezas - 31.08.2011, 14:55
Re: need help with carshop - by Pinguinn - 31.08.2011, 15:29
Re: need help with carshop - by ancezas - 31.08.2011, 15:32
Re: need help with carshop - by Pinguinn - 31.08.2011, 15:35

Forum Jump:


Users browsing this thread: 1 Guest(s)