Why do I get this error with this script?
#1

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.
Reply
#2

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;
}
Reply
#3

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)