how to put exactly
#1

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
Reply
#2

... 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.
Reply
#3

i mean how to put in OnePlayerSpawn sorry was my error posting
Reply
#4

Just put it on OnPlayerSpawn
whats hard in that ?
Reply
#5

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;
}
Reply
#6

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.
Reply
#7

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);
Reply
#8

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.
Reply
#9

It's not an error but a warning, check the pawn documentation for information about errors.
Reply
#10

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
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)