Help with compiling an NPC Script ,Please!
#1

Hello ,
While compiling this fs i get alot of errors:
PHP код:
// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT
#include <a_samp>
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
  print(
"AdmBot NPC");
  
ConnectNPC("AdmBot","justnpc");
  
MyFirstNPCVehicle CreateVehicle(4370.00.05.00.01981665000);
  return 
1;
}
public 
OnPlayerSpawn(playerid)
{
  if(
IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
  
{
    new 
npcname[MAX_PLAYER_NAME];
    
GetPlayerName(playeridnpcnamesizeof(npcname)); //Getting the NPC's name.
    
if(!strcmp(npcname"AdmBot"true)) //Checking if the NPC's name is MyFirstNPC
    
{
      
SetPlayerSkin(playerid147);
      
PutPlayerInVehicle(playeridMyFirstNPCVehicle0); //Putting the NPC into the vehicle we created for it.
    
}
  }
}
public 
OnFilterScriptExit()
{
    print(
"AdmBot NPC Unloaded");
    return 
1;
}
#else
main()
{
    print(
"\n----------------------------------");
    print(
"AdmBot NPC Unloaded");
    print(
"----------------------------------\n");
}
#endif 
Код:
C:\Documents and Settings\Youssef\Bureau\RPG Romania 1.00.40\filterscripts\AdmBot.pwn(13) : error 017: undefined symbol "MyFirstNPCVehicle"
C:\Documents and Settings\Youssef\Bureau\RPG Romania 1.00.40\filterscripts\AdmBot.pwn(25) : error 017: undefined symbol "MyFirstNPCVehicle"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Reply
#2

Hello Youssefree,
you have to create this variable on top of your script:
Код:
new MyFirstNPCVehicle = INVALID_VEHICLE_ID;
Reply
#3

Quote:
Originally Posted by GangstaaSunny
Посмотреть сообщение
Hello Youssefree,
you have to create this variable on top of your script:
Код:
new MyFirstNPCVehicle = INVALID_VEHICLE_ID;
Thank you , my regards , +REPPED
Reply
#4

Quote:
Originally Posted by GangstaaSunny
Посмотреть сообщение
Hello Youssefree,
you have to create this variable on top of your script:
Код:
new MyFirstNPCVehicle = INVALID_VEHICLE_ID;
Bro , NPC didn't work,
the car spawns(at center of map) but there's no NPC inside it
Reply
#5

Is the NPC disconnecting from your server? If so, you might need to bypass any login scripts you have

Use the following at the top of OnPlayerConnect, OnPlayerSpawn (after putting the NPC in a vehicle) and on OnPlayerRequestSpawn:

pawn Код:
if ( IsPlayerNPC ( playerid ) )
{
    return 1;
}
Reply
#6

Quote:
Originally Posted by WrathOfGenesis
Посмотреть сообщение
Is the NPC disconnecting from your server? If so, you might need to bypass any login scripts you have

Use the following at the top of OnPlayerConnect, OnPlayerSpawn (after putting the NPC in a vehicle) and on OnPlayerRequestSpawn:

pawn Код:
if ( IsPlayerNPC ( playerid ) )
{
    return 1;
}
the car spawns(at center of map) but there's no NPC inside it
log:
Код:
SA-MP Dedicated Server
----------------------
v0.3.7-R2, ©2005-2015 SA-MP Team

[01:25:57] 
[01:25:57] Server Plugins
[01:25:57] --------------
[01:25:57]  Loading plugin: mysql.so
[01:25:58]  >> plugin.mysql: R38 successfully loaded.
[01:25:58]   Loaded.
[01:25:58]  Loading plugin: sscanf.so
[01:25:58] 

[01:25:58]  ===============================

[01:25:58]       sscanf plugin loaded.     

[01:25:58]          Version:  2.8.1        

[01:25:58]    © 2012 Alex "******" Cole  

[01:25:58]  ===============================

[01:25:58]   Loaded.
[01:25:58]  Loading plugin: streamer.so
[01:25:58] 

*** Streamer Plugin v2.7.9 by Incognito loaded ***

[01:25:58]   Loaded.
[01:25:58]  Loaded 3 plugins.

[01:25:58] 
[01:25:58] Ban list
[01:25:58] --------
[01:25:58]  Loaded: samp.ban
[01:25:58] 
[01:25:58] 
[01:25:58] Filterscripts
[01:25:58] ---------------
[01:25:58]   Loading filterscript 'speedometer.amx'...
[01:25:58] --- Speedometer by: LINKINPARK ---
[01:25:58]   Loading filterscript 'playall.amx'...
[01:25:58]   Unable to load filterscript 'playall.amx'.
[01:25:58]   Loading filterscript 'RAce.amx'...
[01:25:58]   Loading filterscript 'AdmBot.amx'...
[01:25:58] AdmBot NPC
[01:25:58]   Loaded 3 filterscripts.

[01:25:58] Turfs: 48
[01:25:58] 162 - Objects.
[01:25:58] 17 - Pickups.
[01:25:58] OnGameModeInit Loaded
[01:25:58] Script loaded - s4uriK RPG Romania 1.00.40
[01:25:58] Number of vehicle models: 123
[01:25:58] Houses: 101
[01:25:58] Bussines: 54
[01:25:58] Dynamic Factions: 14
[01:25:58] Clans: 4
[01:25:58] Cars: 24
[01:25:58] Stocks: 101
Reply
#7

Hello Youssefree,
your bot dont even connect to the server. Make sure your maxnpc inside the server.cfg is set to a minimum of 1. Also check if you do have the record files for your bot.

If you didnt realy understand what am i talking about feel free to use the forum search function to get nice tutorials by similar persons.
Reply
#8

Hello!

I searched a tutorial for you so that you feel easier to do that.
=> https://sampforum.blast.hk/showthread.php?tid=95034

I hope this will help you.
Reply
#9

Quote:
Originally Posted by GangstaaSunny
Посмотреть сообщение
Hello Youssefree,
your bot dont even connect to the server. Make sure your maxnpc inside the server.cfg is set to a minimum of 1. Also check if you do have the record files for your bot.

If you didnt realy understand what am i talking about feel free to use the forum search function to get nice tutorials by similar persons.
1 - i know what i'm doing so i set already maxnpc to 1
2 - i have the record and placed it in the records dir
Quote:
Originally Posted by Mencent
Посмотреть сообщение
Hello!

I searched a tutorial for you so that you feel easier to do that.
=> https://sampforum.blast.hk/showthread.php?tid=95034

I hope this will help you.
3 - this topic is a result of following that tutorial
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)