NPC's Animations problem.
#1

Hello everyone.
My problem is that my "npc" I put together in a script and I do not know where or how should I put the commands. Please can anyone tell me how?

Here is my scrib:

Quote:

//-------------------------------------------------
//
// NPC initialisation for Grand Larceny
//
//-------------------------------------------------

#pragma tabsize 0
#include <a_samp>

//-------------------------------------------------

public OnFilterScriptInit()
{
ConnectNPC("guy1a","guy1");
ConnectNPC("guy2a","guy2");
ConnectNPC("guy3a","guy3");

ConnectNPC("guy4a","guy4");

// Testing
//ConnectNPC("TestIdle","onfoot_test");
//ConnectNPC("TaxiTest","mat_test");

return 1;
}

//-------------------------------------------------
// IMPORTANT: This restricts NPCs connecting from
// an IP address outside this server. If you need
// to connect NPCs externally you will need to modify
// the code in this callback.

public OnPlayerConnect(playerid)
{
if(IsPlayerNPC(playerid)) {
new ip_addr_npc[64+1];
new ip_addr_server[64+1];
GetServerVarAsString("bind",ip_addr_server,64);
GetPlayerIp(playerid,ip_addr_npc,64);

if(!strlen(ip_addr_server)) {
ip_addr_server = "127.0.0.1";
}

if(strcmp(ip_addr_npc,ip_addr_server,true) != 0) {
// this bot is remote connecting
printf("NPC: Got a remote NPC connecting from %s and I'm kicking it.",ip_addr_npc);
Kick(playerid);
return 0;
}
printf("NPC: Connection from %s is allowed.",ip_addr_npc);
}

return 1;
}

//-------------------------------------------------

public OnPlayerRequestClass(playerid, classid)
{
if(!IsPlayerNPC(playerid)) return 0; // We only deal with NPC players in this script

new playername[64];
GetPlayerName(playerid,playername,64);

if(!strcmp(playername,"guy1a",true)) {
SetSpawnInfo(playerid,0,100,1953.2028,-2338.2466,16.7901,129.2776,0,0,0,0,0,0);
}
else if(!strcmp(playername,"guy2a",true)) {
SetSpawnInfo(playerid,0,159,1954.6483,-2343.6621,17.2891,143.3777,0,0,0,0,0,0);
}
else if(!strcmp(playername,"guy3a",true)) {
SetSpawnInfo(playerid,0,59,1954.0103,-2328.2612,16.5399,39.9768,0,0,0,0,0,0);
}
else if(!strcmp(playername,"guy4a",true)) {
SetSpawnInfo(playerid,0,11,1956.6311,-2329.3193,17.5657,89.3156,0,0,0,0,0,0);
}

return 0;
}

//-------------------------------------------------

public OnPlayerSpawn(playerid)
{
if(!IsPlayerNPC(playerid)) return 1; // We only deal with NPC players in this script

new playername[64];
GetPlayerName(playerid,playername,64);

if(!strcmp(playername,"guy1a",true)) {
SetPlayerColor(playerid,0xFFFFFFFF);
}
else if(!strcmp(playername,"guy2a",true)) {
SetPlayerColor(playerid,0xFFFFFFFF);
}
else if(!strcmp(playername,"guy3a",true)) {
SetPlayerColor(playerid,0xFFFFFFFF);
}
else if(!strcmp(playername,"guy4a",true)) {
SetPlayerColor(playerid,0xFFFFFFFF);
}

return 1;
}

//-------------------------------------------------
// EOF

Pls anyone can say me where I should have put this?

Quote:

ApplyAnimation(playerid,"Attractors","Stepsit_in", 4.1,0,0,0,1,0);

pls help me
Reply
#2

pawn Код:
public OnPlayerSpawn(playerid)
{
if(!IsPlayerNPC(playerid)) return 1; // We only deal with NPC players in this script

new playername[64];
GetPlayerName(playerid,playername,64);

if(!strcmp(playername,"guy1a",true)) {
SetPlayerColor(playerid,0xFFFFFFFF);
ApplyAnimation(playerid,"Attractors","Stepsit_in", 4.1,0,0,0,1,0);
}
else if(!strcmp(playername,"guy2a",true)) {
SetPlayerColor(playerid,0xFFFFFFFF);
ApplyAnimation(playerid,"Attractors","Stepsit_in", 4.1,0,0,0,1,0);
}
else if(!strcmp(playername,"guy3a",true)) {
SetPlayerColor(playerid,0xFFFFFFFF);
ApplyAnimation(playerid,"Attractors","Stepsit_in", 4.1,0,0,0,1,0);
}
else if(!strcmp(playername,"guy4a",true)) {
SetPlayerColor(playerid,0xFFFFFFFF);
ApplyAnimation(playerid,"Attractors","Stepsit_in", 4.1,0,0,0,1,0);
}

return 1;
}
Reply
#3

Didn't work :/.

I recorded with /ofrecord but the subject is not moving.

I tried making the bot to start to do an action, then walk a few feet and then do another action, but the bot does not move, just stand there doing nothing. їMaybe be another factor I did not do well?

To me, the NPC that works for me were the car drivers, the vrecord.
but the ofrecord don't move. Any idea what might be?

pls help me
Reply
#4

This tutorial might help you https://sampforum.blast.hk/showthread.php?tid=95034
Reply
#5

Quote:
Originally Posted by JS_Joker
Посмотреть сообщение
Didn't work :/.

I recorded with /ofrecord but the subject is not moving.

I tried making the bot to start to do an action, then walk a few feet and then do another action, but the bot does not move, just stand there doing nothing. їMaybe be another factor I did not do well?

To me, the NPC that works for me were the car drivers, the vrecord.
but the ofrecord don't move. Any idea what might be?

pls help me
I thought you make NPC without record file.
Instead using record file, I guess SetPlayerVelocity would be usefull. It depend on you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)