support positions ...
#1

good at all, I could say that's what I'm doing wrong that I do not walk the following code?

what I do is the following:

1- I think the objects when you start the gamemode.
2- Save the position and rotation of objects created in OnFilterScriptInit
3- Delete objects created in OnFilterScriptInit
4- I OnFilterScriptInit created objects again using the previously saved position and rotation
5- result .... I create all objects in the position of the last item, ObjectID bone [4].


pawn Код:
new Float:position[5][3],
    Float:rotation[5][3],
    ObjectID[5];

public OnFilterScriptInit() {
    //I think the objects when you start the gamemode.
    ObjectID[0]=CreateObject(1697, 306.45633, 1850.32690, 16.61320,   0.00000, 0.00000, -90.00000);
    ObjectID[1]=CreateObject(1697, 306.50189, 1857.30835, 16.61320,   0.00000, 0.00000, -90.00000);
    ObjectID[2]=CreateObject(1697, 306.52655, 1864.34985, 16.61320,   0.00000, 0.00000, -90.00000);
    ObjectID[3]=CreateObject(1697, 306.54568, 1871.73120, 16.61320,   0.00000, 0.00000, -90.00000);
    ObjectID[4]=CreateObject(1697, 306.56506, 1879.09216, 16.61320,   0.00000, 0.00000, -90.00000);
    return true;
}

COMMAND:test1(playerid, params[]) { //Save the position and rotation of objects created in OnFilterScriptInit
    GetObjectPosAndRot(0,5,ObjectID,position,rotation);
    GetObjectPosAndRot(1,5,ObjectID,position,rotation);
    GetObjectPosAndRot(2,5,ObjectID,position,rotation);
    GetObjectPosAndRot(3,5,ObjectID,position,rotation);
    GetObjectPosAndRot(4,5,ObjectID,position,rotation);
    return true;
}
COMMAND:test2(playerid, params[]) { //Delete objects created in OnFilterScriptInit
    DestroyObjectNEW(5,ObjectID);
    return true;
}
COMMAND:test3(playerid, params[]) { //I OnFilterScriptInit created objects again using the previously saved position and rotation
    CreateObjectNEW(1697,5,ObjectID,0,position,rotation);
    CreateObjectNEW(1697,5,ObjectID,1,position,rotation);
    CreateObjectNEW(1697,5,ObjectID,2,position,rotation);
    CreateObjectNEW(1697,5,ObjectID,3,position,rotation);
    CreateObjectNEW(1697,5,ObjectID,4,position,rotation);
    return true;
}

stock DestroyObjectNEW(obj,var[]) {
    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[][]) {
    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("[] 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]);
        printf("[] CreateObjectNEW %d", var[index]);
    }
}
stock GetObjectPosAndRot(array,obj,var[],Float:varpos[][],Float:varrot[][]) {
    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]);
    }
}
I need help please.
from already thank you very much.

sorry for my English.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)