Thread: [Solved] Invalid cellvector handle
View Single Post
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-24-2018 , 06:52   Re: Invalid cellvector handle
Reply With Quote #38

Quote:
Originally Posted by edon1337 View Post
This is why I don't like touching other people's code, it's confusing when you're not the one who wrote it.

Would setting the size to 0 make it start over from first one?
PHP Code:
stock SsGetOrigin(Float:origin[3])
{
    new 
Float:data[3], size
    
new ok 1

    
while((size ArraySize(g_vecSsOrigins)))
    {
        new 
idx random_num(0size 1)

        
ArrayGetArray(g_vecSsOriginsidxorigin)

        new 
used ArraySize(g_vecSsUsed)
        for(new 
0usedi++)
        {
            
ok 0
            ArrayGetArray
(g_vecSsUsedidata)
            if(
get_distance_f(dataorigin) >= g_flSsMinDist)
            {
                
ok 1
                
break
            }
        }

        if(
ok)
        {
            
ArrayPushArray(g_vecSsUsedorigin)
            return 
true
        
}
    }
    
size=0;
    return 
false

Setting the size to 0 at the end of the stock its useless wont effect anything


Also random_num(0, size - 1) = random(size) if size is greater than 0.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 07-24-2018 at 06:54.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh