NPC Skin - Problem
#1

Ive search alot topics about this problem, but nothing help me.

I try change the skin to my npc but it dont change, including i put spawnInfo and nothing happen, check it. this is the OnPlayerSpawn of my filtescript.

PHP код:
public OnPlayerSpawn(playerid)
{
    if(
IsPlayerNPC(playerid))
      {
        new 
npcname[24];
        
GetPlayerName(playeridnpcname24);
        if(!
strcmp(npcname"Unity_Driver"true)) 
        {
            
SetPlayerSkin(playerid150);
            
PutPlayerInVehicle(playeridAutobus_BusUnitySf0); 
            
Attach3DTextLabelToPlayer(Text3d_BusUnitySfplayerid0.00.00.0);
          }
      }
    return 
1;

All work fine, the npc is put in the vehicle, but he dont wanna change the skin, someone can help me with this >.< this make me crazy.
Reply
#2

Bump
Reply
#3

As I might suspect, you might be calling three functions too fast. I had this problem too.
Attempt to create a timer to re-skin the NPC. (Don't forget to reset player into the vehicle, unless you want the gameserver to crash.. Or, the players just..)

pawn Код:
forward NPC_ResetSkin(npcid);

public OnPlayerSpawn(playerid)
{
    if(IsPlayerNPC(playerid))
      {
        new npcname[24];
        GetPlayerName(playerid, npcname, 24);
        if(!strcmp(npcname, "Unity_Driver", true))  
        {
            SetPlayerSkin(playerid, 150); // I'd suggest to move this code to the new function
            PutPlayerInVehicle(playerid, Autobus_BusUnitySf, 0); // I'd suggest to move this code to the new function
            Attach3DTextLabelToPlayer(Text3d_BusUnitySf, playerid, 0.0, 0.0, 0.0); // I'd suggest to move this code to the new function
            SetTimerEx("NPC_ResetSkin", 1000, false, "d", playerid);
          }
      }
    return 1;
}

public NPC_ResetSkin(npcid)
{
   // your code here.
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)