SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 22/05/2014, 02:15 PM   #1
Luca12
Banned
 
Join Date: Jul 2010
Posts: 1,018
Reputation: 6
Default [HELP] fuel set wrong

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;
        }
    }

Last edited by Luca12; 23/05/2014 at 10:58 AM.
Luca12 is offline   Reply With Quote
Old 22/05/2014, 02:20 PM   #2
Pasa
Big Clucker
 
Join Date: Jun 2011
Location: BiH <3
Posts: 155
Reputation: 15
Default Re: [HELP] fuel set wrong

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...
Pasa is offline   Reply With Quote
Old 22/05/2014, 02:21 PM   #3
Luca12
Banned
 
Join Date: Jul 2010
Posts: 1,018
Reputation: 6
Default Re: [HELP] fuel set wrong

No I was forget to translate to english I'm from Croatia. Thanks
Luca12 is offline   Reply With Quote
Old 23/05/2014, 10:58 AM   #4
Luca12
Banned
 
Join Date: Jul 2010
Posts: 1,018
Reputation: 6
Default Re: [HELP] fuel set wrong

anyone? thanks
Luca12 is offline   Reply With Quote
Old 23/05/2014, 11:10 AM   #5
XK
Huge Clucker
 
XK's Avatar
 
Join Date: Mar 2014
Location: A Rare Place
Posts: 242
Reputation: 30
Default Re: [HELP] fuel set wrong

Show IsACar and IsAMotorcycle
__________________
By XK:
And are we meant to guess your Request?

XK is offline   Reply With Quote
Old 23/05/2014, 11:17 AM   #6
Fred1993
Big Clucker
 
Join Date: May 2014
Posts: 71
Reputation: 6
Default Re: [HELP] fuel set wrong

maybe you have added motorcycle's id in
Quote:
IsACar(GetVehicleModel(o))
Fred1993 is offline   Reply With Quote
Old 23/05/2014, 11:34 AM   #7
BroZeus
High-roller
 
BroZeus's Avatar
 
Join Date: Jan 2014
Location: India
Posts: 1,398
Reputation: 173
Default Re: [HELP] fuel set wrong

Show IsCar and IsMotorCycle
__________________


"Be the change that you wish to see in the world."

Check out my Github profile!
BroZeus is offline   Reply With Quote
Old 23/05/2014, 01:31 PM   #8
Luca12
Banned
 
Join Date: Jul 2010
Posts: 1,018
Reputation: 6
Default Re: [HELP] fuel set wrong

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;
}
Luca12 is offline   Reply With Quote
Old 23/05/2014, 01:59 PM   #9
Denying
Gangsta
 
Join Date: Feb 2013
Posts: 541
Reputation: 13
Default Re: [HELP] fuel set wrong

EDIT: nvm that didn't see the IsAirplane etc, still, you could shorten that code by ALOT.
Denying is offline   Reply With Quote
Old 23/05/2014, 02:11 PM   #10
Fred1993
Big Clucker
 
Join Date: May 2014
Posts: 71
Reputation: 6
Default Re: [HELP] fuel set wrong

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.
Fred1993 is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[FilterScript] Fuel System [Fuel/Speed/Vehicle Name/Health] reddromero Filterscripts 5 10/05/2014 02:50 AM
[HELP] fuel wrong set Luca12 Scripting Help 4 16/04/2014 03:59 PM
Custom Fuel system taking 2 fuel instead of 1. ricardo178 Scripting Help 6 27/04/2013 10:16 AM
Fuel[i] -= 1; (Insted of taking 1, takes all fuel) HondaCBR Scripting Help 2 15/04/2012 01:03 PM


All times are GMT. The time now is 01:20 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.