CreateObject
#4

Quote:
Originally Posted by DavidSparks
Посмотреть сообщение
So if I understand you right, you want to make 3 objects and when someone touches them what should happen then?
So when someone touches first object then the first object get destroyed and when someone touches the second object then seconds object get destroyed and so..

Something like that.
pawn Код:
new Object[3];
new Float:ObjectX[3], Float:ObjectY[3], Float:ObjectZ[3];
forward removeObjects();

CMD:lol(playerid, paramas[])
{
    Object[0] = CreateObject(3409, 781.7954,317.2031,20.2952 - 1.3, 0.0, 0.0, 12.0359 + 90);
    ObjectX[0] = 781.7954;
    ObjectY[0] = 317.2031;
    ObjectZ[0] = 20.2952;
   
    Object[1] = CreateObject(3409, 786.6342,318.3507,20.2842 - 1.3, 0.0, 0.0, 22.3759 + 90);
    ObjectX[1] = 786.6342;
    ObjectY[1] = 318.3507;
    ObjectZ[1] = 20.2842;
   
    Object[2] = CreateObject(3409, 792.0835,320.0193,20.2466 - 1.3, 0.0, 0.0, 7.6490 + 90);
    ObjectX[2] = 792.0835;
    ObjectY[2] = 320.0193;
    ObjectZ[2] = 20.2466;
    return 1;
}

public removeObjects()
{
    foreach (new i : Player) //use normal loop if ur not using foreach
    {
        if(IsPlayerInRangeOfPoint(i, 1, ObjectX[0], ObjectY[0], ObjectZ[0]))
        {
            DestroyObject(Object[0]);
        }
        else if(IsPlayerInRangeOfPoint(i, 1, ObjectX[1], ObjectY[1], ObjectZ[1]))
        {
            DestroyObject(Object[1]);
        }
        else if(IsPlayerInRangeOfPoint(i, 1, ObjectX[2], ObjectY[2], ObjectZ[2]))
        {
            DestroyObject(Object[2]);
        }
    }
    return 1;
}
But when i have 100 object then i want to use loop.
Reply


Messages In This Thread
CreateObject - by finelaq - 10.01.2015, 18:16
Re: CreateObject - by DavidSparks - 10.01.2015, 18:40
Re: CreateObject - by Anuris - 10.01.2015, 18:43
Re: CreateObject - by finelaq - 10.01.2015, 18:50
Re: CreateObject - by finelaq - 11.01.2015, 08:48

Forum Jump:


Users browsing this thread: 1 Guest(s)