![]() |
Como hago que mi npc ataque al equipo contrario - Printable Version + open.mp forum (https://forum.open.mp) -- Forum: Other languages (https://forum.open.mp/forumdisplay.php?fid=23) --- Forum: Spanish/Espa?ol (https://forum.open.mp/forumdisplay.php?fid=24) ---- Forum: Programaci?n (https://forum.open.mp/forumdisplay.php?fid=51) ---- Thread: Como hago que mi npc ataque al equipo contrario (/showthread.php?tid=3086) |
Como hago que mi npc ataque al equipo contrario - Nikolay_Staggs - 2025-02-22 como le hago para que un npc ataque al equipo contrario esto es lo que tengo pero no logro me pueden ayudar enum enum_npc_player { pnpc_IS_FROM_THE_TEAM }; new INFO_PLAYER_NPC[MAX_PLAYERS][enum_npc_player]; enum NPC_enum { npc_IS_FROM_THE_TEAM, npc_SKIN, npc_NAME[24], Float:npc_X, Float:npc_Y, Float:npc_Z, Float:npc_A, npc_COLOR, npc_WEAPON, Float:npc_ZONE_MINX, Float:npc_ZONE_MINY, Float:npc_ZONE_MAXX, Float:npc_ZONE_MAXY, npc_ZONE_ID }; new INFO_NPC_SERVER[][NPC_enum] = { {TEAM_military, 287, "Elias", -1533.6201, 480.6512, 7.2982, 0.0, COLOR_MILITARY, WEAPON_M4, -1693.0, 209.5, -1190.0, 516.5}, {TEAM_terrorist, 192, "Mali", 1583.1284, 1117.3468, 26.7467, 0.0, COLOR_TERRORIST, WEAPON_AK47, 1559.0, 861.5, 1788.0, 1132.5} }; public OnGameModeInit() { for(new i = 0; i != sizeof INFO_NPC_SERVER; i ++) { new npcid; new str[250], player_id = INVALID_PLAYER_ID; format(str,sizeof(str),"%s(%d)",INFO_NPC_SERVER[i][npc_NAME],MAX_PLAYERS-(i)); npcid = FCNPC_Create(str); FCNPC_Spawn(npcid, INFO_NPC_SERVER[i][npc_SKIN], INFO_NPC_SERVER[i][npc_X], INFO_NPC_SERVER[i][npc_Y], INFO_NPC_SERVER[i][npc_Z]); FCNPC_SetWeapon(npcid, INFO_NPC_SERVER[i][npc_WEAPON]); FCNPC_SetAmmo(npcid, 999999); FCNPC_SetInvulnerable(npcid, true); SetPlayerColor(npcid, INFO_NPC_SERVER[i][npc_COLOR]); INFO_NPC_SERVER[i][npc_ZONE_ID] = CreateDynamicCircle(INFO_NPC_SERVER[i][npc_ZONE_MINX], INFO_NPC_SERVER[i][npc_ZONE_MINY], INFO_NPC_SERVER[i][npc_ZONE_MAXX], 0, 0); if(player_id == INVALID_PLAYER_ID) continue; INFO_PLAYER_NPC[player_id][pnpc_IS_FROM_THE_TEAM] = INFO_NPC_SERVER[i][npc_IS_FROM_THE_TEAM]; } return 1; } public OnPlayerEnterDynamicArea(playerid, areaid) { for(new i = 0; i != sizeof INFO_NPC_SERVER; i ++) { if(areaid == INFO_NPC_SERVER[i][npc_ZONE_ID]) { new Float:X, Float:Y, Float:Z; GetPlayerPos(playerid, X, Y, Z); if(FCNPC_IsDead(i)) return 1; if(IsPlayerInRangeOfPoint(i, 50.0, X, Y, Z)) { if(PLAYER_TEMP[playerid][t_TEAM_PLAYER] == INFO_PLAYER_NPC[playerid][pnpc_IS_FROM_THE_TEAM]){}else{FCNPC_MeleeAttack(i, 500);} } } } return 1; } RE: Como hago que mi npc ataque al equipo contrario - alexhepnar.1 - 2025-03-14 Escribime al privado. O al discord: ahjok RE: Como hago que mi npc ataque al equipo contrario - Pac0 - 2025-03-30 Actualmente FCNPC no va a funcionar como corresponde. Debe ser adaptado a open mp si no me equivoco, |