Cant Change NPC's Skin or anything - 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)
+--- Thread: Cant Change NPC's Skin or anything (
/showthread.php?tid=443186)
Cant Change NPC's Skin or anything -
jeffery30162 - 10.06.2013
I have created a business system to where npcs will spawn inside of the stores of the business.
Right now the npc's spawn fine but when I try to change their skin or anything like that it doesnt work.
Heres some stuff you may want to take a look at to help me with.
LOAD BIZ script:
Код:
stock LoadBiz()
{
if(!fexist("biz.cfg")) fcreate("biz.cfg");
new binfo[14][32];
new string[256];
new File:file = fopen("biz.cfg", io_read);
if(file)
{
new idx = 1;
while(idx < MAX_BIZ)
{
fread(file, string);
split(string, binfo, '|');
BizInfo[idx][bType] = strval(binfo[0]);
BizInfo[idx][bStatus] = strval(binfo[1]);
format(BizInfo[idx][bOwner], 32, "%s", binfo[2]);
BizInfo[idx][bX] = floatstr(binfo[3]);
BizInfo[idx][bY] = floatstr(binfo[4]);
BizInfo[idx][bZ] = floatstr(binfo[5]);
BizInfo[idx][bMoney] = strval(binfo[6]);
BizInfo[idx][bProducts] = strval(binfo[7]);
BizInfo[idx][bSold] = strval(binfo[8]);
BizInfo[idx][bLevel] = strval(binfo[9]);
BizInfo[idx][bPrice] = strval(binfo[10]);
BizInfo[idx][bAP] = strval(binfo[11]);
format(BizInfo[idx][bNpc], 32, "%s", binfo[12]);
BizInfo[idx][bNpcS] = strval(binfo[13]);
if(BizInfo[idx][bType]) // If Business is owned
{
if(BizInfo[idx][bStatus] == 3)
{
ConnectNPC(BizInfo[idx][bNpc],"store");
BizInfo[idx][bPickup] = CreateDynamicPickup(1318, 1, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ], 0);
format(string, sizeof(string), "%s\nPress ENTER", RBT(idx));
BizInfo[idx][bText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]+0.3, 15);
LoadBizNpc();
}
else
{
if(!strcmp("The State", BizInfo[idx][bOwner])) format(string, sizeof(string), "Owner: %s\nBusiness Type: %s\nStatus: For Sale\nPrice: $%d", BizInfo[idx][bOwner], RBT(idx), BizInfo[idx][bPrice]);
else format(string, sizeof(string), "Business of %s\nBusiness type: %s\n%s", BizInfo[idx][bOwner], RBT(idx), RBS(idx));
BizInfo[idx][bPickup] = CreateDynamicPickup(1274, 1, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ], 0);
BizInfo[idx][bText] = CreateDynamic3DTextLabel(string, COLOR_WHITE, BizInfo[idx][bX], BizInfo[idx][bY], BizInfo[idx][bZ]+0.3, 15);
}
}
idx++;
}
}
print("Businesses loaded successfully.");
return 1;
}
LoadBizNpc Script:
Код:
stock LoadBizNpc(playerid)
{
for(new idx=1; idx<MAX_BIZ; idx++)
{
if(BizInfo[idx][bType] == 1 && BizInfo[idx][bStatus] == 3 && BizInfo[idx][bNpcS] != 1)
{
if(IsPlayerNPC(playerid)) //Checks if the player that just spawned is an NPC.
{
new npcname[MAX_PLAYER_NAME];
GetPlayerName(playerid, npcname, sizeof(npcname)); //Getting the NPC's name.
if(!strcmp(npcname, BizInfo[idx][bNpc], true)) //Checking if the NPC's name is MyFirstNPC
{
SetPlayerColor(playerid, TRANSPARENT_WHITE);
CreateDynamic3DTextLabel("MOLE", COLOR_YELLOW, 0, 0, -20, 25, playerid);
SetPlayerPos(playerid, -23.1070, -57.5309, 1003.5469);
SetPlayerInterior(playerid, 6);
SetPlayerFacingAngle(playerid, 357.5915);
SetPlayerSkin(playerid, BizInfo[idx][bNpcS]);
return 1;
}
}
}
}
}
Re: Cant Change NPC's Skin or anything -
DeMoX - 10.06.2013
did you tried this:
Код:
SetPlayerSkin(playerid,Skind-ID);
Re: Cant Change NPC's Skin or anything -
jeffery30162 - 10.06.2013
Thats not want I want
Re: Cant Change NPC's Skin or anything -
jeffery30162 - 11.06.2013
Please help me