How to set a specific NPC's skin?
#1

I want to add one demonic NPC at coordinate, with different skin from other NPC's and I don't want other NPC's to have his skin.

How can I do that?

PHP код:
new Float:ZombieSpawns[][] =
{
    {-
117.6339,1160.3606,19.5938,75.6100},
    {-
117.6339,1160.3606,19.5938,75.6100},
    {-
117.6339,1160.3606,19.5938,75.6100},
    {-
117.6339,1160.3606,19.5938,75.6100},
    {-
117.6339,1160.3606,19.5938,75.6100},
    {-
117.6339,1160.3606,19.5938,75.6100},
    {-
187.3822,1098.3834,19.5965,97.4476},
    {-
187.3822,1098.3834,19.5965,97.4476},
    {-
187.3822,1098.3834,19.5965,97.4476},
    {-
187.3822,1098.3834,19.5965,97.4476},
    {-
187.3822,1098.3834,19.5965,97.4476},
    {-
187.3822,1098.3834,19.5965,97.4476},
    {-
188.1270,1196.6998,19.5491,358.4333},
    {-
188.1270,1196.6998,19.5491,358.4333},
    {-
188.1270,1196.6998,19.5491,358.4333},
    {-
188.1270,1196.6998,19.5491,358.4333}
};
new 
ZSkins[] = { 20005200062000720008200092001220013200142001520016  };
public 
OnPlayerSpawn(playerid)
{
    
ApplyAnimation(playerid"BOMBER""null"000001);
    
ApplyAnimation(playerid"PED""null"000001);
    if(
IsPlayerNPC(playerid))
    {
            new 
spawn random(sizeof(ZombieSpawns));
            
SetPlayerPos(playeridZombieSpawns[spawn][0], ZombieSpawns[spawn][1], ZombieSpawns[spawn][2]);
            
SetRNPCHealth(playeridZOMBIE_HEALTH);
            
SetPlayerSkin(playeridZSkins[random(12)]);
            
SetPlayerColor(playeridZOMBIE_COLOR);
            
RNPC_SetShootable(playerid1);
            
RNPC_ToggleVehicleCollisionCheck(playerid1);
            
GetZombieVictimID[playerid] = INVALID_PLAYER_ID;
            return 
1;
    } 
Reply
#2

Didn't understand well what you meant by "add one demonic NPC at a coordinate" so i'll just assume you want the first one to be at random coords

so:
Код:
new IsDemonicOne[MAX_PLAYERS];
new DemonicHasSpawned = 0;
OnPlayerSpawn
Код:
 if(DemonicHasSpawned == 0 && IsPlayerNPC(playerid))
{
//Set him the skin you want to have and have him spawn at a random coord
DemonicGuy = 1; //So it won't trigger anymore this func
IsDemonicOne[playerid] = 1; //So you defined that he IS the demonic zombie and you can handle him separately
}
Код:
if(IsPlayerNPC(playerid) && DemonicHasSpawned == 1) //Check if the demonic zombie has spawned, if yes spawn the other zombies this way
    {
            new spawn = random(sizeof(ZombieSpawns));
            SetPlayerPos(playerid, ZombieSpawns[spawn][0], ZombieSpawns[spawn][1], ZombieSpawns[spawn][2]);

            SetRNPCHealth(playerid, ZOMBIE_HEALTH);
            SetPlayerSkin(playerid, ZSkins[random(12)]);
            SetPlayerColor(playerid, ZOMBIE_COLOR);

            RNPC_SetShootable(playerid, 1);
            RNPC_ToggleVehicleCollisionCheck(playerid, 1);

            GetZombieVictimID[playerid] = INVALID_PLAYER_ID;
            return 1;
    }
PS. I'm not that very good at scripting but i tried to help you, just don't take my code as perfect, it may contain errors and bugs.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)