Help with NPC - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with NPC (
/showthread.php?tid=162181)
Help with NPC -
nielsbon1 - 22.07.2010
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
Re: Help with NPC -
xfelipex - 22.07.2010
"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
Re: Help with NPC -
nielsbon1 - 22.07.2010
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;
}
Re: Help with NPC -
nielsbon1 - 22.07.2010
Ok i fixed one error but still it wont work