Random location problem
#1

Guys i have a gift script for my server but i got some problem in it whenever i get gift sometimes it repeat the location and it happen alot of times spawning on same location if you take one here is my code and tell me how to fix to spawn at every new and random location

This is timer of Gift
PHP код:
forward GiftLoc();
public 
GiftLoc()
{
        if(
gifttime <= 0)
        {
            new 
gifttmp2[10], giftstring[170], giftstring2[170], gifttmp3[10], Float:gxFloat:gyFloat:gzGiftModels;
            if(!
CreatedGift)
               {
                if(
ongift == 1)
                {
                    
giftloc random(dini_Int(AddDirFile(dir_datafilesFILE_TOTALSTAT), "giftlocs"));
                    
format(gifttmp210"gloc%d"giftloc);
                    
//giftloc2 = giftloc;
                    
if(dini_Exists(AddDirFile(dir_glocationfilesgifttmp2)))
                       {
                            
GiftModels dini_Int(AddDirFile(dir_glocationfilesgifttmp2), "GModel");
                              
gx dini_Int(AddDirFile(dir_glocationfilesgifttmp2), "LocationX");
                            
gy dini_Int(AddDirFile(dir_glocationfilesgifttmp2), "LocationY");
                            
gz dini_Int(AddDirFile(dir_glocationfilesgifttmp2), "LocationZ");
                            
GiftPickup CreatePickup(GiftModels1gxgygz, -1);
                            
format(giftstringsizeof(giftstring), "{FF0000}Santa Claus: {FFFFFF}There is a present for you in %s. Merry Christmas, HO HO HO!"dini_Get(AddDirFile(dir_datafilesFILE_GLOCSS), gifttmp2));
                            
SendClientMessageToAll2(COLOR_REDgiftstring);
                            
CreatedGift 1;
                    }
                 }
            }
            else
            {
                      
format(gifttmp310"gloc%d"giftloc);
                    if(
CreatedGift == 1)
                    {
                        
format(giftstring2sizeof(giftstring2), "{FF0000}Santa Claus: {FFFFFF}My present is still waiting for you in %s. Merry Christmas, HO HO HO!"dini_Get(AddDirFile(dir_datafilesFILE_GLOCSS), gifttmp3));
                        
SendClientMessageToAll2(COLOR_REDgiftstring2);
                       }
            }
            
gifttime GetGiftInfo("Gifttime");
        }
        else if(
gifttime GetGiftInfo("Gifttime")) gifttime=0;
        else 
gifttime--;

This is pickup code of gift
PHP код:
new giftstring[120], gifttmp3[7], Float:gxFloat:gyFloat:gzGiftModels;
        
giftloc random(dini_Int(AddDirFile(dir_datafilesFILE_TOTALSTAT), "giftlocs"));
        
format(gifttmp310"gloc%d"giftloc);
        
//giftloc2 = giftloc;
        
if(CreatedGift == 0)
        {
            if(
dini_Exists(AddDirFile(dir_glocationfilesgifttmp2)))
            {
                        
GiftModels dini_Int(AddDirFile(dir_glocationfilesgifttmp3), "GModel");
                          
gx dini_Int(AddDirFile(dir_glocationfilesgifttmp3), "LocationX");
                        
gy dini_Int(AddDirFile(dir_glocationfilesgifttmp3), "LocationY");
                        
gz dini_Int(AddDirFile(dir_glocationfilesgifttmp3), "LocationZ");
                        
GiftPickup CreatePickup(GiftModels1gxgygz, -1);
                        
format(giftstringsizeof(giftstring), "{FF0000}Santa Claus: {FFFFFF}The next present is located in %s. HO HO HO!"dini_Get(AddDirFile(dir_datafilesFILE_GLOCSS), gifttmp3));
                        
SendClientMessageToAll2(COLOR_REDgiftstring);
                        
CreatedGift 1;
            }
        }
    } 
Reply


Messages In This Thread
Random location problem - by IceBilizard - 25.12.2015, 07:58
Re: Random location problem - by prineside - 25.12.2015, 14:54
Re: Random location problem - by xTURBOx - 26.12.2015, 05:23
Re: Random location problem - by IceBilizard - 26.12.2015, 05:49

Forum Jump:


Users browsing this thread: 1 Guest(s)