Help: NPC join and leave
#1

Hi guys, I have a problem, when I start the server some npc are disconnected, crashdetect does not show any error. Any idea why this happens??

Too much happens that it says the NPC has joined and does not join the server. I have to open some port in the firewall ??

PHP код:
[11:16:54]                                                       
[
11:16:54]                         KoN                    
[11:16:54]                  AutorLegend-Chevi                  
[11:16:54]             San Fierro Killer Team Death Match        
[11:16:54]  _____________________________________________________
[11:16:54Number of vehicle models190
[11:16:54] [connection127.0.0.1:62815 requests connection cookie.
[
11:16:54] [connection127.0.0.1:62816 requests connection cookie.
[
11:16:55] [connectionincoming connection127.0.0.1:62815 id0
[11:16:55] [connectionincoming connection127.0.0.1:62816 id1
[11:16:56] [npc:joinOfficerino has joined the server (0:127.0.0.1)
[
11:16:56] [npc:joinNPC has joined the server (1:127.0.0.1)
[
11:17:02] [connection127.0.0.1:62817 requests connection cookie.
[
11:17:04] [connectionincoming connection127.0.0.1:62817 id2
[11:17:09] [npc:partNPC has left the server (1:0)
[
11:17:09] [connection127.0.0.1:62818 requests connection cookie.
[
11:17:09] [connection127.0.0.1:62819 requests connection cookie.
[
11:17:09] [connection127.0.0.1:62820 requests connection cookie.
[
11:17:10] [connectionincoming connection127.0.0.1:62818 id1
[11:17:10] [connectionincoming connection127.0.0.1:62819 id2
[11:17:10] [npc:joinNPC has joined the server (1:127.0.0.1)
[
11:17:10] [connectionincoming connection127.0.0.1:62820 id2
[11:17:14] [connectionincoming connection127.0.0.1:62821 id2
[11:17:14] [joinLegend_Chevi has joined the server (2:127.0.0.1
Reply
#2

PHP код:
public OnPlayerConnect(playerid)
{
    if (
IsPlayerNPC(playerid)) return 1;
    return 
1;

PHP код:
public OnPlayerDisconnect(playeridreason)
{
    if(
IsPlayerNPC(playerid)) return 1;
    return 
1;

Reply
#3

Quote:
Originally Posted by Osamakurdi
Посмотреть сообщение
PHP код:
public OnPlayerConnect(playerid)
{
    if (
IsPlayerNPC(playerid)) return 1;
    return 
1;

PHP код:
public OnPlayerDisconnect(playeridreason)
{
    if(
IsPlayerNPC(playerid)) return 1;
    return 
1;

i have put this, is it right??

PHP код:
public OnPlayerConnect(playerid)
{
    if (
IsPlayerNPC(playerid)) {
    
playertarget[playerid] = Create3DTextLabel(" "0xFFFFFFFF30.040.050.0100.001);
    
Attach3DTextLabelToPlayer(playertarget[playerid], playerid0.00.00.2);}
return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    if (
IsPlayerNPC(playerid))
    {
        
        new 
npcname[MAX_PLAYER_NAME];
        
GetPlayerName(playeridnpcnamesizeof(npcname));
         if(!
strcmp(npcname"Officerino"true))// Your npc name here
        
{
                    
CreateRNPCPolice ("Officerino"rpid[random(2)]);
                    new 
rp2 ConnectRNPC("Officerino");
                    
AddRPOLWaypoint (rp22029.421354.3410.5);
                    
AddRPOLWaypoint (rp22033.551286.2110.5);
                    
AddRPOLWaypoint (rp22029.421354.3410.5);
                    
AddRPOLWaypoint (rp22033.551286.2110.5);
                    
SetTimerEx ("Route2"5000"i"playerid);
                
        }
        else if(!
strcmp(npcname"NPC"true))// Your npc name here
        
{
                    
CreateRNPCPolice ("NPC"rpid[random(2)]);
                    new 
pol2 ConnectRNPC("NPC");
                    
AddRPOLWaypoint (pol22029.421354.3410.5);
                    
AddRPOLWaypoint (pol22033.551286.2110.5);
                    
AddRPOLWaypoint (pol22029.421354.3410.5);
                    
AddRPOLWaypoint (pol22033.551286.2110.5);
                    
SetTimerEx ("Route3"5000"i"playerid);
        }
    }
    
return 
1;

Reply
#4

Quote:
Originally Posted by bookknp
Посмотреть сообщение
i have put this, is it right??

PHP код:
public OnPlayerConnect(playerid)
{
    if (
IsPlayerNPC(playerid)) {
    
playertarget[playerid] = Create3DTextLabel(" "0xFFFFFFFF30.040.050.0100.001);
    
Attach3DTextLabelToPlayer(playertarget[playerid], playerid0.00.00.2);}
return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    if (
IsPlayerNPC(playerid))
    {
        
        new 
npcname[MAX_PLAYER_NAME];
        
GetPlayerName(playeridnpcnamesizeof(npcname));
         if(!
strcmp(npcname"Officerino"true))// Your npc name here
        
{
                    
CreateRNPCPolice ("Officerino"rpid[random(2)]);
                    new 
rp2 ConnectRNPC("Officerino");
                    
AddRPOLWaypoint (rp22029.421354.3410.5);
                    
AddRPOLWaypoint (rp22033.551286.2110.5);
                    
AddRPOLWaypoint (rp22029.421354.3410.5);
                    
AddRPOLWaypoint (rp22033.551286.2110.5);
                    
SetTimerEx ("Route2"5000"i"playerid);
                
        }
        else if(!
strcmp(npcname"NPC"true))// Your npc name here
        
{
                    
CreateRNPCPolice ("NPC"rpid[random(2)]);
                    new 
pol2 ConnectRNPC("NPC");
                    
AddRPOLWaypoint (pol22029.421354.3410.5);
                    
AddRPOLWaypoint (pol22033.551286.2110.5);
                    
AddRPOLWaypoint (pol22029.421354.3410.5);
                    
AddRPOLWaypoint (pol22033.551286.2110.5);
                    
SetTimerEx ("Route3"5000"i"playerid);
        }
    }
    
return 
1;

I search in other gamemodes, add return 0 at OnplayerConnect but i try it and npc dont join, Someone can help me??

PHP код:
public OnPlayerConnect(playerid

    if (
IsPlayerNPC(playerid)) { 
    
playertarget[playerid] = Create3DTextLabel(" "0xFFFFFFFF30.040.050.0100.001); 
    
Attach3DTextLabelToPlayer(playertarget[playerid], playerid0.00.00.2);
    return 
0;}  //<------------- Here
return 1

Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)