[AJUDA] Skin do NPC.
#1

Olб, eu fiz um NPC de Mecвnico para um local no meu server, ele funcionou com a skin e tudo. Mas eu fiz um NPC de Policial para ficar na prisao, como se fosse "vigiando" os presos.

Olhem o script:

Код:
public OnPlayerSpawn(playerid)
{

if(IsPlayerNPC(playerid)) 
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname)); 
if(!strcmp(npcname, "mecanico", true)) // nome do NPC
{
SetPlayerSkin(playerid,50); // aqui seta a skin
return 1;
}
return 1;
}
Esse citado acima й o cуdigo no NPC Mecвnico que funciona com a skin setada e tudo.
Mas o meu problema й quando eu adiciono este codigo:
Код:
if(IsPlayerNPC(playerid)) 
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname)); 
if(!strcmp(npcname, "Policial", true)) // nome do NPC
{
SetPlayerSkin(playerid,280); // aqui seta a skin
return 1;
}
return 1;
}
Eu adiciono esse cуdigo acima abaixo do primeiro ficando assim:
Код:
public OnPlayerSpawn(playerid)
{

if(IsPlayerNPC(playerid)) 
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname)); 
if(!strcmp(npcname, "mecanico", true)) 
{
SetPlayerSkin(playerid,50); 
return 1;
}
return 1;
{
if(IsPlayerNPC(playerid)) 
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
if(!strcmp(npcname, "Policial", true)) 
{
SetPlayerSkin(playerid,280); 
return 1;
}
return 1;
}
Atй aqui estб tudo OK, compila certinho. Mas quando eu entro no jogo, a skin do mecвnico que jб estava setada para 50 volta para a skin 0 ( CJ ) E a do Policial tambйm.

Alguйm pode me ajudar?
Reply
#2

Tente trocar o playerid por npcname ou algo assim.
Reply
#3

Jб tem ali o npcname do lado de playerid, tб tudo certo, a skin muda, mas sу a do mecanico, e se eu coloco o script pra mudar a do policial tambem funciona, mais as duas setam a skin pra 0
Reply
#4

Manda seu's NPC do OnGameModeInit.
Reply
#5

Isso?
Код:
public OnGameModeInit()
{
ConnectNPC("Policia","Policial");
ConnectNPC("Mecanico","mecanico");
Reply
#6

nгo mecho muito com npc's entгo tente:

pawn Код:
new g[2];
public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid))
    {
        new npcname[MAX_PLAYER_NAME];
        GetPlayerName(g[1], npcname, sizeof(npcname));
        if(!strcmp(npcname, "mecanico", true))
        {
            SetPlayerSkin(playerid,50);
            return 1;
        }
        return 1;
    }
    if(IsPlayerNPC(playerid))
    {
        new npcname[MAX_PLAYER_NAME];
        GetPlayerName(g[1], npcname, sizeof(npcname)); //Getting the NPC's name.
        if(!strcmp(npcname, "Policial", true))
        {
            SetPlayerSkin(playerid,280);
            return 1;
        }
    }
    return 1;
}
public OnGameModeInit()
{
    g[0] = ConnectNPC("Policia","Policial");
    g[1] = ConnectNPC("Mecanico","mecanico");
    return 1;
}
Reply
#7

Tive esses erros:


Код:
C:\Documents and Settings\Adelar\Desktop\Eduardo\samp03csvr_R2-2_win32\gamemodes\sb1.pwn(130) : warning 201: redefinition of constant/macro (symbol "MAX_PICKUPS")
C:\Documents and Settings\Adelar\Desktop\Eduardo\samp03csvr_R2-2_win32\gamemodes\sb1.pwn(183) : error 021: symbol already defined: "UsePlayerPedAnims"
C:\Documents and Settings\Adelar\Desktop\Eduardo\samp03csvr_R2-2_win32\gamemodes\sb1.pwn(195) : error 021: symbol already defined: "Object_Object"
C:\Documents and Settings\Adelar\Desktop\Eduardo\samp03csvr_R2-2_win32\gamemodes\sb1.pwn(197) : error 021: symbol already defined: "CreateStreamedObject"
C:\Documents and Settings\Adelar\Desktop\Eduardo\samp03csvr_R2-2_win32\gamemodes\sb1.pwn(573) : error 021: symbol already defined: "CreateStreamedObject"
C:\Documents and Settings\Adelar\Desktop\Eduardo\samp03csvr_R2-2_win32\gamemodes\sb1.pwn(644) : error 021: symbol already defined: "CreateStreamedObject"
C:\Documents and Settings\Adelar\Desktop\Eduardo\samp03csvr_R2-2_win32\gamemodes\sb1.pwn(937) : error 021: symbol already defined: "CreateStreamedObject"
C:\Documents and Settings\Adelar\Desktop\Eduardo\samp03csvr_R2-2_win32\gamemodes\sb1.pwn(1047) : error 021: symbol already defined: "CreateStreamedObject"
C:\Documents and Settings\Adelar\Desktop\Eduardo\samp03csvr_R2-2_win32\gamemodes\sb1.pwn(1065) : error 021: symbol already defined: "CreateStreamedObject"
C:\Documents and Settings\Adelar\Desktop\Eduardo\samp03csvr_R2-2_win32\gamemodes\sb1.pwn(1079) : error 021: symbol already defined: "CreateStreamedObject"
C:\Documents and Settings\Adelar\Desktop\Eduardo\samp03csvr_R2-2_win32\gamemodes\sb1.pwn(1081) : error 021: symbol already defined: "CreateStreamedObject"
C:\Documents and Settings\Adelar\Desktop\Eduardo\samp03csvr_R2-2_win32\gamemodes\sb1.pwn(1709) : error 021: symbol already defined: "CreateStreamedObject"
C:\Documents and Settings\Adelar\Desktop\Eduardo\samp03csvr_R2-2_win32\gamemodes\sb1.pwn(1811) : error 021: symbol already defined: "CreateStreamedObject"
C:\Documents and Settings\Adelar\Desktop\Eduardo\samp03csvr_R2-2_win32\gamemodes\sb1.pwn(1893) : error 021: symbol already defined: "CreateStreamedObject"
C:\Documents and Settings\Adelar\Desktop\Eduardo\samp03csvr_R2-2_win32\gamemodes\sb1.pwn(1951) : error 021: symbol already defined: "CreateStreamedObject"
C:\Documents and Settings\Adelar\Desktop\Eduardo\samp03csvr_R2-2_win32\gamemodes\sb1.pwn(2195) : error 021: symbol already defined: "CreateStreamedObject"
C:\Documents and Settings\Adelar\Desktop\Eduardo\samp03csvr_R2-2_win32\gamemodes\sb1.pwn(2460) : error 021: symbol already defined: "CreateStreamedObject"
C:\Documents and Settings\Adelar\Desktop\Eduardo\samp03csvr_R2-2_win32\gamemodes\sb1.pwn(3166) : error 021: symbol already defined: "CreateStreamedObject"
C:\Documents and Settings\Adelar\Desktop\Eduardo\samp03csvr_R2-2_win32\gamemodes\sb1.pwn(3216) : error 021: symbol already defined: "CreateStreamedObject"
C:\Documents and Settings\Adelar\Desktop\Eduardo\samp03csvr_R2-2_win32\gamemodes\sb1.pwn(3247) : error 021: symbol already defined: "CreateStreamedObject"
C:\Documents and Settings\Adelar\Desktop\Eduardo\samp03csvr_R2-2_win32\gamemodes\sb1.pwn(3255) : error 021: symbol already defined: "CreateStreamedObject"
C:\Documents and Settings\Adelar\Desktop\Eduardo\samp03csvr_R2-2_win32\gamemodes\sb1.pwn(3335) : error 021: symbol already defined: "CreateStreamedObject"
C:\Documents and Settings\Adelar\Desktop\Eduardo\samp03csvr_R2-2_win32\gamemodes\sb1.pwn(3483) : error 021: symbol already defined: "CreateStreamedObject"
C:\Documents and Settings\Adelar\Desktop\Eduardo\samp03csvr_R2-2_win32\gamemodes\sb1.pwn(3538) : error 021: symbol already defined: "CreateStreamedObject"
C:\Documents and Settings\Adelar\Desktop\Eduardo\samp03csvr_R2-2_win32\gamemodes\sb1.pwn(3857) : error 021: symbol already defined: "CreateStreamedObject"
C:\Documents and Settings\Adelar\Desktop\Eduardo\samp03csvr_R2-2_win32\gamemodes\sb1.pwn(4102) : error 021: symbol already defined: "CreateStreamedObject"
C:\Documents and Settings\Adelar\Desktop\Eduardo\samp03csvr_R2-2_win32\gamemodes\sb1.pwn(4291) : error 021: symbol already defined: "CreateStreamedObject"

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


26 Errors.
Reply
#8

Coloque isto em sua OnGameModeInit

pawn Код:
g[0] = ConnectNPC("Policia","Policial");
g[1] = ConnectNPC("Mecanico","mecanico");
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)