12.06.2012, 14:52
So I'm trying to detect if the player is in range of different objects around the map but it doesn't seem to come back with anything in game, this is the code. How can I fix this, I get no errors when compiling.
pawn Код:
#define PICKUP KEY_CROUCH
#define PRESSED(%0) \
(((newkeys & (%0)) == (%0)) && ((oldkeys & (%0)) != (%0)))
new trash1 = 849;
new trash2 = 850;
new trash3 = 851;
new trash[2];
public OnGameModeInit()
{
trash[0] = CreateStreamObject(trash1,-1434.83980000,-1543.10680000,101.15780000,0,0,0,250);
trash[1] = CreateStreamObject(trash2,-1458.52770000,-1568.13610000,101.15780000,0,0,0,250);
trash[2] = CreateStreamObject(trash3,-1461.26840000,-1571.22050000,101.15000000,0,0,0,250);
return 1;
}
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{
if (PRESSED(PICKUP))
{
new Float:x,Float:y,Float:z;
for(new object;object<sizeof(trash);object++)
{
GetObjectPos(trash[object],x,y,z);
if(IsPlayerInRangeOfPoint(playerid,3.0,x,y,z))
{
GameTextForPlayer(playerid, "~w~Looking through trash.", 1000, 3);
ApplyAnimation(playerid,"MISC","pickup_box",4.1,0,1,1,0,1,1);
break;
}
}
}
return 1;
}