Modifying my script a bit... can't seem to get it to work?
#1

Here is my original filter script that adds nitro to vehicles when you enter them:


#include <a_samp>

public OnFilterScriptInit()
{
print("\n--------------------------------------");
print("Tpg");
print("--------------------------------------\n");
return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
AddVehicleComponent(vehicleid, 1010);
return 1;
}


but when you enter vehicles that can't have nos, it crashes. so i tried changing it to this:



public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
for(new i = 0; i<MAX_PLAYERS; i++)
{
if(!IsPlayerInInvalidNosVehicle(i,GetPlayerVehicle ID(i)))
{
new vehicle = GetPlayerVehicleID(i);
AddVehicleComponent(vehicle, 1010);
}
}
}

IsPlayerInInvalidNosVehicle(playerid,vehicleid)
{
#define MAX_INVALID_NOS_VEHICLES 29

new InvalidNosVehicles[MAX_INVALID_NOS_VEHICLES] =
{
581,523,462,521,463,522,461,448,468,586,
509,481,510,472,473,493,595,484,430,453,
452,446,454,590,569,537,538,570,449
};

vehicleid = GetPlayerVehicleID(playerid);

if(IsPlayerInVehicle(playerid,vehicleid))
{
for(new i = 0; i < MAX_INVALID_NOS_VEHICLES; i++)
{
if(GetVehicleModel(vehicleid) == InvalidNosVehicles[i])
{
return true;
}
}
}
return false;
}



(thanks bert for help with this)but it has seven errors:


C:\Documents and Settings\Administrator\Desktop\SAMP\sampserver\fil terscripts\SSnSCars.pwn(13) : warning 235: public function lacks forward declaration (symbol "OnPlayerEnterVehicle")
C:\Documents and Settings\Administrator\Desktop\SAMP\sampserver\fil terscripts\SSnSCars.pwn(3) : error 017: undefined symbol "MAX_PLAYERS"
C:\Documents and Settings\Administrator\Desktop\SAMP\sampserver\fil terscripts\SSnSCars.pwn(5) : error 017: undefined symbol "GetPlayerVehicleID"
C:\Documents and Settings\Administrator\Desktop\SAMP\sampserver\fil terscripts\SSnSCars.pwn(7) : error 017: undefined symbol "GetPlayerVehicleID"
C:\Documents and Settings\Administrator\Desktop\SAMP\sampserver\fil terscripts\SSnSCars.pwn( : warning 217: loose indentation
C:\Documents and Settings\Administrator\Desktop\SAMP\sampserver\fil terscripts\SSnSCars.pwn( : error 017: undefined symbol "AddVehicleComponent"
C:\Documents and Settings\Administrator\Desktop\SAMP\sampserver\fil terscripts\SSnSCars.pwn(7) : warning 204: symbol is assigned a value that is never used: "vehicle"
C:\Documents and Settings\Administrator\Desktop\SAMP\sampserver\fil terscripts\SSnSCars.pwn(24) : error 017: undefined symbol "GetPlayerVehicleID"
C:\Documents and Settings\Administrator\Desktop\SAMP\sampserver\fil terscripts\SSnSCars.pwn(26) : error 017: undefined symbol "IsPlayerInVehicle"
C:\Documents and Settings\Administrator\Desktop\SAMP\sampserver\fil terscripts\SSnSCars.pwn(30) : error 017: undefined symbol "GetVehicleModel"
C:\Documents and Settings\Administrator\Desktop\SAMP\sampserver\fil terscripts\SSnSCars.pwn(24) : warning 204: symbol is assigned a value that is never used: "vehicleid"
C:\Documents and Settings\Administrator\Desktop\SAMP\sampserver\fil terscripts\SSnSCars.pwn(13) : warning 203: symbol is never used: "playerid"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


7 Errors.


Please help!
Reply
#2

You need to explain for the FS what
Quote:

OnPlayerEnterVehicle

and the rest that gives error to the FS as Forward or use new
Reply
#3

ok, all i did was put #include <a_samp> at the top and it got rid of all errors.. am trying it out now though
Reply
#4

If that doesnt work try:

http://sa-mp.pastebin.com/d7d6d9e44

untested so, sorry if it doesnt work.
Reply
#5

Thanks Anwix. That doesn't seem to be working though... Does anyone know why it isn't working? It compiles correctly but it just doesn't work. It doesn't add nos to the vehicle when I enter it.
Reply
#6

As i told you the SYMBOL aint used make them USED with forward or new, Maby tomorrow il fix it for you
Reply
#7

Код:
forward IsNosVehicle(vehicleid);

public IsNosVehicle(vehicleid)
{
  #define MAX_INVALID_NOS_VEHICLES 29
  new InvalidNosVehicles[MAX_INVALID_NOS_VEHICLES] = {
  581,523,462,521,463,522,461,448,468,586,
  509,481,510,472,473,493,595,484,430,453,
  452,446,454,590,569,537,538,570,449
  };
  for(new i = 0; i < MAX_INVALID_NOS_VEHICLES; i++)
  {
    if(GetVehicleModel(vehicleid) == InvalidNosVehicles[i])
    {
      return 0;
    }
  }
  return 1;
}

public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
  if(IsNosVehicle(vehicleid) == 1)
  {
    AddVehicleComponent(vehicleid, 1010);
  }
}
Try that, it's untested though!

Hope this helps!
Reply


Forum Jump:


Users browsing this thread: