31.08.2014, 17:05
Quote:
the code was basically similiar to this, Lordzy:
pawn Код:
|
pawn Код:
if(newkeys & KEY_LEFT) {
if(v_showroom_timer != -1) return 0; //In case if the timer is on; mainly to avoid spam.
//I'm not going to suddenly create another vehicle, but giving it some time.
v_showroom_timer = SetTimerEx("LCreateVehicle", 200, false, "d", GetVehicleModel(showroom_car_id)-1);
DestroyVehicle(showroom_car_id); //showroom_car_id = example vehicle ID
}
else if(newkeys & KEY_RIGHT) {
if(v_showroom_timer != -1) return 0; //In case if the timer is on; mainly to avoid spam.
v_showroom_timer = SetTimerEx("LCreateVehicle", 200, false, "d", GetVehicleModel(showroom_car_id)+1);
DestroyVehicle(showroom_car_id);
}
public LCreateVehicle(modelid) {
if(modelid < 400)
modelid = 611;
else if(modelid > 611)
modelid = 400;
showroom_car_id = CreateVehicle(modelid, x_pos, y_pos, z_pos, rotation, col1, col2, -1);
v_showroom_timer = -1; //Resetting the variable then.
return 1;
}