20.07.2018, 00:36
Hello, iґm doing a simple Zombie NPC with FCNPC, but for some reason, the zombie is spawning at 0,0,0, not the coords that i want. Here is my code:
I donґt know why this happens. If i put manual coords in FCNPC_OnCreate, it magical works.
Код:
enum Zombie { zTipo, Float:zX, Float:zY, Float:zZ } static const Zombies[MAX_ZOMBIES][Zombie] = { // {X, Y, Z, TIPO} 3 tipos : Normal, rapido, zombie con mutacion MAISK-2. {1, 2490.4277,-1670.0314,13.3359} }; //"funcion" is a simple redefine of forward and public. funcion CargarZombies(){ //Called in OnGameModeInit, after initialising MapAndreas. new ZombieNombre[10]; for(new i; i < sizeof(Zombies); i++){ format(ZombieNombre, 10, "Zombie_%i", i); FCNPC_ToggleMapAndreasUsage(i, true); FCNPC_Create(ZombieNombre); FCNPC_Spawn(i, ZombieSkin(Zombies[i][zTipo]), Zombies[i][zX],Zombies[i][zY],Zombies[i][zZ]); } return 1; } public FCNPC_OnSpawn(npcid){ print("Zombie spawn"); return 1; } public FCNPC_OnCreate(npcid){ new Float:vida; if(Zombies[npcid][zTipo] != 3) vida = 170; else vida = 300; FCNPC_SetPosition(npcid, Zombies[npcid][zX],Zombies[npcid][zY],Zombies[npcid][zZ]); FCNPC_SetHealth(npcid, vida); SetTimerEx("ZombieVerificar", 500, true, "i", npcid); print("Zombie oncreate"); return 1; }
Код:
FCNPC_SetPosition(npcid, 10,50,54); // Test coords, for some reason, the NPC spawns in this coords, but not when iґm using the array.