Guten Abend Community,
ich habe ein Problem und zwar wenn ich ein Bot erstelle und ihn eine Route laufen lasse dann funktioniert alles super.
Sobald ich aber Bots mit einem Array erstelle um mehrere Bots auf dem Server zu haben läuft das System schief.
Das ist das System mit dem Array:
#include <a_samp>
#include <FCNPC>
#include <ocmd>
#define MAX_BOTS 3
enum npcdaten
{
stage[MAX_BOTS]
}
new npc[npcdaten];
new npcid2[MAX_BOTS];
new Float:wege[][3] =
{
{2034.9735,1281.2941,10.8203},
{1955.9452,1281.0072,10.8203},
{1954.5576,1310.1185,9.2578},
{1964.3560,1310.2706,9.2578},
{1964.9832,1316.5217,9.2578},
{1985.4253,1316.6755,9.2501},
{2014.6484,1317.0253,9.2578},
{2016.3209,1333.4036,9.5435},
{2027.3127,1334.6477,10.8186},
{2028.0500,1342.7703,10.8203},
{2034.8402,1333.8080,10.8203}
};
main()
{
print("\n----------------------------------");
print(" Blank Gamemode by your name here");
print("----------------------------------\n");
}
public OnGameModeInit()
{
SetGameModeText("Blank Script");
AddPlayerClass(0, 1958.3783, 1343.1572+2, 15.3746, 269.1425, 0, 0, 0, 0, 0, 0);
FCNPC_SetUpdateRate(80);
new name[MAX_PLAYER_NAME];
for(new npcid = 0; npcid < 3; npcid++)
{
format(name,sizeof(name),"NPC_%d",npcid);
npcid2[npcid] = FCNPC_Create(name);
//Test
FCNPC_Spawn(npcid2[npcid],1,2034.8402,1333.8080,10.8203);
npc[stage][npcid] = 0;
new stage2 = npc[stage][npcid];
FCNPC_GoTo(npcid2[npcid],wege[stage2][0],wege[stage2][1],wege[stage2][2],MOVE_TYPE_RUN,MOVE_TYPE_AUTO,true);
printf("NPC %d",npcid2[npcid]);
}
return 1;
}
public OnGameModeExit()
{
return 1;
}
public OnPlayerRequestClass(playerid, classid)
{
SetPlayerPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraPos(playerid, 1958.3783, 1343.1572, 15.3746);
SetPlayerCameraLookAt(playerid, 1958.3783, 1343.1572, 15.3746);
return 1;
}
public OnPlayerConnect(playerid)
{
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
return 1;
}
public OnPlayerSpawn(playerid)
{
return 1;
}
public OnPlayerDeath(playerid, killerid, reason)
{
return 1;
}
public OnVehicleSpawn(vehicleid)
{
return 1;
}
public OnVehicleDeath(vehicleid, killerid)
{
return 1;
}
public OnPlayerText(playerid, text[])
{
return 1;
}
public OnPlayerCommandText(playerid, cmdtext[])
{
return 1;
}
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
return 1;
}
public OnPlayerExitVehicle(playerid, vehicleid)
{
return 1;
}
public OnPlayerStateChange(playerid, newstate, oldstate)
{
return 1;
}
public OnPlayerEnterCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveCheckpoint(playerid)
{
return 1;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
return 1;
}
public OnPlayerLeaveRaceCheckpoint(playerid)
{
return 1;
}
public OnRconCommand(cmd[])
{
return 1;
}
public OnPlayerRequestSpawn(playerid)
{
return 1;
}
public OnObjectMoved(objectid)
{
return 1;
}
public OnPlayerObjectMoved(playerid, objectid)
{
return 1;
}
public OnPlayerPickUpPickup(playerid, pickupid)
{
return 1;
}
public OnVehicleMod(playerid, vehicleid, componentid)
{
return 1;
}
public OnVehiclePaintjob(playerid, vehicleid, paintjobid)
{
return 1;
}
public OnVehicleRespray(playerid, vehicleid, color1, color2)
{
return 1;
}
public OnPlayerSelectedMenuRow(playerid, row)
{
return 1;
}
public OnPlayerExitedMenu(playerid)
{
return 1;
}
public OnPlayerInteriorChange(playerid, newinteriorid, oldinteriorid)
{
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
return 1;
}
public OnRconLoginAttempt(ip[], password[], success)
{
return 1;
}
public OnPlayerUpdate(playerid)
{
return 1;
}
public OnPlayerStreamIn(playerid, forplayerid)
{
return 1;
}
public OnPlayerStreamOut(playerid, forplayerid)
{
return 1;
}
public OnVehicleStreamIn(vehicleid, forplayerid)
{
return 1;
}
public OnVehicleStreamOut(vehicleid, forplayerid)
{
return 1;
}
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
return 1;
}
public OnPlayerClickPlayer(playerid, clickedplayerid, source)
{
return 1;
}
public FCNPC_OnCreate(npcid)
{
return 1;
}
public FCNPC_OnReachDestination(npcid)
{
for(new i = 0; i < MAX_BOTS; i++)
{
printf("NPC_%d",npcid);
npc[stage][npcid] += 1;
new stage2 = npc[stage][npcid];
printf("NPC_%d Stage_%d",npcid,stage);
if(npc[stage][npcid] == sizeof(wege))
{
npc[stage][npcid] = 0;
FCNPC_GoTo(npcid2[npcid], wege[0][0],wege[0][1],wege[0][2], MOVE_TYPE_RUN, MOVE_TYPE_AUTO, true);
}
FCNPC_GoTo(npcid2[npcid], wege[stage2][0],wege[stage2][1],wege[stage2][2], MOVE_TYPE_RUN, MOVE_TYPE_AUTO, true);
}
return 1;
}
Ich hoffe ihr könnt mir helfen
MfG
Master