Why do I get this error with this script? - 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 do I get this error with this script? (
/showthread.php?tid=90511)
Why do I get this error with this script? -
ThePS3Guy - 08.08.2009
So I'm new at scripting, but unlike 99% of the other posts here that say that, I read through multiple guides and tutorials on pawno.
I wrote this mini little script:
public OnVehicleSpawn(vehicleid)
{
new vehicle = GetPlayerVehicleID(playerid);
AddVehicleComponent(vehicle, 1010);
return 1;
}
But I cant seem to find out why I get this error:
C:\Documents and Settings\Administrator\Desktop\SAMP\sampserver\fil terscripts\infinitenitro.pwn(63) : error 017: undefined symbol "playerid"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
Can you please help me out?
PS: how do you paste pawno codes here in the samp forums the proper way? i cant seem to figure it out.
Re: Why do I get this error with this script? -
Karlip - 08.08.2009
OnVehicleSpawn doesn't have the 'playerid' in it,hence 'playerid' doesn't work with it.
Just use:
pawn Код:
public OnVehicleSpawn(vehicleid)
{
AddVehicleComponent(vehicleid, 1010);
return 1;
}
Re: Why do I get this error with this script? -
ThePS3Guy - 08.08.2009
ok thanks it compiles without errors now.. now all i have to do is go and test it.
EDIT:
OK, that didn't work, so i tried this:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
new vehicle = GetPlayerVehicleID(vehicleid);
AddVehicleComponent(vehicle, 1010);
return 1;
}
it compiled properly, but it still didnt work! why isn't it working? i just can't figure it out...
EDIT: lol, didn't see u posted a script there for me to use im trying it now.