public OnPlayerEnterDynamicArea(playerid, areaid)
{
for(new i; i != GetMaxPlayers(); i++)
{
if(areaid == OBJECT_PROXIMITY_AREA[i]) //Just ignore this, as it works properly.
{
SCM(playerid,COLOR_RED, "You've stepped on a proximity bomb.");
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, Float:x, Float:y, Float:z);
CreateExplosion(x, y, z, 2, 10.0);
DestroyDynamicObject(OBJECT_PROXIMITY[i]);
DestroyDynamicArea(OBJECT_PROXIMITY_AREA[i]);
}
if(areaid == OBJECT_SENSOR_AREA[i]) //This is the area we are looking at
{
SCM(playerid,COLOR_RED, "You've entered a monitored area.");
SetPlayerMarkerForPlayer( i, i, ( GetPlayerColor( 1 ) | 0x000000FF )); // <---
}
}
return 1;
}
public OnPlayerLeaveDynamicArea(playerid, areaid)
{
foreach(Player, i)
{
ShowPlayerNameTagForPlayer(i, i, 0);
}
SCM(playerid,COLOR_GREEN, "You've exited a monitored area.");
}
//This is when a player creates the actual area.
if(dialogid == INVENTORY_MOTIONSENSOR) //
{
if(!response) return ShowPlayerDialog(playerid,INVENTORY_MAIN,DIALOG_STYLE_LIST, "Inventory", invstring, "Select", "Cancel");
if(motionsensor[playerid] == 0) return SCM(playerid,COLOR_GREY, "Error: You don't have any motion sensors");
if(listitem == 0) //lay sensor
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, Float:x, Float:y, Float:z);
OBJECT_SENSOR[playerid] = CreateObject(16782, x, y, z-0.8, 0.00000, -90.00000, 0.00000);
OBJECT_SENSOR_AREA[playerid] = CreateDynamicCircle(x, y, 15.0, -1, -1, -1);
TogglePlayerDynamicArea(playerid, OBJECT_SENSOR_AREA[playerid], 1);
SCM(playerid,COLOR_GREEN, "You've activated your motion sensor. Anyone near it will show on your radar.");
motionsensor[playerid] --;
}
}
Have you set the player's color before? Important Note: GetPlayerColor will return nothing unless SetPlayerColor has been used!
|
SetPlayerMarkerForPlayer( i, i, ( GetPlayerColor( 1 ) | 0x000000FF ));
SetPlayerMarkerForPlayer( playerid, i, ( GetPlayerColor( 1 ) | 0x000000FF ));