CMD:npckill(playerid, params[]) { if(!FCNPC_IsDead(strval(params)) && FCNPC_IsValid(strval(params))) {FCNPC_SetHealth(amount, 0.0); } } public FCNPC_OnReachDestination(npcid) { if(Citiziens[npcid][cInReachDestination] == 1) { if(Citiziens[npcid][cIsCPlayNode] == 1) { FCNPC_SetNodePoint(Citiziens[npcid][cNodeNow], Citiziens[npcid][cNodePoint]); FCNPC_PlayNode(npcid, Citiziens[npcid][cNodeNow], NODE_TYPE_PED); } Citiziens[npcid][cInReachDestination] = 0; } return 1; } public FCNPC_OnChangeNode(npcid, nodeid) { new point,pednodes,vehnodes,node; loop_GetNode: { GetRandomZitiziensNode(node,pednodes,vehnodes); if(pednodes > vehnodes) { point = random(pednodes - 1) + vehnodes + 1; } else goto loop_GetNode; } FCNPC_SetNodePoint(node, point); FCNPC_PlayNode(npcid, node, NODE_TYPE_PED); return 1; } stock GetRandomZitiziensNode(&node, &point, &vehnodes) { node = random(MAX_NODES); while(!LosSantosNodes(node)) { node = random(MAX_NODES); } new navinodes, pednodes; FCNPC_GetNodeInfo(node, vehnodes, pednodes, navinodes); point = random(pednodes); return 1; } |