SA-MP Forums Archive
NPC: SetPlayerSkin problem!! Someone help? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: NPC: SetPlayerSkin problem!! Someone help? (/showthread.php?tid=263546)



NPC: SetPlayerSkin problem!! Someone help? - Nr1FANEX - 22.06.2011

Hey everyone,
I have a problem when I try to set my NPC's skins...
Well, it works to apply an animation, to give them weapons, to set colors or others like that, but the skin doesn't change. My NPC's takes the first skin from AddPlayerClass (OnGameModeInit):

Код:
public OnPlayerSpawn(playerid)
{
        if(IsPlayerNPC(playerid))
	{
	        new npcname[MAX_PLAYER_NAME];
		GetPlayerName(playerid, npcname, sizeof(npcname));
	    if(!strcmp(npcname,"FServer",true))
	    {
	        ResetPlayerWeapons(playerid);
	    	SetPlayerPos(playerid, 1958.33, 1343.12, 15.36);
	    	SetPlayerFacingAngle(playerid, 269.15);
		    //PutPlayerInVehicle(playerid, Random, 0);
		    SetPlayerSkin(playerid, 80);
	        SetPlayerColor(playerid,0xFFFFFF32);
	        SetPlayerInterior(playerid,5);
	        ApplyAnimation(playerid,"GYMNASIUM","GYMshadowbox",4.0,1,1,1,1,0);
		//	new Text3D:flabel,string[256];
      		//format(string, sizeof(string), "FBOT (%d)",playerid);
      		//flabel = Create3DTextLabel(string,COLOR_GREEN,0,0,0,25.0,0,1);
      		//Attach3DTextLabelToPlayer(flabel, playerid, 0, 0, 0);
	    }
	    
	    if(!strcmp(npcname,"FServer2",true))
	    {
	        ResetPlayerWeapons(playerid);
	    	SetPlayerPos(playerid, 1958.33, 1343.12, 15.36);
	    	SetPlayerFacingAngle(playerid, 269.15);
		    //PutPlayerInVehicle(playerid, Random, 0);
		    SetPlayerSkin(playerid, 81);
	        SetPlayerColor(playerid,0xFFFFFF00);
	        SetPlayerInterior(playerid,5);
	        ApplyAnimation(playerid,"GYMNASIUM","GYMshadowbox",4.0,1,1,1,1,0);
		}
		
		if(!strcmp(npcname,"FServer3",true))
		{
		    ResetPlayerWeapons(playerid);
	    	SetPlayerPos(playerid, 1958.33, 1343.12, 15.36);
	    	SetPlayerFacingAngle(playerid, 269.15);
		    //PutPlayerInVehicle(playerid, Random, 0);
	        SetPlayerColor(playerid,0xFFFFFFFF);
	        SetPlayerInterior(playerid,5);
		    SetPlayerSkin(playerid, 164);
		    ApplyAnimation(playerid,"SMOKING","M_smk_out", 4.0, 1, 0, 0, 0, 0);
		    SetPlayerSpecialAction(playerid,SPECIAL_ACTION_DRINK_WINE);
		}
		
		if(!strcmp(npcname,"FServer4",true))
		{
		    ResetPlayerWeapons(playerid);
	    	SetPlayerPos(playerid, 1958.33, 1343.12, 15.36);
	    	SetPlayerFacingAngle(playerid, 269.15);
		    //PutPlayerInVehicle(playerid, Random, 0);
	        SetPlayerColor(playerid,0xFFFFFFFF);
		    SetPlayerInterior(playerid,0);
	        SetPlayerSkin(playerid, 116);
		    new Frand = random(3);
		    switch(Frand)
	        {
	            case 0:
		        {
	                ApplyAnimation(playerid,"SMOKING", "M_smklean_loop", 4.0, 1, 0, 0, 0, 0);
		            SetPlayerSpecialAction(playerid,SPECIAL_ACTION_SMOKE_CIGGY);
		        }
		        case 1:
		        {
			        ApplyAnimation(playerid, "ped", "cower", 3.0, 1, 0, 0, 0, 0);
			    }
			    case 2:
			    {
	                SetPlayerSpecialAction(playerid,SPECIAL_ACTION_HANDSUP);
			    }
	        }
		}
		
		if(!strcmp(npcname,"FServer5",true))
		{
		    ResetPlayerWeapons(playerid);
	    	SetPlayerPos(playerid, 1958.33, 1343.12, 15.36);
	    	SetPlayerFacingAngle(playerid, 269.15);
		    //PutPlayerInVehicle(playerid, botcar, 0);
		    SetPlayerSkin(playerid, 162);
	        SetPlayerColor(playerid,0xFFFFFFFF);
	        SetPlayerInterior(playerid,6);
		    ApplyAnimation(playerid,"PARK","Tai_Chi_Loop",4.0,1,0,0,0,0);
		}
		
		if(!strcmp(npcname,"FServer6",true))
		{
		    ResetPlayerWeapons(playerid);
	    	SetPlayerPos(playerid, 1958.33, 1343.12, 15.36);
	    	SetPlayerFacingAngle(playerid, 269.15);
		    //PutPlayerInVehicle(playerid, Random, 0);
	        SetPlayerColor(playerid,0xFFFFFFFF);
		    SetPlayerInterior(playerid,6);
		    SetPlayerSkin(playerid, 270);
		    new Frand = random(2);
		    switch(Frand)
		    {
	            case 0:
		        {
	                ApplyAnimation(playerid,"PED","KO_shot_stom",4.0,0,1,1,1,0);
		        }
		        case 1:
		        {
	                ApplyAnimation(playerid, "SWEET", "Sweet_injuredloop", 4.0, 1, 0, 0, 0, 0);
			    }
	        }
		}
	//	return 1; //I try comment & uncomment this, but still not works
	}
	return 1; // note that I try with 0 and 1
}
Someone give me a hand? Please help.


Re: NPC: SetPlayerSkin problem!! Someone help? - FireCat - 22.06.2011

Well normally NPC's are id 0,1,2.. the newer id's.
So if the NPC id you want to change is 0, i'd suggest (how i do it) do SetPlayerSkin(0,skinid);


Re: NPC: SetPlayerSkin problem!! Someone help? - Nr1FANEX - 22.06.2011

Quote:
Originally Posted by FireCat
Посмотреть сообщение
Well normally NPC's are id 0,1,2.. the newer id's.
So if the NPC id you want to change is 0, i'd suggest (how i do it) do SetPlayerSkin(0,skinid);
It doesn't work man, I try a different methods , but all fails...
please some new suggestions...and thanks for trying help me.


Re: NPC: SetPlayerSkin problem!! Someone help? - Nr1FANEX - 23.06.2011

Bump this shit...
Why nobody knows to do this... Jeesh! Is annoying.
Someone help


Re: NPC: SetPlayerSkin problem!! Someone help? - =WoR=Varth - 23.06.2011

Set their skin when they're already spawned instead set them when they're connected.