07.01.2017, 14:58
Hi everyone, I'm creating a to destroy tree system and I wanted the player to knock down the tree with the chainsaw, but it did not work...
Code:
And so test it too:
Code:
Код:
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid) { if(GetPlayerWeapon(playerid) == 9) { if(IsPlayerInRangeOfPoint(playerid, 1.5, Trees[damagedid][0], Trees[damagedid][1], Trees[damagedid][2])) { Destroy[damagedid]++; PlayerPlaySound(playerid,1190,0.0,0.0,0.0); if(Destroy[damagedid] == 20) { Destroy[damagedid] = 0; DestroyDynamicObject(TreeObject[damagedid]); Trees[damagedid][0] = -1; Trees[damagedid][1] = -1; Trees[damagedid][2] = -1; } } }
Код:
public OnPlayerGiveDamage(playerid, damagedid, Float:amount, weaponid) { if(GetPlayerWeapon(playerid) == 9) { for(new i = 1; i <= MAX_TREES; i++) if(IsPlayerInRangeOfPoint(playerid, 1.5, Trees[i][0], Trees[i][1], Trees[i][2])) { Destroy[i]++; PlayerPlaySound(playerid,1190,0.0,0.0,0.0); if(Destroy[i] == 20) { Destroy[i] = 0; DestroyDynamicObject(TreeObject[i]); Trees[i][0] = -1; Trees[i][1] = -1; Trees[i][2] = -1; } } } return 1; }