public function mostly returns 0 - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: public function mostly returns 0 (
/showthread.php?tid=634297)
public function mostly returns 0 -
YouHack - 16.05.2017
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...
Re: public function mostly returns 0 -
JaKe Elite - 16.05.2017
Did you make sure that you are using the actual vehicleid over VIPable's parameters, or maybe you are using GetVehicleModel on the parameter?
Re: public function mostly returns 0 -
YouHack - 16.05.2017
Here is where i have the bug:
PHP код:
if(CarInfo[carid][cVIP] != 1 && !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?
Re: public function mostly returns 0 -
JaKe Elite - 16.05.2017
PHP код:
if(CarInfo[carid][cVIP] != 1 && !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.
Re: public function mostly returns 0 -
YouHack - 16.05.2017
Ahhh right, mind blown when i wrote this lol, it checks model two times
edit:thanks!!