open.mp forum
[Server] FCNPC created in 0 vw and interior when it shouldn't - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Support (https://forum.open.mp/forumdisplay.php?fid=12)
--- Thread: [Server] FCNPC created in 0 vw and interior when it shouldn't (/showthread.php?tid=1027)



FCNPC created in 0 vw and interior when it shouldn't - Fairuz - 2020-04-01

Code:
stock?CreateCivilianNpc(?name[?],?skinId[?],?clerkId,?animlib[?16?],?animname[?16?],?const?Float:?position[?4?],?worldid?=?-1,?interior?=?-1,?bool:?hostile?=?true,?numSkins?=?sizeof(?skinId?)?)

{

????new

????????szBotName[?MAX_PLAYER_NAME?];



????format(?szBotName,?sizeof(?szBotName?),?"%s",?name?);

????strreplacechar(?szBotName,?'?',?'\0'?);

????strreplacechar(?szBotName,?'/',?'\0'?);



????new

????????civilianid?=?Iter_Free(CivilianNpc);



????if?(?civilianid?!=?ITER_NONE?)

????{

????????new

????????????randomSkin?=?random(?numSkins?);



????????Iter_Add(CivilianNpc,?civilianid);



????????format(?g_civilianNpcData[?civilianid?]?[?E_ANIM_LIB?],?16,?"%s",?animlib?);

????????format(?g_civilianNpcData[?civilianid?]?[?E_ANIM_NAME?],?16,?"%s",?animname?);

????????format(?g_civilianNpcData[?civilianid?]?[?E_NPC_NAME?],?MAX_PLAYER_NAME,?"%s",?name?);

????????CreateDynamic3DTextLabel(?sprintf(?"%s",?name?),?0xFFFFFF25,?position[?0?],?position[?1?],?position[?2?],?25.0,?INVALID_PLAYER_ID,?INVALID_VEHICLE_ID,?.testlos?=?0,?.worldid?=?worldid?);

????????g_civilianNpcData[?civilianid?]?[?E_NPC_ID?]?=?FCNPC_Create(?worldid?!=?-1???sprintf(?"[BOT]%s%d",?szBotName,?civilianid?)?:?sprintf(?"[BOT]%s",?szBotName?)?);

????????//g_civilianNpcData[?civilianid?]?[?E_WORLD?]?=?worldid?==?-1???0?:?worldid;

????????//g_civilianNpcData[?civilianid?]?[?E_INTERIOR?]?=?interior?==?-1???0?:?interior;

????????g_civilianNpcData[?civilianid?]?[?E_WORLD?]?=?worldid;

????????g_civilianNpcData[?civilianid?]?[?E_INTERIOR?]?=?interior;

????????g_civilianNpcData[?civilianid?]?[?E_CLERK_ID?]?=?clerkId;

????????g_civilianNpcData[?civilianid?]?[?E_HOSTILE?]?=?hostile;

????????FCNPC_Spawn(?g_civilianNpcData[?civilianid?]?[?E_NPC_ID?],?skinId[?randomSkin?],?position[?0?],?position[?1?],?position[?2?]?);

????????FCNPC_SetAngle(?g_civilianNpcData[?civilianid?]?[?E_NPC_ID?],?(?g_civilianNpcData[?civilianid?]?[?E_RZ?]?=?position[?3?]?)?);

????}

????else?print(?"[ERROR]?Civilian?cannot?be?added?due?to?small?limit,?please?raise."?);

}?



Quote:????????????????

CreateCivilianNpc(?"Triad",?{?117,?118,?121,?122,?123?},?clerkid,?"INT_HOUSE",?"wash_up",?drugDealerPositions[?0?]?[?random(?sizeof(?drugDealerPositions[?]?)?)?],?worldid,?.interior?=?6?);?

Quote:??????????????????????

??????????? FCNPC_SetVirtualWorld(?npcid,?g_civilianNpcData[?civilianid?]?[?E_WORLD?]?);



????????????FCNPC_SetInterior(?npcid,?g_civilianNpcData[?civilianid?]?[?E_INTERIOR?]?);



The value is zero, why ? how do I fix this?