31.08.2011, 15:35
Try using if and else if
Something like this
On the top of your script
And at OnPlayerKeyStateChange you can do something like
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;
}
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;
}