object, keys use
#1

Hey, so i need help.. so how to make random object create in mapp and create on object 3dtext, and if i near that object i can use key_N
Reply
#2

What is the key " N " do ?
do you want a moveaple objects and createobject?
Reply
#3

No no no, i need explanation how to make random object on maps.. and if i near object i can use key.. i need how make check if player near that random object
Reply
#4

pawn Код:
enum ObjectData
{
    ModelID,
    Float:oPosX,
    Float:oPosY,
    Float:oPosZ,
    Float:oRotX,
    Float:oRotY,
    Float:oRotZ
}

static const oInfo[][ObjectData] =
{
    {1225, 0.00, 0.00, 0.00, 0.00,0.00, 0.00},
    {1226, 0.00, 0.00, 0.00, 0.00,0.00, 0.00}
};

public OnGameModeInit()
{
    for(new i = 0; i < sizeof(oInfo); i++)
    {
        CreateObject(oInfo[i][ModelID],oInfo[i][oPosX],oInfo[i][oPosY],oInfo[i][oPosZ],oInfo[i][oRotX],oInfo[i][oRotY],oInfo[i][oRotZ]);
    }
    return 1;
}

public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
    if(newkeys & KEY_NO)
    {
        for(new i = 0; i < sizeof(oInfo); i++)
        {
            if(IsPlayerInRangeOfPoint(playerid, 5.0, oInfo[i][oPosX],oInfo[i][oPosY],oInfo[i][oPosZ]))
            {
                SendClientMessage(playerid, -1, "You are in range of the object.");
                        break;
            }
        }
    }

    return 1;
}
Pretty sure you have your own array to loop through, this is merely an example looping through all of the objects on the server if they press the N key.

EDIT: More into it, you can place object ids and positions into the array above, and have the server create the objects, here they're all being created on gamemode initialization. With the 3D Textlabels, the same logic applies as above.
Reply
#5

The tricky thing with "random positions" is that there are by default no functions to get singleplayer pedestrian spawn nodes, etc so you need to make the positions manually unless you extract the data into a PAWN format from the game files.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)