SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 17/08/2011, 02:06 AM   #1001
jat1801
Big Clucker
 
jat1801's Avatar
 
Join Date: Jul 2007
Location: United States of America
Posts: 67
Reputation: 1
Default Re: Creating a new NPC

Help please I have two npc's but only one joins and goes into their vehicle.
This is the code
Code:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid))
	{
		if(strcmp(PlayerName(playerid), "[BOT]Dave") == 0)
		{
		    PutPlayerInVehicle(playerid,NPCBike,0);
		    SetPlayerColor(playerid,COLOR_DARKOLIVEGREEN);
		    SetPlayerSkin(playerid,50);
		    IsSpawned[playerid] =1;
		    print("[NPC SPAWN] Dave as been added.");
		}
		return 1;
	}
    if(IsPlayerNPC(playerid))
	{
		if(strcmp(PlayerName(playerid), "[BOT]Billy") == 0)
		{
		    PutPlayerInVehicle(playerid,NPCTram,0);
		    SetPlayerColor(playerid,COLOR_DARKOLIVEGREEN);
		    SetPlayerSkin(playerid,255);
		    IsSpawned[playerid] =1;
		    print("[NPC SPAWN] Billy has been placed in his tram.");
		}
		return 1;
	}
Please help me.
jat1801 is offline   Reply With Quote
Old 17/08/2011, 06:51 PM   #1002
Setkus
Big Clucker
 
Setkus's Avatar
 
Join Date: Oct 2010
Location: Lithuania
Posts: 121
Reputation: 0
Default Re: Creating a new NPC

Hey
I have a problem with NPC. Well, i made my file with name soldier and i connect my npc, he's connecting everything okey, but he is standing in spawn point. Is this possible that my file is too big? Help me please
__________________
Well, have a nice day!

Los Santos: 82.135.230.10:1111
Setkus is offline   Reply With Quote
Old 17/08/2011, 06:59 PM   #1003
Setkus
Big Clucker
 
Setkus's Avatar
 
Join Date: Oct 2010
Location: Lithuania
Posts: 121
Reputation: 0
Default Re: Creating a new NPC

Someone, please help me!
__________________
Well, have a nice day!

Los Santos: 82.135.230.10:1111
Setkus is offline   Reply With Quote
Old 23/08/2011, 12:30 PM   #1004
Macros50
Little Clucker
 
Macros50's Avatar
 
Join Date: Sep 2010
Location: Italy
Posts: 35
Reputation: 0
Default Re: Creating a new NPC

Nice tutorial. Any question: How i can set the skin of my bot? I have 8 bot and all 8 in vehicle and all are with skin of CJ xD. How i can set another skin in these bots? Thanks!
Macros50 is offline   Reply With Quote
Old 23/08/2011, 01:23 PM   #1005
System64
Gangsta
 
System64's Avatar
 
Join Date: May 2011
Location: Zadar, Croatia
Posts: 933
Reputation: 143
Default Re: Creating a new NPC

SetPlayerSkin....
__________________
All my works
I left SA:MP! Maybe once I start scripting again but now I'm based on web programming
Soon, I'll buy domain system32.com.hr but for now you can contact me on LogoOff or on my Youtube channel!
System64 is offline   Reply With Quote
Old 24/08/2011, 06:24 AM   #1006
Macros50
Little Clucker
 
Macros50's Avatar
 
Join Date: Sep 2010
Location: Italy
Posts: 35
Reputation: 0
Default Re: Creating a new NPC

Thanks System64
Macros50 is offline   Reply With Quote
Old 30/08/2011, 12:16 PM   #1007
sherlock
Gangsta
 
sherlock's Avatar
 
Join Date: Aug 2010
Location: United Kingdom
Posts: 900
Reputation: 60
Default Re: Creating a new NPC

Quote:
Originally Posted by Macros50 View Post
Thanks System64
or you can change your skin and the npc will be with that skin (it is on my server anyway)

ex:if i am cj when i record the npc will be cj
__________________


sherlock is offline   Reply With Quote
Old 04/09/2011, 01:48 AM   #1008
bomm89
Big Clucker
 
bomm89's Avatar
 
Join Date: Nov 2010
Posts: 90
Reputation: 0
Default Re: Creating a new NPC

Guys, if you follow the tutorial, the NPC will work, it works on my server...
__________________
Server: Universe Roleplay
Executive Admin Justin
Famous Quote about myself
  • "You really a hard worker." Quoted by Mike Paterson
  • "You were such a Kick ass Deputy." Quoted by John Martins
  • "Best of the best!" Quoted by the retired Chief Matt Barnes

Server IP: 173.192.206.137:8300
bomm89 is offline   Reply With Quote
Old 04/09/2011, 10:04 AM   #1009
whitedragon
Gangsta
 
Join Date: Sep 2009
Posts: 516
Reputation: 2
Default Re: Creating a new NPC

Quote:
Originally Posted by jat1801 View Post
Help please I have two npc's but only one joins and goes into their vehicle.
This is the code
Code:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid))
	{
		if(strcmp(PlayerName(playerid), "[BOT]Dave") == 0)
		{
		    PutPlayerInVehicle(playerid,NPCBike,0);
		    SetPlayerColor(playerid,COLOR_DARKOLIVEGREEN);
		    SetPlayerSkin(playerid,50);
		    IsSpawned[playerid] =1;
		    print("[NPC SPAWN] Dave as been added.");
		}
		return 1;
	}
    if(IsPlayerNPC(playerid))
	{
		if(strcmp(PlayerName(playerid), "[BOT]Billy") == 0)
		{
		    PutPlayerInVehicle(playerid,NPCTram,0);
		    SetPlayerColor(playerid,COLOR_DARKOLIVEGREEN);
		    SetPlayerSkin(playerid,255);
		    IsSpawned[playerid] =1;
		    print("[NPC SPAWN] Billy has been placed in his tram.");
		}
		return 1;
	}
Please help me.
Try
pawn Code:
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid))
    {
        if(strcmp(PlayerName(playerid), "[BOT]Dave") == 0)
        {
            PutPlayerInVehicle(playerid,NPCBike,0);
            SetPlayerColor(playerid,COLOR_DARKOLIVEGREEN);
            SetPlayerSkin(playerid,50);
            IsSpawned[playerid] =1;
            print("[NPC SPAWN] Dave as been added.");
                    return 1;
        }
        if(strcmp(PlayerName(playerid), "[BOT]Billy") == 0)
        {
            PutPlayerInVehicle(playerid,NPCTram,0);
            SetPlayerColor(playerid,COLOR_DARKOLIVEGREEN);
            SetPlayerSkin(playerid,255);
            IsSpawned[playerid] =1;
            print("[NPC SPAWN] Billy has been placed in his tram.");
                    return 1;
        }
                return 1;
    }
__________________
If i have typos sry but dont have time to do spellcheck
whitedragon is offline   Reply With Quote
Old 06/09/2011, 01:31 PM   #1010
DeadDon
Banned
 
Join Date: Jul 2011
Location: www.deaddon.net
Posts: 103
Reputation: 88
Default Re: Creating a new NPC

You dont have OnPlayerSpawn info for just usual NPCs without vehicles. -.-"
My bot just stands at spawn place, but he is not recorded driving cars.
DeadDon 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 11:04 AM.


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