SA-MP Forums Archive
CNPC Help, Please! - 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: CNPC Help, Please! (/showthread.php?tid=238408)

Pages: 1 2


CNPC Errors! Please help me! - Sasino97 - 11.03.2011

Hi, I want to add CNPCs (plugin by Alex009, m0niSx and adamis) to my server, and I scripted this:

pawn Код:
#include <cnpc>

public OnGameModeInit()
{
  CreateNPCPlayer(150,"CNPC_1");
  return 1;
}
public OnNPCSpawn(npcid)
{
  StartRecordingPlayback(150, "cnpc_walk1");
  return 1;
}
The CNPC just connects to the server with that name, but it doesn't play the recording.

What should I add?
Please help!

EDIT: Title edited


Re: CNPC Help, Please! - Sasino97 - 11.03.2011

Please I need help!!

What callbacks/functions do I have to add?

I need a help, I want to finish this GM before the end of sunday!


Re: CNPC Help, Please! - Kwarde - 11.03.2011

Well, the recordinplayback thing is used by the standard NPC package. It uses samp_npc.exe or something.
The CNPC was just so good because it didnt use CPU or something, so they are using different ehm stuff (I am the last time confused - I don't know how to write it).
Can't you use 'NPC_WalkTo' etc.?
Then just try to let the NPC walk/drive to a position, and check with OnPlayerUpdate (or if that aint workin a timer) if he's on that pos, and move him again. A little more work but still easy


Re: CNPC Help, Please! - Sasino97 - 11.03.2011

Quote:
Originally Posted by Kwarde
Посмотреть сообщение
Well, the recordinplayback thing is used by the standard NPC package. It uses samp_npc.exe or something.
The CNPC was just so good because it didnt use CPU or something, so they are using different ehm stuff (I am the last time confused - I don't know how to write it).
Can't you use 'NPC_WalkTo' etc.?
Then just try to let the NPC walk/drive to a position, and check with OnPlayerUpdate (or if that aint workin a timer) if he's on that pos, and move him again. A little more work but still easy
Thanks, I'll try now.

Do I have to SpawnPlayer (the npc) on player connect?


Re: CNPC Help, Please! - Infinitas - 11.03.2011

Are you sure the recording is in the recordings folder?


Re: CNPC Help, Please! - Kwarde - 11.03.2011

Quote:
Originally Posted by [GF]Sasino97
Посмотреть сообщение
Thanks, I'll try now.

Do I have to SpawnPlayer (the npc) on player connect?
I don't know. I never work with NPC's. Just try it
But the CNPC's are a bit like normal players, connected on the server (like we connect via our computers/notebooks). I mean, I ever was ID 0 and made a NPC with ID 0 and I'd crash. When he connected, a dialog opened for me. So just do what with normal player would have happened too, I guess.


Re: CNPC Help, Please! - Sasino97 - 11.03.2011

I tried to WalkTo and SetNPCPos etc, but he doesn't spawn!
He's just on the players scoreboard with 12341594134 of ping...


Re: CNPC Help, Please! - Kwarde - 11.03.2011

Rofl. Did you also use "SpawnPlayer(150);" ?


Re: CNPC Help, Please! - Sasino97 - 11.03.2011

I'll add it now xD

EDIT: Function found in cnpc.inc, "SpawnNPC" instead of "SpawnPlayer".

EDIT 2: Server crashed:

Код:

--------------------------

SA-MP Server: 0.3c



Exception At Address: 0x10001ACC



Registers:

EAX: 0x00000000	EBX: 0x00000000	ECX: 0x00000000	EDX: 0x026B1DC8

ESI: 0x01DE0B14	EDI: 0x01DE0FD8	EBP: 0x0018FDB0	ESP: 0x0018FD98

EFLAGS: 0x00010212



Stack:

+0000: 0xFFFFFFFF   0x7FFFFFFF   0x00000000   0x7FFFFFFF

+0010: 0x026B1DC8   0x0018FE10   0x0018FE10   0x100050E0

+0020: 0xC2E4CE5D   0xC4773880   0x658B4840   0x00000000

+0030: 0x00000000   0x00000000   0x026B1DC8   0x00000000

+0040: 0x00000000   0x00000000   0x658C47A4   0x00000001

+0050: 0x00000000   0x00000000   0x00000000   0x00000000

+0060: 0x41C7BDD9   0xC2E4CE5D   0xC4773880   0x00000000

+0070: 0x3B000000   0x0000FFFF   0x0018FE1C   0x10009813

+0080: 0x0000006E   0x0018FE24   0x10008EC1   0x761B10EF

+0090: 0x0047F7C6   0x761B1126   0x761B1653   0x0049820C

+00A0: 0x00000000   0x00001DB0   0x0018FF88   0x7EFDE000

+00B0: 0x0101E000   0x00010101   0x00000064   0x00001E61

+00C0: 0x0000009C   0x00001E90   0x01FC8FE8   0x656D6167

+00D0: 0x65646F6D   0x00003531   0x004CA014   0x004CA010

+00E0: 0x7EFDE000   0x004B4C90   0x0018FE70   0x0018FE68

+00F0: 0x0018FF78   0x004A6BC4   0x004C1348   0xFFFFFFFF

+0100: 0x004A4E81   0x004A4E91   0x004B4C90   0x0018FF78

+0110: 0x004B4911   0xFFFFFFFF   0x004A6662   0x00000001

+0120: 0x01FC1480   0x01FC14D8   0x00000094   0x00000006

+0130: 0x00000001   0x00001DB0   0x00000002   0x00000000



Re: CNPC Help, Please! - Kwarde - 11.03.2011

Try reporting it to them. It's probably a bug in the plugin, I can't help futher .
But those guys who made it 0.3c compatible, weren't sure about everything, because of some codes or something - Well I don't know anything about plugin scripting so ehm. I don't understand that :P


Re: CNPC Help, Please! - Sasino97 - 11.03.2011

I can't report it, the thread got deleted by admins.


Re: CNPC Help, Please! - Retardedwolf - 11.03.2011

Function for you.

pawn Код:
createBot( bID, bName[ MAX_PLAYER_NAME ], Float:X, Float:Y, Float:Z, Float:Rot )
{
    if ( bID == -1 )
        bID = FindLastFreeSlot( );

    CreateNPCPlayer( bID, bName );
    SetSpawnInfo( bID, 0, 0, X, Y, Z, Rot, 0, 0, 0, 0, 0, 0 );
    SpawnNPC( bID );
    //SetPlayerAttachedObject( bID, 0, 18846, 1, 0.000000, 0.158638, 0.000000, 0.000000, 90.000000, 180.000000, 0.405710, 0.548724, 0.258224 );
    return 1;
}
Examples

pawn Код:
public OnGameModeInit( )
{
    AddPlayerClass( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
    createBot( -1, "Haydz", 0, 0, 0, 0 );
    createBot( -1, "is", 0, 0, 0, 0 );
    createBot( -1, "gay", 0, 0, 0, 0 );
    return 1;
}



Re: CNPC Help, Please! - Sasino97 - 11.03.2011

Quote:
Originally Posted by Retardedwolf
Посмотреть сообщение
Function for you.

pawn Код:
createBot( bID, bName[ MAX_PLAYER_NAME ], Float:X, Float:Y, Float:Z, Float:Rot )
{
    if ( bID == -1 )
        bID = FindLastFreeSlot( );

    CreateNPCPlayer( bID, bName );
    SetSpawnInfo( bID, 0, 0, X, Y, Z, Rot, 0, 0, 0, 0, 0, 0 );
    SpawnNPC( bID );
    //SetPlayerAttachedObject( bID, 0, 18846, 1, 0.000000, 0.158638, 0.000000, 0.000000, 90.000000, 180.000000, 0.405710, 0.548724, 0.258224 );
    return 1;
}
Examples

pawn Код:
public OnGameModeInit( )
{
    AddPlayerClass( 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
    createBot( -1, "Haydz", 0, 0, 0, 0 );
    createBot( -1, "is", 0, 0, 0, 0 );
    createBot( -1, "gay", 0, 0, 0, 0 );
    return 1;
}
Crashed


EDIT: I set his id to -1, as you said, and it didn't crash!!!!!!!!!!! ))))))


It spawned!!! But not at the position I said. But it's not important, i'll change X, Y, and Z soon.

REALLY THANKS


Re: CNPC Help, Please! - hadzx - 11.03.2011

have you got cnpc for 0.3c? if so please send me a DL Link because i can only find it for 0.3b thanks


Re: CNPC Help, Please! - Kwarde - 12.03.2011

Quote:
Originally Posted by hadzx
Посмотреть сообщение
have you got cnpc for 0.3c? if so please send me a DL Link because i can only find it for 0.3b thanks
It has been removed by an admin/moderator in due of ... something, they had stolen something I think, and without credits. There was a topic in our board, but that one's removed too (reason: complaining about admin actions. If he didn't nag about it I could've found it back).


Re: CNPC Help, Please! - Sasino97 - 12.03.2011

Quote:
Originally Posted by Kwarde
Посмотреть сообщение
It has been removed by an admin/moderator in due of ... something, they had stolen something I think, and without credits. There was a topic in our board, but that one's removed too (reason: complaining about admin actions. If he didn't nag about it I could've found it back).
It got deleted by admins because it 'memory hacks' the server player's list.


Re: CNPC Help, Please! - Kwarde - 12.03.2011

Ah so that's the reason :P
I knew it was something, but the users that made it 0.3c compatible are also banned, because of ... a script or something That's what I've heard


Re: CNPC Help, Please! - hadzx - 12.03.2011

memory hacks? eek


Re: CNPC Help, Please! - Sasino97 - 12.03.2011

I got other problems:

OnNPCMovingComplete(npcid)

crashes my server if I put something.

I want to do that when CNPC spawns, it walks to x, y and z, And it works

but I also want that when he finishes his walk, he walks back to his hold pos.

Please help =)


Re: CNPC Help, Please! - Roomeo - 12.03.2011

((Sasino Read My PM))