[BUG] NPC's With 0.3c.
#1

if i connect a npc while ingame the server crashes.
if i connect a npc ongamemodeinit the server doesnt not load properly (this was the cause kalcor)

i think its a conflict with mapandreas and a npc S:
npc code.
edit - its a 0.3b bot
pawn Код:
#define RECORDING "Jessica" //This is the filename of your recording without the extension.
#define RECORDING_TYPE 2 //1 for in vehicle and 2 for on foot.

#include <a_npc>
forward OnNPCUpdate(npcid);
forward OnNPCGetDamage(npcid,Float:damage);
new phealth;
main()
{}
public OnNPCModeInit()
{
printf("NPC script loaded");
}
public OnNPCModeExit()
{
print("NPC script unloaded");
}
public OnNPCConnect(myplayerid)
{
    printf("I successfully connected the server with ID %i!", myplayerid);
    SetTimer("OnNPCUpdate",50,true);
}
public OnNPCDisconnect(reason[])
{
    printf("Disconnected from the server. %s", reason);
}
public OnNPCUpdate(npcid)
{
    static Float:HP,Float:Armour;
    HP = GetPlayerHealth(npcid);
    Armour = GetPlayerArmour(npcid);
    if(HP+Armour < phealth)
    {
        OnNPCGetDamage(npcid,floatround(phealth-HP-Armour));
    }
    phealth=floatround(HP+Armour);
    return 1;
}
public OnNPCGetDamage(npcid,Float:damage)
{
    printf ( "OnNPCGetDamage ( %d, %f )", npcid, damage);
    return 1;
}
public OnClientMessage(color, text[])
{
    if(strfind(text,"Bank Balance: $0") != -1) SendChat("I am poor :(");
}
public OnRecordingPlaybackEnd() StartRecordingPlayback(RECORDING_TYPE, RECORDING);

#if RECORDING_TYPE == 1
  public OnNPCEnterVehicle(vehicleid, seatid) StartRecordingPlayback(RECORDING_TYPE, RECORDING);
  public OnNPCExitVehicle() StopRecordingPlayback();
#else
  public OnNPCSpawn()
  {
    StartRecordingPlayback(RECORDING_TYPE, RECORDING); print("NPC spawned");
    printf("Jessica");
    SendChat("Hello World. I'm a bot.");
  }
#endif
public OnPlayerStreamIn(playerid)
{
    new string[80];
    format(string, sizeof(string), "/pm %d Hello! I have just loaded you!", playerid);
    SendCommand(string);
    return 1;
}
public OnPlayerStreamOut(playerid)
{
    new string[80];
    format(string, sizeof(string), "Bye ID %i!", playerid);
    SendChat(string);
    return 1;
}
public OnPlayerDeath(playerid)
{
    new string[80], name[MAX_PLAYER_NAME];
    GetPlayerName(playerid, name, sizeof(name));

    format(string, sizeof(string), "Oh no %s! I didn't want you to die that way!", name);
    SendChat(string);
    return 1;
}
public OnPlayerText(playerid, text[])
{
    if (strfind(text, "stupid bot") != -1)
    {
        new string[80], name[MAX_PLAYER_NAME];
        GetPlayerName(playerid, name, sizeof(name));
        format(string, sizeof(string), "Hey %s! Don't say those things! We, bots, are cool!", name);
        SendChat(string);
    }
    return 1;
}
Reply
#2

NPC works properly only in 32-bit version of windows..
Reply
#3

im using 32-bit windows xp.

i "think" i wasnt getting this before i added mapandreas.
Reply
#4

This is the CNPC plugin. It's not written by SA-MP.
Reply
#5

this is not cnpc. look at it again, i made that callback.

and it does this with any npc. even without those callbacks.
Reply
#6

this problem still continues. its not cnpc plugin it was recorded by samp default functions in npc_record filterscript/
Reply
#7

Can you upload the full script and recordings you are using?
Reply
#8

here.
solidfiles was down so, http://www.mediafire.com/?7pcdmiy0cav83me
Reply
#9

Quote:
Originally Posted by The_Gangstas
Посмотреть сообщение
here.
solidfiles was down so, http://www.mediafire.com/?7pcdmiy0cav83me
This works fine for me. Maybe it's not the NPC crashing the server? The server should write a crash_log.txt. That information might be useful here.
Reply
#10

Quote:
Originally Posted by papedo
Посмотреть сообщение
NPC works properly only in 32-bit version of windows..
Does it work on linux?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)