17.02.2015, 22:20
as the title say it doesnt work, even when you are in range of an tree.
pawn Код:
stock CreateTree(model ,Float:X, Float:Y, Float:Z, Float:rottX, Float:rottY, Float:rottZ)
{
trees[treed] = CreateDynamicObject(model, X, Y, Z, rottX, rottY, rottZ);
tInfo[treed][Status] = TREE_STATUS_SPAWN;
tInfo[treed][pXX] = X;
tInfo[treed][pYY] = Y;
tInfo[treed][pZZ] = Z;
tInfo[treed][rotXX] = rottX;
tInfo[treed][rotYY] = rottY;
tInfo[treed][rotZZ] = rottZ;
treed++;
return 1;
}
stock TreeUp(treeid, Float:X, Float:Y, Float:Z, Float:rottX, Float:rottY, Float:rottZ)
{
tInfo[treeid][pXX] = X;
tInfo[treeid][pYY] = Y;
tInfo[treeid][pZZ] = Z;
tInfo[treeid][rotXX] = rottX;
tInfo[treeid][rotYY] = rottY;
tInfo[treeid][rotZZ] = rottZ;
SetDynamicObjectPos(trees[treeid], X, Y, Z);
SetDynamicObjectRot(trees[treeid], rottX, rottY, rottZ);
tInfo[treeid][Status] = TREE_STATUS_SPAWN;
return 1;
}
stock TreeDown(treeid, Float:X, Float:Y, Float:Z, Float:rottX, Float:rottY, Float:rottZ)
{
tInfo[treeid][pXX] = X;
tInfo[treeid][pYY] = Y;
tInfo[treeid][pZZ] = Z;
tInfo[treeid][rotXX] = rottX;
tInfo[treeid][rotYY] = rottY;
tInfo[treeid][rotZZ] = rottZ;
SetDynamicObjectPos(trees[treeid], X, Y, Z);
SetDynamicObjectRot(trees[treeid], rottX, rottY, rottZ);
tInfo[treeid][Status] = TREE_STATUS_DEAD;
return 1;
}
CMD:cuttree(playerid, params[])
{
if(GetFactionType(playerid) != FACTION_POLICE)
{
for(new i = 0; i < MAX_TREES; i++)
{
if(IsPlayerInRangeOfPoint(playerid, 3.0, tInfo[trees[i]][pXX], tInfo[trees[i]][pYY], tInfo[trees[i]][pZZ]))
{
if(tInfo[i][Status] == TREE_STATUS_DEAD)
{
if(GetPlayerWeapon(playerid) == 9)
{
treejob[playerid] = TREE_FAC_STATUS_HOLD;
TogglePlayerControllable(playerid, 0);
SetTimerEx("UnfreeTimer", 3000, false, "i", playerid);
Treereset(i);
SendClientMessage(playerid, COLOR_RED, "You have to lift the tree now");
break;
}
}
else return SendClientMessage(playerid, COLOR_RED, "Tree can't be destroyed");
}
else return SendClientMessage(playerid, COLOR_RED, "You are not near a tree.");
}
}
else return SendClientMessage(playerid, COLOR_RED, "You can't use this feature");
return 1;
}