SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 14/03/2018, 07:47 PM   #1121
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   #1122
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   #1123
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 12:54 AM.


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