objects not getting destroyed
#4

I just spent ages writing a massive post and it said my token had expired because I left the page open too long... so I'm just going to spit some code at you and let you figure it out.

PHP код:
new CherryCount[MAX_PLAYERS];
new 
CageHuman[MAX_PLAYERS][5] = {INVALID_OBJECT_ID, ...};

CMD:activate(playerid)
{
    if(
pInfo[playerid][HasCherryPerk] == 1)
    {    
        if(
maptime <= 120// If Map Time is less than 120 seconds (2 Minutes)
        
{
            new 
Float:xFloat:yFloat:z;
            
GetPlayerPos(playeridFloat:xFloat:yFloat:z); // Get Player Position
            
if(team[playerid] == TEAM_HUMAN)// if team is Human
            
{
                if(
CherryCount[playerid]++ != 0) return SendClientMessage(playerid, -1"You have already enabled this perk.");
                
SetTimerEx("GetCherried"3000false"i"playerid);
                
CageHuman[playerid][0] = CreateObject(971Float:4.0Float:4.0Float:z0.00.00.0);
                
CageHuman[playerid][1] = CreateObject(971Float:4.0Float:4.0Float:z0.00.00.0);
                
CageHuman[playerid][2] = CreateObject(971Float:1.0Float:yFloat:z0.00.090.0);
                
CageHuman[playerid][3] = CreateObject(971Float:8.0Float:yFloat:z0.00.090.0);
                
CageHuman[playerid][4] = CreateObject(971Float:4.0Float:yFloat:3.090.00.00.0);
            }
            
// else SendClientMessage(playerid, -1, "Only Humans can use this perk.");
        
}
        
// else SendClientMessage(playerid, -1, "Map Time is more than 120 seconds.");
    
}
    
// else SendClientMessage(playerid, -1, "You don't have the Cherry perk.");    
    
return 1;
}

forward GetCherried(playerid);
public 
GetCherried(playerid)
{
    new 
Float:xFloat:yFloat:z;
    foreach(new 
Player)
    {
        if(
== playerid || team[i] != TEAM_ZOMBIE) continue;
        if(
GetDistanceBetweenPlayers(playeridi) < 15.0)
        {
            
GetPlayerVelocity(iFloat:xFloat:yFloat:z);
            
SetPlayerVelocity(iFloat:0.3Float:0.3Float:0.2);
        }
    }
    if(!
IsPlayerConnected(playerid) || ++CherryCount[playerid] > 3)
    {
        for(new 
0sizeof(CageHuman[]); j++)
        {
            
DestroyObject(CageHuman[playerid][j]);
            
CageHuman[playerid][j] = INVALID_OBJECT_ID;
        }
        
CherryCount[playerid] = 0;
        return 
1;
    }
    else 
SetTimerEx("GetCherried"3000false"i"playerid);
    return 
1;

Haven't tested, have fun, cya, bye.
Reply


Messages In This Thread
objects not getting destroyed - by Crystallize - 07.06.2017, 11:07
Re: objects not getting destroyed - by Mister0 - 07.06.2017, 14:54
Re: objects not getting destroyed - by Crystallize - 07.06.2017, 17:43
Re: objects not getting destroyed - by Threshold - 08.06.2017, 05:07
Re: objects not getting destroyed - by Crystallize - 08.06.2017, 14:44
Re: objects not getting destroyed - by Threshold - 09.06.2017, 07:37

Forum Jump:


Users browsing this thread: 1 Guest(s)