Raised This Month: $ Target: $400
 0% 

check if entity exist on coordinates


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
avril-lavigne
Banned
Join Date: Apr 2009
Old 07-30-2013 , 18:27   check if entity exist on coordinates
Reply With Quote #1

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(MapFile63"%s/%s.cfg"g_ItemOriginDirCurMap)
    if(!
file_exists(MapFile)) {
        return 
PLUGIN_CONTINUE
    
}

    
g_MapItemNum 0
    
for(new 1<= MAX_MAPITEMS; ++i
    {
        
g_MapItemOrgins[i][0] = 0
        g_MapItemOrgins
[i][1] = 0
        g_MapItemOrgins
[i][2] = 0
    
}
    
    new 
Text[64], Line 0Len 0
    
while(read_file(MapFileLine++, Text63Len))
    {
        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(TextiOrigin[0], 15iOrigin[1], 15iOrigin[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 
1<= 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

Last edited by avril-lavigne; 07-30-2013 at 18:30.
avril-lavigne is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:58.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode