View Single Post
Old 18/02/2019, 08:21 PM   #1
MyUndiesSmell
Big Clucker
 
Join Date: Sep 2015
Posts: 63
Reputation: 0
Default Lumberjack help, I have a headache.

Code:
new LumberJackTree[15];

public OnPlayerConnect(playerid)
{
	LumberJackTree[0] = CreateObject(892, -497.446624, -62.991870, 60.289428, 0.000000, 0.000000, 0.000000, 300.00); 
    	LumberJackTree[1] = CreateObject(892, -488.650482, -62.737354, 59.973289, 0.000000, 0.000000, 0.000000, 300.00); 
   	LumberJackTree[2] = CreateObject(892, -480.929779, -63.083427, 59.659553, 0.000000, 0.000000, 0.000000, 300.00); 
    	LumberJackTree[3] = CreateObject(892, -473.068786, -63.282073, 59.345729, 0.000000, 0.000000, 0.000000, 300.00); 
   	LumberJackTree[4] = CreateObject(892, -464.964324, -64.386199, 59.087421, 0.000000, 0.000000, 0.000000, 300.00); 
    	LumberJackTree[5] = CreateObject(892, -461.846618, -54.567378, 59.043685, 0.000000, 0.000000, 0.000000, 300.00); 
    	LumberJackTree[6] = CreateObject(892, -470.528350, -52.936355, 59.151813, 0.000000, 0.000000, 0.000000, 300.00); 
    	LumberJackTree[7] = CreateObject(892, -478.066589, -52.890533, 59.265464, 0.000000, 0.000000, 0.000000, 300.00); 
    	LumberJackTree[8] = CreateObject(892, -487.057525, -52.328693, 59.463527, 0.000000, 0.000000, 0.000000, 300.00); 
    	LumberJackTree[9] = CreateObject(892, -496.125122, -52.100967, 59.372920, 0.000000, 0.000000, 0.000000, 300.00); 
    	LumberJackTree[10] = CreateObject(892, -494.526092, -39.977500, 59.277206, 0.000000, 0.000000, 0.000000, 300.00); 
    	LumberJackTree[11] = CreateObject(892, -485.614471, -40.435729, 59.019008, 0.000000, 0.000000, 0.000000, 300.00); 
    	LumberJackTree[12] = CreateObject(892, -478.597869, -40.759445, 58.994010, 0.000000, 0.000000, 0.000000, 300.00); 
    	LumberJackTree[13] = CreateObject(892, -470.518829, -39.444923, 58.971988, 0.000000, 0.000000, 0.000000, 300.00); 
    	LumberJackTree[14] = CreateObject(892, -461.466094, -38.041519, 58.947326, 0.000000, 0.000000, 0.000000, 300.00);
	return 1;
}

TreeToPlayerDistance(playerid, Float: range = 2.0)
{
    new Float:Distance = range; 
    new Float:tx, Float:ty, Float: tz;

    for(new i = 0; i < sizeof(LumberJackTree); i++)
    {
        GetObjectPos(LumberJackTree[i], tx, ty, tz);
    }

    Distance = GetPlayerDistanceFromPoint(playerid, tx, ty, tz);
    if(Distance > range)
    {
        SendClientMessage(playerid, -1, "near tree");
    }
    else return SendClientMessage(playerid, -1, "not near tree");
    return 1;
}

CMD:test(playerid, params[])
{
	TreeToPlayerDistance(playerid);
	return 1;
}
MyUndiesSmell is offline   Reply With Quote