[HELP] fuel set wrong
#1

Hello I was made fuel for vehicles and know when I turn gamemode nrg freeway etc.. is set to 40.0 L instead of 15.0 L if you know what I mean? Here's the code



pawn Code:
for(new o = 1; o < MAX_CARS; o++)
    {
        if(o != INVALID_VEHICLE_ID)
        {
            if(IsAPlane(GetVehicleModel(o)) || IsABoat(GetVehicleModel(o)) || IsABus(GetVehicleModel(o))) Fuel[o] = 80.00;
            else if(IsACar(GetVehicleModel(o))) Fuel[o] = 40.00;
            else if(IsAMotocycle(GetVehicleModel(o))) Fuel[o] = 15.00;
            else if(IsATruck(GetVehicleModel(o))) Fuel[o] = 100.00;
            else  Fuel[o] = 40.00;
        }
    }
Reply
#2

In the first 4 cases you use the variable "Fuel[o]" and in the last case you use the variable "Gorivo[o]" maybe is that your mistake...
Reply
#3

No I was forget to translate to english I'm from Croatia. Thanks
Reply
#4

anyone? thanks
Reply
#5

Show IsACar and IsAMotorcycle
Reply
#6

maybe you have added motorcycle's id in
Quote:

IsACar(GetVehicleModel(o))

Reply
#7

Show IsCar and IsMotorCycle
Reply
#8

pawn Code:
stock IsACar(id)
{
    if(id == 400 || id == 401 || id == 402 || id == 404 || id == 405 || id == 409 || id == 410 || id == 411 || id == 412 || id == 413 || id == 414) return 1;
    else if(id == 415 || id == 416 || id == 428 || id == 419 || id == 420 || id == 421 || id == 422) return 1;
    else if(id == 423 || id == 424 || id == 426 || id == 427 || id == 428 || id == 429 || id == 434) return 1;
    else if(id == 436 || id == 438 || id == 439 || id == 440 || id == 442 || id == 444 || id == 445) return 1;
    else if(id == 451 || id == 457 || id == 458 || id == 459 || id == 466 || id == 467 || id == 470) return 1;
    else if(id == 474 || id == 475 || id == 477 || id == 478 || id == 479 || id == 480 || id == 482) return 1;
    else if(id == 483 || id == 486 || id == 489 || id == 490 || id == 491 || id == 492 || id == 494) return 1;
    else if(id == 495 || id == 496 || id == 498 || id == 499 || id == 500 || id == 502 || id == 503) return 1;
    else if(id == 504 || id == 505 || id == 506 || id == 507 || id == 508 || id == 516 || id == 517) return 1;
    else if(id == 518 || id == 524 || id == 525 || id == 526 || id == 527 || id == 528 || id == 529) return 1;
    else if(id == 530 || id == 531 || id == 532 || id == 533 || id == 534 || id == 535 || id == 536) return 1;
    else if(id == 539 || id == 540 || id == 541 || id == 542 || id == 543 || id == 545 || id == 546) return 1;
    else if(id == 547 || id == 549 || id == 550 || id == 551 || id == 554 || id == 555 || id == 556) return 1;
    else if(id == 557 || id == 558 || id == 559 || id == 560 || id == 561 || id == 562 || id == 565) return 1;
    else if(id == 566 || id == 567 || id == 568 || id == 571 || id == 572 || id == 575 || id == 576) return 1;
    else if(id == 579 || id == 580 || id == 582 || id == 585 || id == 587 || id == 588 || id == 589) return 1;
    else if(id == 596 || id == 597 || id == 598 || id == 599 || id == 600 || id == 601 || id == 602) return 1;
    else if(id == 603 || id == 609) return 1;
    else return 0;
}

pawn Code:
stock IsAMotocycle(id)
{
    if(id == 448 || id == 461 || id == 462 || id == 463 || id == 468 || id == 471 || id == 521 || id == 522 || id == 523 || id == 581 || id == 586) return 1;
    return 0;
}
Reply
#9

EDIT: nvm that didn't see the IsAirplane etc, still, you could shorten that code by ALOT.
Reply
#10

pawn Code:
for(new o = 0; o < MAX_CARS; o++)
    {
        if(o != INVALID_VEHICLE_ID)
        {
            if(IsAPlane(GetVehicleModel(o)) || IsABoat(GetVehicleModel(o)) || IsABus(GetVehicleModel(o))){ Fuel[o] = 80.00; continue; }
            if(IsACar(GetVehicleModel(o))) {Fuel[o] = 40.00; continue; }
            if(IsAMotocycle(GetVehicleModel(o))) { Fuel[o] = 15.00; continue; }
            if(IsATruck(GetVehicleModel(o))) { Fuel[o] = 100.00; continue; }
            Fuel[o] = 40.00;
        }
    }
Try this one maybe it works.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)