Ayuda por el amor de dios... bucle...
#6

Quote:
Originally Posted by Daniel-92
Посмотреть сообщение
Si en el comando creas una linea por cada objeto a borrar, entonces para quй usas un bucle en la funciуn.
es ke en realidad es asi, con mucho mas objetos.
y lo hago asi por ke los objetos los elinimo en la funcion del script correspondiente y tambien utilizo la posicion de los objetos esos para crear labels y checkpoint en su posicion cuando son elininados..

pawn Код:
new Float:position[5][3],
    Float:rotation[5][3],
    ObjectID_1[5],
    ObjectID_2[5],
    ObjectID_3[5],
    ObjectID_4[5],
    ObjectID_5[5];

public OnFilterScriptInit() {
    //MAPA 1
    ObjectID_1[0]=CreateObject(1697, 306.45633, 1850.32690, 16.61320,   0.00000, 0.00000, -90.00000);
    ObjectID_1[1]=CreateObject(1697, 306.50189, 1857.30835, 16.61320,   0.00000, 0.00000, -90.00000);
    ObjectID_1[2]=CreateObject(1697, 306.52655, 1864.34985, 16.61320,   0.00000, 0.00000, -90.00000);
    ObjectID_1[3]=CreateObject(1697, 306.54568, 1871.73120, 16.61320,   0.00000, 0.00000, -90.00000);
    ObjectID_1[4]=CreateObject(1697, 306.56506, 1879.09216, 16.61320,   0.00000, 0.00000, -90.00000);
    //MAPA 2
    ObjectID_2[0]=CreateObject(1697, 306.45633, 1850.32690, 16.61320,   0.00000, 0.00000, -90.00000);
    ObjectID_2[1]=CreateObject(1697, 306.50189, 1857.30835, 16.61320,   0.00000, 0.00000, -90.00000);
    ObjectID_2[2]=CreateObject(1697, 306.52655, 1864.34985, 16.61320,   0.00000, 0.00000, -90.00000);
    ObjectID_2[3]=CreateObject(1697, 306.54568, 1871.73120, 16.61320,   0.00000, 0.00000, -90.00000);
    ObjectID_2[4]=CreateObject(1697, 306.56506, 1879.09216, 16.61320,   0.00000, 0.00000, -90.00000);
    //MAPA 3
    ObjectID_3[0]=CreateObject(1697, 306.45633, 1850.32690, 16.61320,   0.00000, 0.00000, -90.00000);
    ObjectID_3[1]=CreateObject(1697, 306.50189, 1857.30835, 16.61320,   0.00000, 0.00000, -90.00000);
    ObjectID_3[2]=CreateObject(1697, 306.52655, 1864.34985, 16.61320,   0.00000, 0.00000, -90.00000);
    ObjectID_3[3]=CreateObject(1697, 306.54568, 1871.73120, 16.61320,   0.00000, 0.00000, -90.00000);
    ObjectID_3[4]=CreateObject(1697, 306.56506, 1879.09216, 16.61320,   0.00000, 0.00000, -90.00000);
    //MAPA 4
    ObjectID_4[0]=CreateObject(1697, 306.45633, 1850.32690, 16.61320,   0.00000, 0.00000, -90.00000);
    ObjectID_4[1]=CreateObject(1697, 306.50189, 1857.30835, 16.61320,   0.00000, 0.00000, -90.00000);
    ObjectID_4[2]=CreateObject(1697, 306.52655, 1864.34985, 16.61320,   0.00000, 0.00000, -90.00000);
    ObjectID_4[3]=CreateObject(1697, 306.54568, 1871.73120, 16.61320,   0.00000, 0.00000, -90.00000);
    ObjectID_4[4]=CreateObject(1697, 306.56506, 1879.09216, 16.61320,   0.00000, 0.00000, -90.00000);
    //MAPA 5
    ObjectID_5[0]=CreateObject(1697, 306.45633, 1850.32690, 16.61320,   0.00000, 0.00000, -90.00000);
    ObjectID_5[1]=CreateObject(1697, 306.50189, 1857.30835, 16.61320,   0.00000, 0.00000, -90.00000);
    ObjectID_5[2]=CreateObject(1697, 306.52655, 1864.34985, 16.61320,   0.00000, 0.00000, -90.00000);
    ObjectID_5[3]=CreateObject(1697, 306.54568, 1871.73120, 16.61320,   0.00000, 0.00000, -90.00000);
    ObjectID_5[4]=CreateObject(1697, 306.56506, 1879.09216, 16.61320,   0.00000, 0.00000, -90.00000);
    return true;
}

COMMAND:test1(playerid, params[]) {
    GetObjectPosAndRot(0,5,ObjectID_1,position,rotation);
    GetObjectPosAndRot(1,5,ObjectID_2,position,rotation);
    GetObjectPosAndRot(2,5,ObjectID_3,position,rotation);
    GetObjectPosAndRot(3,5,ObjectID_4,position,rotation);
    GetObjectPosAndRot(4,5,ObjectID_5,position,rotation);
    return true;
}
COMMAND:test2(playerid, params[]) {
    DestroyObjectNEW(5,ObjectID_1);
    DestroyObjectNEW(5,ObjectID_2);
    DestroyObjectNEW(5,ObjectID_3);
    DestroyObjectNEW(5,ObjectID_4);
    DestroyObjectNEW(5,ObjectID_5);
    return true;
}
COMMAND:test3(playerid, params[]) {
    CreateObjectNEW(1697,5,ObjectID_1,0,position,rotation);
    CreateObjectNEW(1697,5,ObjectID_2,1,position,rotation);
    CreateObjectNEW(1697,5,ObjectID_3,2,position,rotation);
    CreateObjectNEW(1697,5,ObjectID_4,3,position,rotation);
    CreateObjectNEW(1697,5,ObjectID_5,4,position,rotation);
    return true;
}

stock DestroyObjectNEW(obj,var[]) { //FUNCIONA PERFECTO
    for(new index=0; index<obj; index++) {
        if(!IsValidObject(var[index])) continue;
        DestroyObject(var[index]);
        printf("[] DestroyObjectNEW %d", var[index]);
    }
}
stock CreateObjectNEW(id,obj,var[],array,Float:varpos[][],Float:varrot[][]) { //FUNCIONA PERFECTO
    for(new index=0; index<obj; index++) {
        if(IsValidObject(var[index])) continue;
        var[index]=CreateObject(id, varpos[array][0], varpos[array][1], varpos[array][2],   varrot[array][0], varrot[array][1], varrot[array][2]);
        printf("[] CreateObjectNEW %f %f %f %f %f %f", varpos[array][0], varpos[array][1], varpos[array][2], varrot[array][0], varrot[array][1], varrot[array][2]);
        printf("[] CreateObjectNEW %d", var[index]);
    }
}
stock GetObjectPosAndRot(array,obj,var[],Float:varpos[][],Float:varrot[][]) {//PROBLEMAS... :rolleyes:
    for(new index=0; index<obj; index++) {
        if(!IsValidObject(var[index])) continue;
        GetObjectPos(var[index], varpos[array][0], varpos[array][1], varpos[array][2]);
        GetObjectRot(var[index], varrot[array][0], varrot[array][1], varrot[array][2]);
        printf("[] GetObjectPosAndRot %d", var[index]);
        printf("[] GetObjectPosAndRot %f %f %f %f %f %f", varpos[array][0], varpos[array][1], varpos[array][2], varrot[array][0], varrot[array][1], varrot[array][2]);
    }
}
Reply


Messages In This Thread
Ayuda por el amor de dios... bucle... - by OTACON - 23.06.2013, 07:06
Respuesta: Ayuda por el amor de dios... bucle... - by JustBored - 23.06.2013, 08:03
Respuesta: Ayuda por el amor de dios... bucle... - by OTACON - 23.06.2013, 08:55
Re: Ayuda por el amor de dios... bucle... - by Daniel-92 - 23.06.2013, 14:18
Re: Ayuda por el amor de dios... bucle... - by Soi_salva - 23.06.2013, 15:41
Respuesta: Re: Ayuda por el amor de dios... bucle... - by OTACON - 23.06.2013, 22:54

Forum Jump:


Users browsing this thread: 1 Guest(s)