SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help > Tutorials

Reply
 
Thread Tools Display Modes
Old 04/09/2009, 06:57 AM   #81
amrour
Little Clucker
 
Join Date: May 2008
Posts: 47
Reputation: 0
Default Re: Tutorial -> Creating a new NPC

my npc spawns where players spawn and just stands there, any ideas what i did wrong?
amrour is offline   Reply With Quote
Old 04/09/2009, 08:19 AM   #82
kc
Gangsta
 
kc's Avatar
 
Join Date: Aug 2007
Posts: 618
Reputation: 115
Default Re: Tutorial -> Creating a new NPC

To everyone with the "my NPC just stands there" problem, post your OnPlayerSpawn callbacks.
kc is offline   Reply With Quote
Old 04/09/2009, 08:34 AM   #83
amrour
Little Clucker
 
Join Date: May 2008
Posts: 47
Reputation: 0
Default Re: Tutorial -> Creating a new NPC

Quote:
Originally Posted by kc
To everyone with the "my NPC just stands there" problem, post your OnPlayerSpawn callbacks.
Code:
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("MyFirstNPC", "NPC_Lenny", true)) //Checking if the NPC's name is MyFirstNPC
 {
 PutPlayerInVehicle(0, MyFirstNPCVehicle, 0); //Putting the NPC into the vehicle we created for it.
 }
 for (new i = 0; i < MAX_PLAYERS; i++)
 {
 if(IsPlayerConnected(i))
 {
  SetPlayerFightingStyle(i,6);
 }
 return 1;
}
 SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL, 0);
 SetPlayerSkillLevel(playerid, WEAPONSKILL_PISTOL_SILENCED, 0);
 SetPlayerSkillLevel(playerid, WEAPONSKILL_DESERT_EAGLE, 0);
 SetPlayerSkillLevel(playerid, WEAPONSKILL_SHOTGUN, 0);
 SetPlayerSkillLevel(playerid, WEAPONSKILL_SAWNOFF_SHOTGUN, 0);
 SetPlayerSkillLevel(playerid, WEAPONSKILL_SPAS12_SHOTGUN, 0);
 SetPlayerSkillLevel(playerid, WEAPONSKILL_MICRO_UZI, 0);
 SetPlayerSkillLevel(playerid, WEAPONSKILL_MP5, 0);
 SetPlayerSkillLevel(playerid, WEAPONSKILL_AK47, 0);
 SetPlayerSkillLevel(playerid, WEAPONSKILL_M4, 0);
 SetPlayerSkillLevel(playerid, WEAPONSKILL_SNIPERRIFLE, 0);
 GivePlayerMoney(playerid, 10000);
 SetPlayerInterior(playerid,0);
 return 1;
 }
}
amrour is offline   Reply With Quote
Old 04/09/2009, 08:37 AM   #84
kc
Gangsta
 
kc's Avatar
 
Join Date: Aug 2007
Posts: 618
Reputation: 115
Default Re: Tutorial -> Creating a new NPC

ok, I see 2 problems with that.

change...

pawn Code:
if(!strcmp("MyFirstNPC", "NPC_Lenny", true)) //Checking if the NPC's name is MyFirstNPC
 {
 PutPlayerInVehicle(0, MyFirstNPCVehicle, 0); //Putting the NPC into the vehicle we created for it.
 }

to


pawn Code:
if(!strcmp(npcname, "NPC_Lenny", true)) //Checking if the NPC's name is MyFirstNPC
 {
 PutPlayerInVehicle(playerid, MyFirstNPCVehicle, 0); //Putting the NPC into the vehicle we created for it.
 }
kc is offline   Reply With Quote
Old 04/09/2009, 03:31 PM   #85
Cedimedi
Huge Clucker
 
Join Date: Jun 2009
Posts: 362
Reputation: 0
Default Re: Tutorial -> Creating a new NPC

pawn Code:
#pragma tabsize 0
#include <a_samp>

new MyFirstNPCVehicle;
public OnFilterScriptInit()
{
  print("my filterscript");
  ConnectNPC("MyFirstNPC","HydraPilot");
  MyFirstNPCVehicle = CreateVehicle(520, 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;
}


All should be correct, but it don't work, the player stays still at the spawnpoint!!
Cedimedi is offline   Reply With Quote
Old 04/09/2009, 06:38 PM   #86
ft941
Big Clucker
 
Join Date: Feb 2009
Posts: 103
Reputation: 0
Default Re: Tutorial -> Creating a new NPC

Hi! I'm Italian and I'm using a translator



My problem is this:
the car driven by my own ncp disappears and reappears after a few seconds automatically recovering within the NCP. I can not understand why!
ft941 is offline   Reply With Quote
Old 04/09/2009, 06:46 PM   #87
kc
Gangsta
 
kc's Avatar
 
Join Date: Aug 2007
Posts: 618
Reputation: 115
Default Re: Tutorial -> Creating a new NPC

Quote:
Originally Posted by ft941
Hi! I'm Italian and I'm using a translator



My problem is this:
the car driven by my own ncp disappears and reappears after a few seconds automatically recovering within the NCP. I can not understand why!
A few have reported that problem. I don't know what causes it as of yet.

It could be to do with spawning trains with CreateVehicle and not AddStaticVehicle though.

Quote:
Originally Posted by Cedimedi
All should be correct, but it don't work, the player stays still at the spawnpoint!!
Do you have a file called HydraPilot.rec in your /npcmodes/recordings/ directory?

Is the player sitting at the spawnpoint in the vehicle, or on foot?
kc is offline   Reply With Quote
Old 04/09/2009, 06:52 PM   #88
Cedimedi
Huge Clucker
 
Join Date: Jun 2009
Posts: 362
Reputation: 0
Default Re: Tutorial -> Creating a new NPC

Yes i have, and yes its in a vehicle.
Cedimedi is offline   Reply With Quote
Old 04/09/2009, 06:59 PM   #89
ft941
Big Clucker
 
Join Date: Feb 2009
Posts: 103
Reputation: 0
Default Re: Tutorial -> Creating a new NPC

I tried to use AddStaticVehicle but nothing changes.
The problem may be due to my gamemode?
ft941 is offline   Reply With Quote
Old 04/09/2009, 07:57 PM   #90
SFather
Little Clucker
 
Join Date: May 2006
Posts: 19
Reputation: 0
Default Re: Tutorial -> Creating a new NPC

can bots use animations?

I have recorded action of foot with using of animations, and the result is just walking, and no animations. Preloading animation libraries don't help too. Or I just trying for nothing?
SFather is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
need help with NPC creating the_zande Help Archive 2 09/07/2010 11:44 PM
help creating a new gm Lookin Help Archive 8 16/06/2010 03:23 PM
I need a tut on creating kujox32 Help Archive 0 05/05/2010 02:16 AM
Creating Box VirSpectorX Help Archive 5 15/04/2010 02:47 PM
Help creating my own... x.X.LEGENDARIO.X.x Everything and Nothing 20 06/02/2010 03:40 PM


All times are GMT. The time now is 01:13 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.