How to add x, y to move object with floatsin, floatcos for current angle.
#1

Код:
CMD:createboard(playerid, params[]) {

    new Float:px, Float:py, Float:pz, Float:pa;
    GetPlayerPos(playerid, px, py, pz);
    GetPlayerFacingAngle(playerid, pa);

    GetXYInFrontOfPlayer(playerid, px, py, 2.0);
    pz -= 1.0;
    pa += 180;
    
    CreateDynamicObject(3077, px, py, pz, 0.0000, 0.0000, pa); // Board Object

    // Calulate X, Y for Text
    pa += 90.0;    
    px = px + (2.0 * floatsin(pa, degrees));
    py = py - (2.0 * floatcos(pa, degrees));

    pz -= 1.3;

    new obj = CreateDynamicObject(19482, px, py, pz + 2.6653, 0.0000, 0.0000, pa);
    SetDynamicObjectMaterialText(obj, 0, "TOP 3 Players", OBJECT_MATERIAL_SIZE_256x256, "Arial", 16, 1, 0xFFFFFFFF, 0, 0);

    obj = CreateDynamicObject(19482, px, py, pz + 2.0553, 0.0000, 0.0000, pa);
    SetDynamicObjectMaterialText(obj, 0, "1. Player 1", OBJECT_MATERIAL_SIZE_256x256, "Arial", 12, 1, 0xFFFFFFFF, 0, 0);

    obj = CreateDynamicObject(19482, px, py, pz + 1.6353, 0.0000, 0.0000, pa);
    SetDynamicObjectMaterialText(obj, 0, "2. Player 2", OBJECT_MATERIAL_SIZE_256x256, "Arial", 12, 1, 0xFFFFFFFF, 0, 0);

    obj = CreateDynamicObject(19482, px, py, pz + 1.2153, 0.0000, 0.0000, pa);
    SetDynamicObjectMaterialText(obj, 0, "3. Player 3", OBJECT_MATERIAL_SIZE_256x256, "Arial", 12, 1, 0xFFFFFFFF, 0, 0);

    return 1;
}
result: It's work every angle




I want to move them into board.

How I can do it ?
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 5 Guest(s)