Lets say I have coordinates written to the file 123.cfg like this
Code:
-118 -1624 -475
-157 -1624 -475
-192 -1623 -475
-235 -1622 -475
-278 -1621 -475
-324 -1620 -475
-379 -1619 -475
I can use find entity by class, but I dont know how to check it on each coords
(cheap suits code)
PHP Code:
Load_Origins(CurMap[])
{
new MapFile[64]
format(MapFile, 63, "%s/%s.cfg", g_ItemOriginDir, CurMap)
if(!file_exists(MapFile)) {
return PLUGIN_CONTINUE
}
g_MapItemNum = 0
for(new i = 1; i <= MAX_MAPITEMS; ++i)
{
g_MapItemOrgins[i][0] = 0
g_MapItemOrgins[i][1] = 0
g_MapItemOrgins[i][2] = 0
}
new Text[64], Line = 0, Len = 0
while(read_file(MapFile, Line++, Text, 63, Len))
{
if((Text[0]==';') || !Len) {
continue
}
if(g_MapItemNum >= MAX_MAPITEMS)
{
log_amx("Max map items reached, please increase MAX_MAPITEMS")
break
}
new iOrigin[3][16]
parse(Text, iOrigin[0], 15, iOrigin[1], 15, iOrigin[2], 15)
g_MapItemNum++
g_MapItemOrgins[g_MapItemNum][0] = str_to_num(iOrigin[0])
g_MapItemOrgins[g_MapItemNum][1] = str_to_num(iOrigin[1])
g_MapItemOrgins[g_MapItemNum][2] = str_to_num(iOrigin[2])
}
return PLUGIN_CONTINUE
}
public Spawn_Items()
{
for(new i = 1; i <= MAX_MAPITEMS; ++i)
{
if((g_MapItemOrgins[i][0] == 0) && (g_MapItemOrgins[i][1] == 0) && g_MapItemOrgins[i][2] == 0) {
continue
}
// here we must check if entity is already there and dont let it spawn twice
Create_Items(g_MapItemOrgins[i])[/B]
}
}
Your suggestion, how to block it from spawning twice at the same place? but spawn in others if not exist
__________________
VDS in Europe 1 gb/s unmetered.Any configurations.
I accept Paypal, Moneybookers,etc