SA-MP Forums Archive
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: NPC (/showthread.php?tid=263908)



NPC - =WoR=Varth - 24.06.2011

Okay I give up. I'd tried many way to create static NPC but I can't find the worked one.
How can I make a static NPC (Without record, just stand still) and set their position?


EDIT: SetMyPos didn't worked.


Re: NPC - [MG]Dimi - 24.06.2011

Why not recording NPC for sec how he is standing still and then set it to repeat playback?


Re: NPC - Markx - 24.06.2011

just stand still, record it and then follow the tutorial


Re: NPC - boelie - 24.06.2011

In your gamemode under onplayerspawn you could do

pawn Код:
if(IsPlayerNPC,playerid))
{SetPlayerPos(,playerid,blalblabla (location)}
or use setspawninfo elsewhere


Re: NPC - =WoR=Varth - 24.06.2011

Quote:
Originally Posted by Markx
Посмотреть сообщение
just stand still, record it and then follow the tutorial
Quote:
Originally Posted by [MG]Dimi
Посмотреть сообщение
Why not recording NPC for sec how he is standing still and then set it to repeat playback?
I did that, and that's didn't worked.
I did 1 second recording in random place then use SetMyPos but no they aren't TP'ed to the location I given.

Quote:
Originally Posted by boelie
Посмотреть сообщение
In your gamemode under onplayerspawn you could do

pawn Код:
if(IsPlayerNPC,playerid))
{SetPlayerPos(,playerid,blalblabla (location)}
or use setspawninfo elsewhere
I did this too.
SetSpawnInfo didn't worked.
SetPlayerPos still the same.


Re: NPC - boelie - 24.06.2011

i asume they spawn at the spawn point then ?


Re: NPC - =WoR=Varth - 24.06.2011

They spawn at the place where I record them.


Re: NPC - GangsTa_ - 24.06.2011

View this, and you should understand, else nothing nice will result:

https://sampforum.blast.hk/showthread.php?tid=95034


AW: NPC - Nero_3D - 24.06.2011

You dont need any record for that, just connect a npc with the npcidle.pwn (which is basically empty)

pawn Код:
ConnectNPC("IDLER","npcidle");
than just do what the other told you

pawn Код:
new idler; //not needed if you only got one npc
pawn Код:
//OnPlayerConnect
    if(IsPlayerNPC(playerid)) {
        new //or any kind of counter
            name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof name);
        if(strcmp(name, "IDLER", false) == 0) {
            idler = playerid;
        }
    } else {
        //code
    }
    return true;
pawn Код:
//OnPlayerSpawn
    if(IsPlayerNPC(playerid)) {
        if(playerid == idler) {
            SetPlayerPos(playerid, 0.0, 0.0, 2.5);
        }
    } else {
        //code
    }
    return true;



Re: AW: NPC - =WoR=Varth - 24.06.2011

Quote:
Originally Posted by GangsTa_
Посмотреть сообщение
View this, and you should understand, else nothing nice will result:

https://sampforum.blast.hk/showthread.php?tid=95034
That's my ver very first guide about NPC and didn't helped

Quote:
Originally Posted by Nero_3D
Посмотреть сообщение
You dont need any record for that, just connect a npc with the npcidle.pwn (which is basically empty)

pawn Код:
ConnectNPC("IDLER","npcidle");
than just do what the other told you

pawn Код:
new idler; //not needed if you only got one npc
pawn Код:
//OnPlayerConnect
    if(IsPlayerNPC(playerid)) {
        new //or any kind of counter
            name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof name);
        if(strcmp(name, "IDLER", false) == 0) {
            idler = playerid;
        }
    } else {
        //code
    }
    return true;
pawn Код:
//OnPlayerSpawn
    if(IsPlayerNPC(playerid)) {
        if(playerid == idler) {
            SetPlayerPos(playerid, 0.0, 0.0, 2.5);
        }
    } else {
        //code
    }
    return true;
And guess what? This one is works
Thanks