public function mostly returns 0
#1

Hello,
I have a problem in a public function:
PHP код:
forward VIPAble(carid);
public 
VIPAble(carid)
{
    if(
GetVehicleModel(carid) == 411 || GetVehicleModel(carid) == 560 || GetVehicleModel(carid) == 541 || GetVehicleModel(carid) == 451)
    {
        return 
1;
    }
    return 
0;

when testing this, it works, but after a while of starting server ( 3hours or more ) it returns 0...
Reply
#2

Did you make sure that you are using the actual vehicleid over VIPable's parameters, or maybe you are using GetVehicleModel on the parameter?
Reply
#3

Here is where i have the bug:
PHP код:
if(CarInfo[carid][cVIP] != && !VIPAble(GetVehicleModel(GetPlayerVehicleID(playerid)))) return ShowPlayerDialog(playerid,DIALOG_VEHSPAWN10,DIALOG_STYLE_LIST,stringg,"{FFFFFF}Vehicle Info\nTow vehicle (/park)\nFind Vehicle\nBuy Insurance\nClear Age and KM - {FFFF00}20 premium points\nUnstuck vehicle\nDespawn Car\nUpgrade to vip vehicle - {FFFF00}100 premium points","Select","Close"); 
P.s.: I've another ariable with same name (carid) , do It affects that?
Reply
#4

PHP код:
if(CarInfo[carid][cVIP] != && !VIPAble(GetPlayerVehicleID(playerid)) return ShowPlayerDialog(playerid,DIALOG_VEHSPAWN10,DIALOG_STYLE_LIST,stringg,"{FFFFFF}Vehicle Info\nTow vehicle (/park)\nFind Vehicle\nBuy Insurance\nClear Age and KM - {FFFF00}20 premium points\nUnstuck vehicle\nDespawn Car\nUpgrade to vip vehicle - {FFFF00}100 premium points","Select","Close"); 
No need for GetVehicleModel on VIPAble, also it doesn't affect your function if some of your function uses the same parameters name.
Reply
#5

Ahhh right, mind blown when i wrote this lol, it checks model two times
edit:thanks!!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)