npc compile problem
#1

wen i try to compile my script with the npc stuff i get
Quote:

C:\Users\john\Desktop\Desktop files\0.3\gamemodes\sagc.pwn(1322) : error 021: symbol already defined: "ConnectNPC"
C:\Users\john\Desktop\Desktop files\0.3\gamemodes\sagc.pwn(1324) : error 021: symbol already defined: "OnGameModeInit"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

and i have no idea what to do scripting noob ftl here's what i did
Quote:

ConnectNPC("ROBERT","mynpc");
public OnGameModeInit()
{
print("SAGC");
ConnectNPC("ROBERT","mynpc");
return 1;
}

Reply
#2

Quote:
Originally Posted by rtydrtyd
wen i try to compile my script with the npc stuff i get
Quote:

C:\Users\john\Desktop\Desktop files\0.3\gamemodes\sagc.pwn(1322) : error 021: symbol already defined: "ConnectNPC"
C:\Users\john\Desktop\Desktop files\0.3\gamemodes\sagc.pwn(1324) : error 021: symbol already defined: "OnGameModeInit"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


2 Errors.

and i have no idea what to do scripting noob ftl here's what i did
Quote:

ConnectNPC("ROBERT","mynpc");
public OnGameModeInit()
{
print("SAGC");
ConnectNPC("ROBERT","mynpc");
return 1;
}

Open 'Find' with CTRL + F and find OnGameModeInit(), delete it and make sure there's no OnGameModeInit in script.
Now write this code
pawn Код:
public OnGameModeInit()
{
   print("SAGC");
   ConnectNPC("ROBERT","mynpc");
   return 1;
}

Reply
#3

Thanks.
Reply
#4

Ok yeah i have a nother problem, i now i cant delete the 2nd OnGameModeInit so what exactly do i do to fix it lol i need to learn how to scrip :P

Quote:

C:\Users\john\Desktop\Desktop files\0.3\gamemodes\sagc.pwn(1336) : error 021: symbol already defined: "OnGameModeInit"
C:\Users\john\Desktop\Desktop files\0.3\gamemodes\sagc.pwn(1339) : warning 204: symbol is assigned a value that is never used: "MyFirstNPCVehicle"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

Here is what it looks like now.
Quote:

public OnGameModeInit()
{
print("SAGC");
ConnectNPC("ROBERT","mynpc");
return 1;
}
public OnFilterScriptInit()
{
print("scriptfiles");
ConnectNPC("ROBERT","mynpc");
return 1;
}
new MyFirstNPCVehicle; //Global variable!
public OnGameModeInit()
{
print("SAGC");
ConnectNPC("ROBERT","mynpc");
MyFirstNPCVehicle = CreateVehicle(420,1536.6427,-841.7883,64.4755,266.3878,6,1, 5000);
return 1;
}

Reply
#5

Quote:
Originally Posted by rtydrtyd
Ok yeah i have a nother problem, i now i cant delete the 2nd OnGameModeInit so what exactly do i do to fix it lol i need to learn how to scrip :P

Quote:

C:\Users\john\Desktop\Desktop files\0.3\gamemodes\sagc.pwn(1336) : error 021: symbol already defined: "OnGameModeInit"
C:\Users\john\Desktop\Desktop files\0.3\gamemodes\sagc.pwn(1339) : warning 204: symbol is assigned a value that is never used: "MyFirstNPCVehicle"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.

Here is what it looks like now.
Quote:

public OnGameModeInit()
{
print("SAGC");
ConnectNPC("ROBERT","mynpc");
return 1;
}
public OnFilterScriptInit()
{
print("scriptfiles");
ConnectNPC("ROBERT","mynpc");
return 1;
}
new MyFirstNPCVehicle; //Global variable!
public OnGameModeInit()
{
print("SAGC");
ConnectNPC("ROBERT","mynpc");
MyFirstNPCVehicle = CreateVehicle(420,1536.6427,-841.7883,64.4755,266.3878,6,1, 5000);
return 1;
}

Okay, let's begin
You can't use OnGameModeInit() if you have OnFilterScriptInit() because you're need to use OnGameModeInit() when you creating a gamemode script ONLY
and OnFilterScriptInit() when you creating a filterscript ONLY !

So, now you probably have gamemode, so we will leave OnGameModeInit and delete OnFilterScriptInit

pawn Код:
new MyFirstNPCVehicle;

public OnGameModeInit()
{
    print("SAGC");
    ConnectNPC("ROBERT","mynpc");
    MyFirstNPCVehicle = CreateVehicle(420,1536.6427,-841.7883,64.4755,266.3878,6,1, 5000);
    return 1;
}
And that's it!
Reply
#6

Eh yeah that dident work now i get
Quote:

C:\Users\john\Desktop\Desktop files\0.3\gamemodes\sagc.pwn(1330) : error 055: start of function body without function header
C:\Users\john\Desktop\Desktop files\0.3\gamemodes\sagc.pwn(1333) : error 010: invalid function or declaration
C:\Users\john\Desktop\Desktop files\0.3\gamemodes\sagc.pwn(1337) : error 021: symbol already defined: "OnGameModeInit"
C:\Users\john\Desktop\Desktop files\0.3\gamemodes\sagc.pwn(1573) : error 021: symbol already defined: "OnPlayerSpawn"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


4 Errors.

Quote:

{
print("scriptfiles");
ConnectNPC("ROBERT","mynpc");
return 1;
}
new MyFirstNPCVehicle; //Global variable!
public OnGameModeInit()
{
print("SAGC");
ConnectNPC("ROBERT","mynpc");
MyFirstNPCVehicle = CreateVehicle(420,1536.6427,-841.7883,64.4755,266.3878,6,1, 5000);
return 1;
}
and if i take

and i i take
Quote:

{
print("scriptfiles");
ConnectNPC("ROBERT","mynpc");
return 1;
}

out i get
Quote:

C:\Users\john\Desktop\Desktop files\0.3\gamemodes\sagc.pwn(1329) : error 054: unmatched closing brace ("}")
C:\Users\john\Desktop\Desktop files\0.3\gamemodes\sagc.pwn(1332) : error 021: symbol already defined: "OnGameModeInit"
C:\Users\john\Desktop\Desktop files\0.3\gamemodes\sagc.pwn(156 : error 021: symbol already defined: "OnPlayerSpawn"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.

Reply
#7

Do i not need
Quote:

//public OnFilterScriptInit()
{
print("scriptfiles");
ConnectNPC("ROBERT","mynpc");
return 1;
}

at all?
im confused here
Reply
#8

are you writing into a GM or FS? if it's a GM (Gamemode) then remove the OnFilterScriptInit If it's a FS (Filterscript) Then remove the OnGameModeInit
Reply
#9

i did that and i get
Quote:

C:\Users\john\Desktop\Desktop files\0.3\gamemodes\sagc1.pwn(1323) : error 021: symbol already defined: "OnGameModeInit"
C:\Users\john\Desktop\Desktop files\0.3\gamemodes\sagc1.pwn(1329) : error 055: start of function body without function header
C:\Users\john\Desktop\Desktop files\0.3\gamemodes\sagc1.pwn(1332) : error 010: invalid function or declaration
C:\Users\john\Desktop\Desktop files\0.3\gamemodes\sagc1.pwn(1336) : error 021: symbol already defined: "OnGameModeInit"
C:\Users\john\Desktop\Desktop files\0.3\gamemodes\sagc1.pwn(1572) : error 021: symbol already defined: "OnPlayerSpawn"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


5 Errors.

script
Quote:

public OnGameModeInit()
{
print("SAGC");
ConnectNPC("ROBERT","mynpc");
return 1;
}
//public OnFilterScriptInit()
{
print("scriptfiles");
ConnectNPC("ROBERT","mynpc");
return 1;
}
new MyFirstNPCVehicle; //Global variable!
public OnGameModeInit()
{
print("SAGC");
ConnectNPC("ROBERT","mynpc");
MyFirstNPCVehicle = CreateVehicle(420,1536.6427,-841.7883,64.4755,266.3878,6,1, 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, "ROBERT", 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;
}

you guys keep saying take out OnFilterScriptInit but its actualy making it worse it's gota be somthing ells ben trying to fix it all day lol
Reply
#10

Ok i found i was using some of the wrong sript stuff, i was using some scriptfile script or w/e but now i have the script for the gamemode and got 3 error's maby this time i can get the right info lol
Error
Quote:

C:\Users\john\Desktop\Desktop files\0.3\gamemodes\sagc1.pwn(1324) : error 021: symbol already defined: "OnGameModeInit"
C:\Users\john\Desktop\Desktop files\0.3\gamemodes\sagc1.pwn(1331) : error 021: symbol already defined: "OnGameModeInit"
C:\Users\john\Desktop\Desktop files\0.3\gamemodes\sagc1.pwn(1567) : error 021: symbol already defined: "OnPlayerSpawn"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.

changed script

Quote:

//ConnectNPC("Robert","mynpc");
public OnGameModeInit()
{
print("sagc1");
ConnectNPC("Robert","mynpc");
return 1;
}
new MyFirstNPCVehicle;
public OnGameModeInit()
{
print("sagc1");
ConnectNPC("Robert","mynpc");
MyFirstNPCVehicle = CreateVehicle(420,1536.6427,-841.7883,64.4755,266.3878,6,1, 5000);
return 1;
}
public OnPlayerSpawn(playerid)
{
if(IsPlayerNPC(playerid))
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname));
if(!strcmp(npcname, "Robert", true))
{
PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 0);
}
return 1;
}

return 1;
}

Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)