how to put exactly -
Sfinx_17 - 27.11.2009
hey guys i need help where to put this code from Kc tutorial
pawn Код:
{
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;
}
i need a example code plz i will apreciate
Re: how to put exactly -
Joe Staff - 27.11.2009
... Come on sFinx, that's a bad question even for you.
The tutorial
clearly states public
OnPlayerSpawn. So that would be in the filterscript/gamemode that you're using,
not the npcmode.
Re: how to put exactly -
Sfinx_17 - 27.11.2009
i mean how to put in OnePlayerSpawn sorry was my error posting
Re: how to put exactly -
patchkinson - 27.11.2009
Just put it on OnPlayerSpawn
whats hard in that ?
Re: how to put exactly -
Mike Garber - 27.11.2009
pawn Код:
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;
}
Re: how to put exactly -
Sfinx_17 - 27.11.2009
i already putted then why i get this error?
Код:
C:\PROGRA~1\ROCKST~1\SERVER~1.3AR\GAMEMO~1\Sfinx_17.pwn(218) : warning 225: unreachable code
C:\PROGRA~1\ROCKST~1\SERVER~1.3AR\GAMEMO~1\Sfinx_17.pwn(224) : error 017: undefined symbol "MyFirstNPCVehicle"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Error.
Re: how to put exactly -
patchkinson - 27.11.2009
Because you need to create the MyFirstNpcVehicle
WTF??!??!
ANd cause you got a return 1; misplaced
AND WTF!!! I REALLY THINK YOUR GOING TO FAST; TRY LEARNING THINGS THAT ARE MORE BASIC FIRST
WTF! You NEED TO KNOW What a new Is, a define, a forward, where to place them WTF!:

!:
anyways
the following was taken from my gamemode
pawn Код:
#include <a_samp>
#include <MidoStream>
#define red 0xff0000ff
#define yellow 0xffff00ff
#define green 0x00ff00ff
#define blue 0x0000ffff
#define cyan 0x00d7ffff
#define white 0x00000000
#define purple 0xeb6eaaff
new new1;
new new2;
new new3;
new new4;
new new5;
new new6;
new MyFirstNPCVehicle;
and
pawn Код:
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, "bikels", 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;
}
if(!strcmp(npcname, "duck", true))
{
PutPlayerInVehicle(playerid, MyFirstNPCVehiclee, 0);
return 1;
}
if(!strcmp(npcname, "androls", true))
{
PutPlayerInVehicle(playerid, MyFirstNPCVehicleee, 0);
return 1;
}
if(!strcmp(npcname, "bestkarting", true))
{
PutPlayerInVehicle(playerid, MyFirstNPCVehicleeee, 0);
return 1;
}
if(!strcmp(npcname, "damness", true))
{
PutPlayerInVehicle(playerid, MyFirstNPCVehicleeeee, 0);
return 1;
}
if(!strcmp(npcname, "grove", true))
{
PutPlayerInVehicle(playerid, MyFirstNPCVehicleeeeee, 0);
return 1;
}
if(!strcmp(npcname, "kartingnice", true))
{
PutPlayerInVehicle(playerid, MyFirstNPCVehicleeeeeee, 0);
return 1;
}
if(!strcmp(npcname, "taxihydra", true))
{
PutPlayerInVehicle(playerid, MyFirstNPCVehicleeeeeeee, 0);
return 1;
}
if(!strcmp(npcname, "warhydra", true))
{
PutPlayerInVehicle(playerid, MyFirstNPCVehicleeeeeeeee, 0);
return 1;
}
return 1;
}
if(IsPlayerNPC(playerid)) return 1;
GivePlayerWeapon(playerid,25,3000);
GivePlayerWeapon(playerid,34,3000);
GivePlayerWeapon(playerid,26,3000);
return 1;
}
and under ongamemodeinit
pawn Код:
MyFirstNPCVehicle = CreateVehicle(522, 0.0, 0.0, 5.0, 0.0, 3, 3, 5000);
Re: how to put exactly -
Sfinx_17 - 28.11.2009
this is my script and the code where i putted look...
pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT
#define RECORDING_TYPE 1 // dak e 1 inseamna ca omu e in masina,dak e 2 inseamna ca e pe jos omu
#define RECORDING "mynpc"
#define SOUND_OFF 1184
new MyFirstNPCVehicle;
#include <a_samp>
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Blank Filterscript by your name here");
print("--------------------------------------\n");
return 1;
}
now why i get this error?
Код:
C:\PROGRA~1\ROCKST~1\SERVER~1.3AR\GAMEMO~1\Sfinx_17.pwn(398) : warning 203: symbol is never used: "MyFirstNPCVehicle"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Warning.
Re: how to put exactly -
dugi - 28.11.2009
It's not an error but a warning, check the pawn documentation for information about errors.
Re: how to put exactly -
miokie - 28.11.2009
And also read this more than once. Don't Skim Read (Quickly reading) Take your time and let all the infomation set into your brain.
I personally think you are way too ahead of yourself if you don't know these basic things... Try something abit simpler.
http://forum.sa-mp.com/index.php?topic=119947.0