Why doesn't this small filterscript I made work? - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Why doesn't this small filterscript I made work? (
/showthread.php?tid=90514)
Why doesn't this small filterscript I made work? -
ThePS3Guy - 08.08.2009
Hi I read through the pawno manuals..
But anyways I am trying to explore with filterscripts, and I cant seem to find out why my filterscript doesn't work. It compiles without errors, it just doesn't work.
#include <a_samp>
#define FILTERSCRIPT
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("tpg");
print("--------------------------------------\n");
return 1;
}
public OnVehicleSpawn(vehicleid)
{
AddVehicleComponent(vehicleid, 1010);
return 1;
}
#endif
I have a feeling it's the "#endif" because when I compiled it earlier it said it expected token "endif". After looking at other peoples filterscripts I didn't see "#endif" in them, so I didn't understand why I needed it. I just put it in there, and that solved the error problem.
Re: Why doesn't this small filterscript I made work? -
Backwardsman97 - 08.08.2009
I never use '#define FILTERSCRIPT' because you don't need it. You can take that and the '#if defined' part out and the '#endif' part out too. But the reason it isn't working is because I don't think OnVehicleSpawn gets called when all the cars are created under OnGameModeInit. Once you load your FS, any vehicle that respawns after that should have nos. You could just use a loop though if you wanted all cars in your script to have nos at the beginning.
Re: Why doesn't this small filterscript I made work? -
ThePS3Guy - 08.08.2009
Thanks man that helps a lot.
EDIT:
To others that want to use this script, use this instead:
#include <a_samp>
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("tpg");
print("--------------------------------------\n");
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
AddVehicleComponent(vehicleid, 1010);
return 1;
}
Backwardsman97, im a new scripter so I don't know how to loop. Thanks anyways, I got it working flawlessly like this.