Szerző Téma: NPC id  (Megtekintve 1036 alkalommal)

NPC id
« Dátum: 2013. Február 13. - 14:05:47 »
0 Show voters
Hali, meg lehet valahogy oldani, hogy egy 30 slotos szerón az utolsó 3 helyre kerüljön 3db NPC? Tehát a 28-29-30-as id-t foglalja el és ne a 0-1-2-t.
/Ha igen, hogyan? Esetleg van már ilyen valakinek?/  :shurg:
Köszönöm.

Nem elérhető kurta999

  • 2759
  • Éllő fédisznó
    • Profil megtekintése
NPC id
« Válasz #1 Dátum: 2013. Február 13. - 15:59:54 »
0 Show voters
Konkréten ahogy írtad, úgy sehogy alapból. De: http://sampforum.hu/index.php?topic=2928.0

NPC id
« Válasz #2 Dátum: 2013. Február 13. - 16:34:20 »
0 Show voters
Az a baj, hogy kickeli ugyebár, de aztán nem csatlakoznak vissza...  :wall:
 
[21:48:33] Incoming connection: 127.0.0.1:44141
[21:48:33] Incoming connection: 127.0.0.1:53158
[21:48:33] Incoming connection: 127.0.0.1:33894
[21:48:33] [npc:join] NPC1 has joined the server (0:127.0.0.1)
[21:48:33] [npc:join] NPC2 has joined the server (1:127.0.0.1)
[21:48:33] [npc:join] NPC3 has joined the server (2:127.0.0.1)
[21:48:34] [npc:part] NPC1 has left the server (0:2)
[21:48:34] [npc:part] NPC2 has left the server (1:2)
[21:48:34] [npc:part] NPC3 has left the server (2:2)

 

#include <a_samp>
#include <a_npc>
#define FILTERSCRIPT
#define MAX_LASTNPC 3 //MAX 100 NPC
new maxplcheck;
forward NPCLoadUpdate();
public NPCLoadUpdate()
{
    ConnectNPC(\"NPC1\",\"barman1\");
    ConnectNPC(\"NPC2\",\"barman2\");
    ConnectNPC(\"NPC3\",\"barman3\");
    return 1;
}
public OnFilterScriptInit()
{
    SlotNPC();
    return 1;
}
stock SlotNPC()
{
    maxplcheck = GetServerVarAsInt(\"maxplayers\");
    for(new i = 0; i <= maxplcheck-1-MAX_LASTNPC; i++)
    {
        new str[64];
        format(str,sizeof(str),\"barman1\",i);
        ConnectNPC(str,\"NPC1\");
    }
    for(new i = 0; i <= maxplcheck-1-MAX_LASTNPC; i++)
    {
       new str[64];
        format(str,sizeof(str),\"barman2\",i);
        ConnectNPC(str,\"NPC2\");
    }
    for(new i = 0; i <= maxplcheck-1-MAX_LASTNPC; i++)
    {
       new str[64];
        format(str,sizeof(str),\"barman3\",i);
        ConnectNPC(str,\"NPC3\");
    }
    SetTimer(\"NPCLoadUpdate\",1000,0);
    SetTimer(\"KickTime\",2000,0);
    return 1;
}
forward KickTime();
public KickTime()
{
    maxplcheck = GetServerVarAsInt(\"maxplayers\");
    for(new i = 0; i <= maxplcheck-1-MAX_LASTNPC; i++)
    {
        Kick(i);
    }
}
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid))
    {
        new npcname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, npcname, sizeof(npcname));
        if (!strcmp(npcname, \"NPC1\", true))
        {
            SetPlayerSkin(playerid, 260);
            return 1;
        }
        else if (!strcmp(npcname, \"NPC2\", true))
        {
            SetPlayerSkin(playerid, 287);
            return 1;
        }
        else if (!strcmp(npcname, \"NPC3\", true))
        {
            SetPlayerSkin(playerid, 216);
            return 1;
        }
    }
    return 1;
}
« Utoljára szerkesztve: 2013. Február 14. - 14:53:27 írta takehun »

 

SimplePortal 2.3.7 © 2008-2024, SimplePortal