29.08.2014, 16:20
PHP код:
if(PRESSED(KEY_FIRE))
{
for(new i; i < MAX_TREES; i ++)
{
if(IsPlayerInRangeOfPoint(playerid, 2.2, tInfo[i][xPos], tInfo[i][yPos], tInfo[i][zPos]))
{
if(GetPlayerWeapon(playerid) != 9) return SendClientMessage(playerid,COLOR_RED,"You need chainsaw to cut trees");
if(tInfo[i][Health] <= 0) return SendClientMessage(playerid, COLOR_GREY, "This tree has already been cut down!");
new Float:x,Float:y,Float:z;
GetPlayerPos(playerid,x,y,z);
if(GetPVarInt(playerid,"TreeCID") != i)
{
SetPlayerProgressBarValue(playerid,cutting,0);
}
SetPVarInt(playerid,"TreeCID",i);
KillTimer(CutT[playerid]);
new Float:cb = GetPlayerProgressBarValue(playerid,cutting);
ShowPlayerProgressBar(playerid,cutting);
SetPlayerProgressBarValue(playerid,cutting,cb+5);
UpdatePlayerProgressBar(playerid,cutting);
CutT[playerid] = SetTimerEx("CuTi",10000,0,"i",playerid);
if(cb == 100 || tInfo[i][Health] <= 0)
{
ResetTree(i);
SetPVarInt(playerid,"TreeCID",-1);
SetPlayerProgressBarValue(playerid,cutting,0);
HidePlayerProgressBar(playerid,cutting);
CreateItem(ModelWood,1,x,y,z-1,0,0,0,0,0);
}
break;
}
}