FileScript Turn Off/On Comand
#1

Hi, i am using the fuel system from » RэРиR « (http://forum.sa-mp.com/index.php?topic=143901.0) and i want to edit it so, when the player is on bike, mountain bike, bmx and trains, the script will turn off,because having fuel on bikes is weired.
I past the script code on http://www.yurii.pastebin.com, to be more easy to someone to help me.
The link is: http://www.yurii.pastebin.com/m124385c5.
Thanks
Reply
#2

You must check if player is in a car and only then show him the fuel bar.

You can use this function:

pawn Код:
IsCar(vehicleid)
{
    switch(GetVehicleModel(vehicleid))
    {
    case
    416,  //ambulan - car
    445,  //admiral - car
    602,  //alpha - car
    485,  //baggage - car
    568,  //bandito - car
    429,  //banshee - car
    499,  //benson - car
    424,  //bfinject,  //car
    536,  //blade - car
    496,  //blistac - car
    504,  //bloodra - car
    422,  //bobcat - car
    609,  //boxburg - car
    498,  //boxville,  //car
    401,  //bravura - car
    575,  //broadway,  //car
    518,  //buccanee,  //car
    402,  //buffalo - car
    541,  //bullet - car
    482,  //burrito - car
    431,  //bus - car
    438,  //cabbie - car
    457,  //caddy - car
    527,  //cadrona - car
    483,  //camper - car
    524,  //cement - car
    415,  //cheetah - car
    542,  //clover - car
    589,  //club - car
    480,  //comet - car
    596,  //copcarla,  //car
    599,  //copcarru,  //car
    597,  //copcarsf,  //car
    598,  //copcarvg,  //car
    578,  //dft30 - car
    486,  //dozer - car
    507,  //elegant - car
    562,  //elegy - car
    585,  //emperor - car
    427,  //enforcer,  //car
    419,  //esperant,  //car
    587,  //euros - car
    490,  //fbiranch,  //car
    528,  //fbitruck,  //car
    533,  //feltzer - car
    544,  //firela - car
    407,  //firetruk,  //car
    565,  //flash - car
    455,  //flatbed - car
    530,  //forklift,  //car
    526,  //fortune - car
    466,  //glendale,  //car
    604,  //glenshit,  //car
    492,  //greenwoo,  //car
    474,  //hermes - car
    434,  //hotknife,  //car
    502,  //hotrina - car
    503,  //hotrinb - car
    494,  //hotring - car
    579,  //huntley - car
    545,  //hustler - car
    411,  //infernus,  //car
    546,  //intruder,  //car
    559,  //jester - car
    508,  //journey - car
    571,  //kart - car
    400,  //landstal,  //car
    403,  //linerun - car
    517,  //majestic,  //car
    410,  //manana - car
    551,  //merit - car
    500,  //mesa - car
    418,  //moonbeam,  //car
    572,  //mower - car
    423,  //mrwhoop - car
    516,  //nebula - car
    582,  //newsvan - car
    467,  //oceanic - car
    404,  //peren - car
    514,  //petro - car
    603,  //phoenix - car
    600,  //picador - car
    413,  //pony - car
    426,  //premier - car
    436,  //previon - car
    547,  //primo - car
    489,  //rancher - car
    441,  //rcbandit,  //car
    594,  //rccam - car
    564,  //rctiger - car
    515,  //rdtrain - car
    479,  //regina - car
    534,  //remingtn,  //car
    505,  //rnchlure,  //car
    442,  //romero - car
    440,  //rumpo - car
    475,  //sabre - car
    543,  //sadler - car
    605,  //sadlshit,  //car
    495,  //sandking,  //car
    567,  //savanna - car
    428,  //securica,  //car
    405,  //sentinel,  //car
    535,  //slamvan - car
    458,  //solair - car
    580,  //stafford,  //car
    439,  //stallion,  //car
    561,  //stratum - car
    409,  //stretch - car
    560,  //sultan - car
    550,  //sunrise - car
    506,  //supergt - car
    601,  //swatvan - car
    574,  //sweeper - car
    566,  //tahoma - car
    549,  //tampa - car
    420,  //taxi - car
    459,  //topfun - car
    576,  //tornado - car
    583,  //tug - car
    451,  //turismo - car
    558,  //uranus - car
    552,  //utility - car
    540,  //vincent - car
    491,  //virgo - car
    412,  //voodoo - car
    478,  //walton - car
    421,  //washing - car
    529,  //willard - car
    555,  //windsor - car
    456,  //yankee - car
    554,  //yosemite - car
    477  //zr350 - car
    : return 1;
    }
    return 0;
}
And you can use it like that:

pawn Код:
if (IsCar(GetPlayerVehicleID(playerid)))
Reply
#3

Quote:
Originally Posted by MadeMan
You must check if player is in a car and only then show him the fuel bar.

You can use this function:

pawn Код:
IsCar(vehicleid)
{
    switch(GetVehicleModel(vehicleid))
    {
    case
    416, //ambulan - car
    445, //admiral - car
    602, //alpha - car
    485, //baggage - car
    568, //bandito - car
    429, //banshee - car
    499, //benson - car
    424, //bfinject, //car
    536, //blade - car
    496, //blistac - car
    504, //bloodra - car
    422, //bobcat - car
    609, //boxburg - car
    498, //boxville, //car
    401, //bravura - car
    575, //broadway, //car
    518, //buccanee, //car
    402, //buffalo - car
    541, //bullet - car
    482, //burrito - car
    431, //bus - car
    438, //cabbie - car
    457, //caddy - car
    527, //cadrona - car
    483, //camper - car
    524, //cement - car
    415, //cheetah - car
    542, //clover - car
    589, //club - car
    480, //comet - car
    596, //copcarla, //car
    599, //copcarru, //car
    597, //copcarsf, //car
    598, //copcarvg, //car
    578, //dft30 - car
    486, //dozer - car
    507, //elegant - car
    562, //elegy - car
    585, //emperor - car
    427, //enforcer, //car
    419, //esperant, //car
    587, //euros - car
    490, //fbiranch, //car
    528, //fbitruck, //car
    533, //feltzer - car
    544, //firela - car
    407, //firetruk, //car
    565, //flash - car
    455, //flatbed - car
    530, //forklift, //car
    526, //fortune - car
    466, //glendale, //car
    604, //glenshit, //car
    492, //greenwoo, //car
    474, //hermes - car
    434, //hotknife, //car
    502, //hotrina - car
    503, //hotrinb - car
    494, //hotring - car
    579, //huntley - car
    545, //hustler - car
    411, //infernus, //car
    546, //intruder, //car
    559, //jester - car
    508, //journey - car
    571, //kart - car
    400, //landstal, //car
    403, //linerun - car
    517, //majestic, //car
    410, //manana - car
    551, //merit - car
    500, //mesa - car
    418, //moonbeam, //car
    572, //mower - car
    423, //mrwhoop - car
    516, //nebula - car
    582, //newsvan - car
    467, //oceanic - car
    404, //peren - car
    514, //petro - car
    603, //phoenix - car
    600, //picador - car
    413, //pony - car
    426, //premier - car
    436, //previon - car
    547, //primo - car
    489, //rancher - car
    441, //rcbandit, //car
    594, //rccam - car
    564, //rctiger - car
    515, //rdtrain - car
    479, //regina - car
    534, //remingtn, //car
    505, //rnchlure, //car
    442, //romero - car
    440, //rumpo - car
    475, //sabre - car
    543, //sadler - car
    605, //sadlshit, //car
    495, //sandking, //car
    567, //savanna - car
    428, //securica, //car
    405, //sentinel, //car
    535, //slamvan - car
    458, //solair - car
    580, //stafford, //car
    439, //stallion, //car
    561, //stratum - car
    409, //stretch - car
    560, //sultan - car
    550, //sunrise - car
    506, //supergt - car
    601, //swatvan - car
    574, //sweeper - car
    566, //tahoma - car
    549, //tampa - car
    420, //taxi - car
    459, //topfun - car
    576, //tornado - car
    583, //tug - car
    451, //turismo - car
    558, //uranus - car
    552, //utility - car
    540, //vincent - car
    491, //virgo - car
    412, //voodoo - car
    478, //walton - car
    421, //washing - car
    529, //willard - car
    555, //windsor - car
    456, //yankee - car
    554, //yosemite - car
    477 //zr350 - car
    : return 1;
    }
    return 0;
}
And you can use it like that:

pawn Код:
if (IsCar(GetPlayerVehicleID(playerid)))
Why not just use https://sampwiki.blast.hk/wiki/IsPlayerInAnyVehicle and then add GetPlayerVehicleID along with if(vehicleid == bmx || vehicleid == mountiainbikeid).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)