Empty array
#7

PHP код:
#include <a_samp>
#include <streamer>
#include <sscanf2>
#include <ColAndreas>
#include <zcmd>
#include <YSI_Core\y_utils>
#include <YSI_Coding\y_timers>
new Timer:timer1;
new 
Grass[5];
new 
br=0;
new 
scfmString[250];
#define SCM SendClientMessage
#define SCFM(%1,%2,%3) format(scfmString,sizeof(scfmString),%3), SCM(%1,%2,scfmString)
public OnFilterScriptInit()
{
    
CA_Init();
    return 
1;
}
public 
OnFilterScriptExit()
{
    return 
1;
}
CMD:as(playeridparams[], help
{
    for(new 
i=0i<5i++)
    {
        new 
Float:randx RandomFloat(109.2241-92.6121)+92.6121;   
        new 
Float:randy RandomFloat(-71.6366-(-57.7923))+57.7923;
        new 
Float:z;
        
CA_FindZ_For2DCoord(randxrandyz);
        
Grass[i] = CreatePlayerObject(playerid802randxrandyz+0.2000);
    }
    
timer1 repeat Tajmer(playerid);
    return 
1;
}
CMD:aa(playeridparams[], help
{
    
stop timer1;
    return 
1;
}
timer Tajmer[100](playerid)
{
    new 
Float:x,Float:y,Float:z;
    for(new 
i=0i<sizeof(Grass); i++)
    {
        
GetPlayerObjectPos(playeridGrass[i], xyz);
        if(
IsPlayerInRangeOfPoint(playerid1xyz))
        {
            
DestroyPlayerObject(playeridGrass[i]);
            
Grass[i] = 0;
            
br++;
        }
    }
    if(
br >= sizeof(Grass))
    {
        
SendClientMessage(playerid, -1,"No grass");
    }
    return 
1;

I have problem with this part:
PHP код:
        if(IsPlayerInRangeOfPoint(playerid1xyz))
        {
            
DestroyPlayerObject(playeridGrass[i]);
            
Grass[i] = 0;
            
br++;
        } 
Sometimes do this if object is already destroyed
Reply


Messages In This Thread
Empty array - by Cyber123 - 30.01.2019, 13:02
Re: Empty array - by Kaliber - 30.01.2019, 13:28
Re: Empty array - by Cyber123 - 30.01.2019, 13:48
Re: Empty array - by Pottus - 30.01.2019, 15:25
Re: Empty array - by Mobtiesgangsa - 30.01.2019, 17:17
Re: Empty array - by Cyber123 - 30.01.2019, 18:21
Re: Empty array - by Cyber123 - 30.01.2019, 20:43
Re: Empty array - by Jefff - 31.01.2019, 00:15
Re: Empty array - by Cyber123 - 31.01.2019, 13:04
Re: Empty array - by Cyber123 - 31.01.2019, 14:23

Forum Jump:


Users browsing this thread: 4 Guest(s)