I dont know what's wrong in this code . It's like mob spawn in nosfun files .
Code:
int spawnnpc(SOCKET *accetta, std::string n_npc, std::string hp, int client, int numeronemici){
numeronemici += 1;
npcstruct[numeronemici].x_npc = pstruct[client].x, npcstruct[numeronemici].y_npc = pstruct[client].y, npcstruct[numeronemici].ingame = true, npcstruct[numeronemici].hp_npc = hp, npcstruct[numeronemici].id_npc = intostr(numeronemici + 1500), npcstruct[numeronemici].n_npc = n_npc, npcstruct[numeronemici].maxhp_npc = hp, npcstruct[numeronemici].map_npc = pstruct[client].map;
std::string spawnnpc = EncryptGamePacket("in 2" + npcstruct[numeronemici].n_npc + " " + npcstruct[numeronemici].id_npc + " " + npcstruct[numeronemici].x_npc + " " + npcstruct[numeronemici].y_npc + " 5 " + npcstruct[numeronemici].hp_npc + " 50 0 0 0 -1 1 0 -1 - 0 -1 0 0 0 0 0 0 0 0");
for (int i = 0; i <= utenti; i++) if (npcstruct[numeronemici].map_npc == pstruct[i].map) send(accetta[i], spawnnpc.c_str(), spawnnpc.size(), 0);
std::cout << numeronemici << std::endl;
std::cout << npcstruct[numeronemici].id_npc << std::endl;
return numeronemici;
}