30.11.2009, 12:53
Thanks [LSD]Rac3r,it fixed many errors,i have only 1 error now.
OLD SCRIPT:
NEW SCRIPT:
As you see i deleted like 2-3 lines:
So,was it right or now ill have a prob
LAST ERROR!:
Or if it wasnt right to delete the 2-3 lines,here is the other script:
ERROR:
Thanks for the help!
EDIT: Lol i fixed it,Is this script OK?
OLD SCRIPT:
Code:
public OnFilterScriptInit() { print("my filterscript"); ConnectNPC("MyFirstNPC","BOT"); return 1; } new MyFirstNPCVehicle; //Global variable! public OnFilterScriptInit() { print("my filterscript"); ConnectNPC("MyFirstNPC","BOT"); MyFirstNPCVehicle = CreateVehicle(400, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000); return 1; } public OnPlayerSpawn(playerid) { if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC. { new npcname[MAX_PLAYER_NAME]; GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name. if(!strcmp(npcname, "MyFirstNPC", true)) //Checking if the NPC's name is MyFirstNPC { PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 0); //Putting the NPC into the vehicle we created for it. } return 1; } //Other stuff for normal players goes here! return 1; }
Code:
#include <a_samp>
public OnFilterScriptInit()
{
print("my filterscript");
ConnectNPC("MyFirstNPC","bot");
MyFirstNPCVehicle = CreateVehicle(400, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
return 1;
}
new MyFirstNPCVehicle; //Global variable!
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
if(!strcmp(npcname, "MyFirstNPC", true)) //Checking if the NPC's name is MyFirstNPC
{
PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 0); //Putting the NPC into the vehicle we created for it.
}
return 1;
}
//Other stuff for normal players goes here!
return 1;
}
Code:
print("my filterscript"); - deleted
ConnectNPC("MyFirstNPC","BOT"); - deleted
MyFirstNPCVehicle = CreateVehicle(400, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000); -I LEFT ONLY THIS LINE AND PUTTED IT NEAR THE TOP OF THE SCRIPT
return 1; - deleted
LAST ERROR!:
Code:
C:\Program Files\gta.sa\GTA San Andreas\filterscripts\npc_test_2.pwn(7) : error 017: undefined symbol "MyFirstNPCVehicle" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Error.
Code:
#include <a_samp> public OnFilterScriptInit() { print("my filterscript"); ConnectNPC("MyFirstNPC","BOT"); return 1; } new MyFirstNPCVehicle; //Global variable! public OnFilterScriptInit() { print("my filterscript"); ConnectNPC("MyFirstNPC","BOT"); MyFirstNPCVehicle = CreateVehicle(400, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000); return 1; } public OnPlayerSpawn(playerid) { if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC. { new npcname[MAX_PLAYER_NAME]; GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name. if(!strcmp(npcname, "MyFirstNPC", true)) //Checking if the NPC's name is MyFirstNPC { PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 0); //Putting the NPC into the vehicle we created for it. } return 1; } //Other stuff for normal players goes here! return 1; }
Code:
C:\Program Files\gta.sa\GTA San Andreas\filterscripts\npc_test_2.pwn(12) : error 021: symbol already defined: "OnFilterScriptInit" Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase 1 Error.
EDIT: Lol i fixed it,Is this script OK?
Code:
#include <a_samp>
new MyFirstNPCVehicle; //Global variable!
public OnFilterScriptInit()
{
print("my filterscript");
ConnectNPC("MyFirstNPC","BOT");
MyFirstNPCVehicle = CreateVehicle(400, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
return 1;
}
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
if(!strcmp(npcname, "MyFirstNPC", true)) //Checking if the NPC's name is MyFirstNPC
{
PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 0); //Putting the NPC into the vehicle we created for it.
}
return 1;
}
//Other stuff for normal players goes here!
return 1;
}