NPC Amimation!!!
#1

i cant find a way for make a npc do anim. i did both use ApplyAnimation or record npc performing an animation. nothing worked. also i tried the IsPlayerStreamedIn with a cmd but with no luck. its on a fs.

2. i have a code which check if a player is near npc. i want to send a msg if player is near npc. on where should i put this code?
Reply
#2

noone? pls help
Reply
#3

Quote:
Originally Posted by billiout
Посмотреть сообщение
noone? pls help
put it in npcmodes folder.

pawn Код:
#include <a_npc>

//------------------------------------------
#define YOUR_DISTANCE 5.0

main()
{
    SetTimer( "Check", 1000, 1 );
}

forward public Check();
public Check()
{
    new Float:npc_pos[3];
    GetMyPos( npc_pos[0], npc_pos[1], npc_pos[2] );
    for( new i = 0 ; i < MAX_PLAYERS ; i ++)
    {
        if( IsPlayerConnected(i) && !IsPlayerNPC(i) )
        {          
            if( IsPlayerInRangeOfPoint( i , YOUR_DISTANCE, npc_pos[0], npc_pos[1], npc_pos[2] ) )          
            {
                SendChat( "Hey~ I wanna take you to a gay bar!" );
            }
        }
    }
}

didn't optimized the code.
Reply
#4

hey your code worked thanks but i have a problem. i dont want the sendchat but the sendclient msg so i put the native to the pwn and with no errors but when i join yhe server the npc is not there. it doent disconnect just is not there this happen only with the sendclientmsg. and do you have any idea for the animation? thanks for helping me
Reply
#5

Quote:
Originally Posted by billiout
Посмотреть сообщение
hey your code worked thanks but i have a problem. i dont want the sendchat but the sendclient msg so i put the native to the pwn and with no errors but when i join yhe server the npc is not there. it doent disconnect just is not theren this happen only with the sendclientmsg. and do you have any idea for the animation? thanks for helping me
I'm afraid I can't help you with animation problem (since i didn't try it)
and a_npc doesn't have SendClientMessage, maybe you need to make a trick with SendCommand() function.
Reply
#6

Код:
stock SendChatEx(playerid,message[])
{
    if ((IsPlayerConnected(playerid)) && (strlen(message) > 0))
	{
    SendChat(message);
    }
    return 1;
}
you think this will work? i mean i dont any other to test if it is working. i want to show it on for the player not in all players for me i didnt have any errors and the for npc i can see it and send the chat.

its impossible to make it on the fs? i mean i dont want the code on the npc.pwn but on my fs.
Reply
#7

Quote:
Originally Posted by billiout
Посмотреть сообщение
Код:
stock SendChatEx(playerid,message[])
{
    if ((IsPlayerConnected(playerid)) && (strlen(message) > 0))
	{
    SendChat(message);
    }
    return 1;
}
you think this will work? i mean i dont any other to test if it is working. i want to show it on for the player not in all players for me i didnt have any errors and the for npc i can see it and send the chat.

its impossible to make it on the fs? i mean i dont want the code on the npc.pwn but on my fs.
SendChat() is same as SendPlayerMessageToAll, so it might not work.
the workaround is to sending commands like /sendchat [npcid] [toplayerid] [color] [message]

pawn Код:
new npc_id;
public OnNPCConnect(myplayerid) npc_id = myplayerid;
stock SendClientMessage( playerid, color, message[] )
{
    new str[256]; //LOL
    format( str, sizeof(str), "/sendclientmessage %d %d %d %s", npc_id, playerid, color, message );
    SendCommand( str );
}
and in your filterscript:

pawn Код:
public OnPlayerCommandText( playerid, cmdtext[] )
{
    if( !strcmp( cmdtext, "/sendclientmessage", true, 18 ) && IsPlayerNPC( playerid ) )
    {
        new npc_id, playerid, color, msg[128], name[MAX_PLAYER_NAME];
        GetPlayerName( playerid, name, sizeof(name) );
        sscanf( cmdtext[19], "iiis", npc_id, playerid, color, msg );
        format( msg, sizeof(msg), "%s(%d) : %s", name, npc_id, msg );
        SendClientMessage( playerid, color, msg );
        return 1;
    }
    return 0;
}
though i didn't try it it would work.

EDIT: for sure you can implement it on filterscript.
with IsPlayerNPC(playerid) and name comparing, some distance functions you can make that script.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)