17.08.2015, 02:40
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;
}
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.