Help with NPC
#1

I got the basic coding skills already.
But now i try to figure it out how to do some NPC's.
I watched the tutorial and i can already spawn one and let him drive or walk.

But i want to set his skins and if someone's say "can you open the gate".
That he first say show me first your badge.
But where i have to put the code in? In the NPC models,
Or in the gamemode?

Thanx for responds
Reply
#2

"can you open the gate" have to code according questins / answers, it'd be easier with input dialog , but this is about something else ;x ; About set skins , do as well :
Код:
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, "Leatherface", true)) // Checks by npc name =D
	{
	SetPlayerSkin(playerid,162); // Id 162 = similar to leatherface's one
	return 1;
	}
return 1; 
}
Just a example
Reply
#3

Ok it worked thanks.
And how i make so when i say hello sir to the npc,
He responds with some text? i tried this but it gives error:

public OnPlayerText(playerid, text[])
{
if (strfind(text, "Hello officer,?") != -1)
{
new string[80], name[MAX_PLAYER_NAME];
format(string, sizeof(string), "Hello.");
SendChat(string);
return 0;
}
Reply
#4

Ok i fixed one error but still it wont work
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)