object, keys use
#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


Messages In This Thread
object, keys use - by Karolukas123 - 16.08.2015, 23:48
Re: object, keys use - by ZToPMaN - 16.08.2015, 23:50
Re: object, keys use - by Karolukas123 - 16.08.2015, 23:58
Re: object, keys use - by Banana_Ghost - 17.08.2015, 02:40
Re: object, keys use - by Abagail - 17.08.2015, 02:43

Forum Jump:


Users browsing this thread: 1 Guest(s)