[Tutorial] Creating a new NPC

getting this

Quote:

D:\Danish Q\SA-MP Scripts\Deathmatch Server\gamemodes\DM.pwn(24) : warning 235: public function lacks forward declaration (symbol "OnRecordingPlaybackEnd")
D:\Danish Q\SA-MP Scripts\Deathmatch Server\gamemodes\DM.pwn(24) : error 017: undefined symbol "StartRecordingPlayback"
D:\Danish Q\SA-MP Scripts\Deathmatch Server\gamemodes\DM.pwn(30) : warning 235: public function lacks forward declaration (symbol "OnNPCSpawn")
D:\Danish Q\SA-MP Scripts\Deathmatch Server\gamemodes\DM.pwn(30) : error 017: undefined symbol "StartRecordingPlayback"

Reply

PHP Code:
public OnPlayerRequestClass(playeridclassid)
{
    if(
IsPlayerNPC(playerid))
    {
        new 
npc_name[24];
        
GetPlayerName(playerid,npc_name,sizeof(npc_name));
        if(!
strcmp(npc_name,"Pablas",false)) SetSpawnInfo(playerid, -1,17, -1448.2899171494.7772226.099233,0.0, -1, -1, -1, -1, -1, -1);
    }   
    return 
1;

PHP Code:
[21:13:59] [npc:joinPablas has joined the server (0:127.0.0.1)
[
21:14:00] [npc:partPablas has left the server (0:2
Reply

Very useful

Thanks. repfou
Reply

Nice Tutorial.
Reply

says only incoming message. It doesn't join. What should i do?
Reply

Quite useful and quality guide. Good job.
Reply

How to get unlimited nitrogen
Reply

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;
}

Reply

Thankyou
Reply

When NPC Connects It Disconects.Help Me Please
Reply

Can anyone give me the correct code of allowing NPCs through login / register area?
Reply

Nice tutorial, Actually I used it
Reply

MY NPC does not spawn,
Is it because of OnPlayerSpawn?
I didn't add anything on it
Reply

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://sampwiki.blast.hk/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.
Reply

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
Reply

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
Reply

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
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)