SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 06/03/2015, 12:01 PM   #1111
Devil143
Little Clucker
 
Join Date: Jan 2015
Posts: 6
Reputation: 0
Default Re: Creating a new NPC

I'm having error 017..How to solve..

\gamemodes\grandlarc.pwn(93) : error 017: undefined symbol "AkashVehicle"

Quote:
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, "Akash", true)) //Checking if the NPC's name is MyFirstNPC
{
PutPlayerInVehicle(playerid, AkashVehicle, 0); //Putting the NPC into the vehicle we created for it.
}
return 1;
}
Devil143 is offline   Reply With Quote
Old 15/03/2015, 11:52 PM   #1112
edwardluciano
Big Clucker
 
edwardluciano's Avatar
 
Join Date: Oct 2012
Location: Thailand
Posts: 99
Reputation: 0
Default Re: Creating a new NPC

Thankyou
edwardluciano is offline   Reply With Quote
Old 07/06/2015, 05:43 PM   #1113
Pearson
Banned
 
Join Date: Jun 2015
Location: AUSTRALIA, SYDNEY
Posts: 283
Reputation: 30
Default Re: Creating a new NPC

When NPC Connects It Disconects.Help Me Please
Pearson is offline   Reply With Quote
Old 16/07/2015, 03:17 AM   #1114
ammaz
Little Clucker
 
ammaz's Avatar
 
Join Date: Jan 2015
Location: Pakistan
Posts: 16
Reputation: 0
Default Re: Creating a new NPC

Can anyone give me the correct code of allowing NPCs through login / register area?
ammaz is offline   Reply With Quote
Old 09/08/2015, 01:46 PM   #1115
MohammedZ
Big Clucker
 
Join Date: Jun 2015
Posts: 80
Reputation: 5
Default Re: Creating a new NPC

Nice tutorial, Actually I used it
__________________
MohammedZ is offline   Reply With Quote
Old 08/09/2016, 10:03 AM   #1116
Gotham
Huge Clucker
 
Gotham's Avatar
 
Join Date: Aug 2016
Location: India
Posts: 216
Reputation: 6
Default Re: Creating a new NPC

MY NPC does not spawn,
Is it because of OnPlayerSpawn?
I didn't add anything on it
Gotham is offline   Reply With Quote
Old 08/09/2016, 10:57 AM   #1117
FreAkeD
Gangsta
 
FreAkeD's Avatar
 
Join Date: May 2012
Location: Australia
Posts: 630
Reputation: 87
Default Re: Creating a new NPC

Quote:
Originally Posted by Gotham View Post
MY NPC does not spawn,
Is it because of OnPlayerSpawn?
I didn't add anything on it
https://wiki.sa-mp.com/wiki/OnPlayerSpawn

OnPlayerSpawn is called when a player or NPC in the case of this tutorial is spawned, so try adding the OnPlayerSpawn code and see if it worked.
FreAkeD is offline   Reply With Quote
Old 14/03/2018, 07:47 PM   #1118
yonik1988
Little Clucker
 
Join Date: Dec 2014
Posts: 7
Reputation: 0
Question need help with the second and therd npc

all the npc joins the server buth onli first one enters the vehicle ( tram ) the other 2 just stai in the spwn area here is my scripting

new Nea_spagatuVehicle; //Global variable!
new AndreyVehicle; //Global variable!
new LocotenentuVehicle; //Global variable!

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=OnPlayerSpawn=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

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, "Nea_spagatu", true)) //Checking if the NPC's name is MyFirstNPC
{
PutPlayerInVehicle(playerid, Nea_spagatuVehicle, 0); //Putting the NPC into the vehicle we created for it.
}
return 1;
}
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
if(!strcmp(npcname, "Andrey", true))
{
PutPlayerInVehicle(playerid, AndreyVehicle, 0);
return 1;
}

GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
if(!strcmp(npcname, "Locotenentu", true))
{
PutPlayerInVehicle(playerid, LocotenentuVehicle, 0);
return 1;
}
if(IsPlayerNPC(playerid))
{
SetPlayerSkin(playerid,PlayerInfo[playerid][pChar]);
GivePlayerWeapon(playerid,30,99999);
return 1;
}
etc

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=OnGameModeInit=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
public OnGameModeExit()
{

print("my gamemode");
ConnectNPC("Nea_Spagatu","yonik17");
Nea_spagatuVehicle = CreateVehicle(449, 0.0, 0.0, 7.0, 0.0, 249, 7, 5000);

print("my gamemode");
ConnectNPC("Locotenentu","airport");
LocotenentuVehicle = CreateVehicle(497, 0.0, 0.0, 7.0, 0.0, 231, 3, 5000);

print("my gamemode");
ConnectNPC("Andrey","buss");
AndreyVehicle = CreateVehicle(431, 0.0, 0.0, 7.0, 0.0, 2423, 5, 5000);

i have created the vehle myself, if i do not create them it does not create the vehile and now that i have create them it changes the id of all other vehiles how can i fix all this please

Last edited by yonik1988; 14/03/2018 at 11:18 PM.
yonik1988 is offline   Reply With Quote
Old 30/06/2018, 10:57 PM   #1119
yonik1988
Little Clucker
 
Join Date: Dec 2014
Posts: 7
Reputation: 0
Question Re: Creating a new NPC

hello there, i have a question, how many vehicle can you create for npc's and if more then 1 then how, i have created some npc's and 2 of them are in vehicle or it shold be buth only 1 vehilce is created and i can put the npc in it the second vehicle is not created... the problem is that i wanet to create event the theard viehicle and put a npc in it buth since i can not make the second vehicle ....so please help
yonik1988 is offline   Reply With Quote
Old 01/07/2018, 04:04 PM   #1120
yonik1988
Little Clucker
 
Join Date: Dec 2014
Posts: 7
Reputation: 0
Default Re: Creating a new NPC

Problem solved i have done it ... this is the new scripting
new Nea_spagatuVehicle; //Global variable!
new Nea_stranutVehicle; //Global variable!
new Nea_caisaVehicle; //Global variable!

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,"Nea_spagatu",false))
{
SetPlayerSkin(playerid, 61); // your skin choice for NPC
}
if(!strcmp(npcname,"gina",false))
{
SetPlayerSkin(playerid, 55); // your skin choice for NPC
}
if(!strcmp(npcname,"Elvis1",false))
{
SetPlayerSkin(playerid, 80); // your skin choice for NPC
}
if(!strcmp(npcname,"Elvis2",false))
{
SetPlayerSkin(playerid, 81); // your skin choice for NPC
}
if(!strcmp(npcname,"mirela",false))
{
SetPlayerSkin(playerid, 63); // your skin choice for NPC
}
if(!strcmp(npcname,"narcisa",false))
{
SetPlayerSkin(playerid, 90); // your skin choice for NPC
}
if(!strcmp(npcname,"coredelusa",false))
{
SetPlayerSkin(playerid, 91); // your skin choice for NPC
}
if(!strcmp(npcname,"mirabela",false))
{
SetPlayerSkin(playerid, 91); // your skin choice for NPC
}
if(!strcmp(npcname,"frosa",false))
{
SetPlayerSkin(playerid, 89); // your skin choice for NPC
}
if(!strcmp(npcname,"peste",false))
{
SetPlayerSkin(playerid, 100); // your skin choice for NPC
}
if(!strcmp(npcname,"meclaren",false))
{
SetPlayerSkin(playerid, 122); // your skin choice for NPC
}
if(!strcmp(npcname,"nino",false))
{
SetPlayerSkin(playerid, 114); // your skin choice for NPC
}
if(!strcmp(npcname,"puiutzu",false))
{
SetPlayerSkin(playerid, 144); // your skin choice for NPC
}
if(!strcmp(npcname,"gigi",false))
{
SetPlayerSkin(playerid, 156); // your skin choice for NPC
}
if(!strcmp(npcname,"Nea_stranut",false))
{
SetPlayerSkin(playerid, 274); // your skin choice for NPC
}
if(!strcmp(npcname,"Nea_caisa",false))
{
SetPlayerSkin(playerid, 253); // your skin choice for NPC
}
if(!strcmp(npcname, "Nea_spagatu", true)) //Checking if the NPC's name is MyFirstNPC
{
PutPlayerInVehicle(playerid, Nea_spagatuVehicle, 0); //Putting the NPC into the vehicle we created for it.
}
if(!strcmp(npcname, "Nea_stranut", true)) //Checking if the NPC's name is MyFirstNPC
{
PutPlayerInVehicle(playerid, Nea_stranutVehicle, 0); //Putting the NPC into the vehicle we created for it.
}
if(!strcmp(npcname, "Nea_caisa", true)) //Checking if the NPC's name is MyFirstNPC
{
PutPlayerInVehicle(playerid, Nea_caisaVehicle, 0); //Putting the NPC into the vehicle we created for it.
}
return 1;
}

if(IsPlayerNPC(playerid))
{
SetPlayerSkin(playerid,PlayerInfo[playerid][pChar]);
GivePlayerWeapon(playerid,30,99999);
return 1;
}

//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=OnGameModeInit=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
public OnGameModeExit()
{

print("my gamemode");
ConnectNPC("Nea_spagatu","yonik17");
Nea_spagatuVehicle = CreateVehicle(449, 0.0, 0.0, 7.0, 0.0, 249, 7, 5000);

print("my gamemode");
ConnectNPC("Nea_stranut","pilot");
Nea_stranutVehicle = CreateVehicle(487, 0.0, 0.0, 7.0, 0.0, 1, 1, 5000);

print("my gamemode");
ConnectNPC("Nea_caisa","soferu");
Nea_caisaVehicle = CreateVehicle(431, 0.0, 0.0, 7.0, 0.0, 1, 1, 5000);


i have added skins to... i tried to do this for a few years now ... thx for nothing
yonik1988 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 02:31 AM.


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