sergeyshibaev
Умник
Как сделать чтобы если ты отходил от бумбокса далеко он пропадал как на аризоне или ты заспавнился/умер и т.д чтоб пропадал
PHP:
CMD:boom(playerid,listitem, params[])
{
if(PI[playerid][pBumbox] <= 0) return SendClientMessage(playerid, COLOR_LIGHTRED, "[Ошибка]{FFFFFF} У вас нет бумбокса, купите у Продавца аксессуаров!");
if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid,COLOR_LIGHTRED,"[Ошибка] {FFFFFF}Вы не можете поставить бумбокс в автомобиле!");
if(bumboxx[playerid])
{
if(!IsPlayerInRangeOfPoint(playerid, 3.0, BumBoxPos[playerid][0], BumBoxPos[playerid][1], BumBoxPos[playerid][2])) return SendClientMessage(playerid, COLOR_LIGHTRED, "[Ошибка] {ffffff}Вы слишком далеко от бумбокса!");
DestroyDynamicObject(bumboxx[playerid]);
bumboxx[playerid] = 0;
RadioID[playerid] = 0;
for(new i; i<MAX_PLAYERS; i++)
{
if(IsPlayerInRangeOfPoint(playerid,30.0, BumBoxPos[playerid][0], BumBoxPos[playerid][1], BumBoxPos[playerid][2])) StopAudioStreamForPlayerFix(i);
}
ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 1, 0, 0, 0, 1);
GiveItem(playerid,2226);
DestroyDynamic3DTextLabel(b_box3D[playerid]);
return SendClientMessage(playerid, COLOR_LIGHTRED, "[Подсказка] {ffffff}Вы забрали свой бумбокс!");
}
else
{
for(new k; k<MAX_PLAYERS; k++)
{
if(bumboxx[k] == 0) continue;
if(IsPlayerInRangeOfPoint(playerid,30.0, BumBoxPos[k][0], BumBoxPos[k][1], BumBoxPos[k][2]))
{
return SendClientMessage(playerid, COLOR_LIGHTRED, "[Ошибка] {ffffff}Кто-то по близости уже поставил бумбокс!");
}
}
GetPlayerPos(playerid, BumBoxPos[playerid][0], BumBoxPos[playerid][1], BumBoxPos[playerid][2]);
ApplyAnimation(playerid, "BOMBER", "BOM_Plant", 4.0, 0, 1, 0, 0, 0, 1);
SendClientMessage(playerid, COLOR_LIGHTRED, "[Подсказка] {ffffff}Нажмите ALT{FFFFFF}, чтобы включить бумбокс!");
SendClientMessage(playerid, COLOR_LIGHTRED, "[Подсказка] {ffffff}Введите: /boom чтобы забрать бумбокс!");
SetPlayerChatBubble(playerid, "Положил бумбокс на землю", COLOR_PURPLE, 10.0, 5000);
BumBoxPos[playerid][0] +=1.0;
BumBoxPos[playerid][1] +=1.0;
BumBoxPos[playerid][2] -=1.0;
bumboxx[playerid] = CreateDynamicObject(2226, BumBoxPos[playerid][0], BumBoxPos[playerid][1], BumBoxPos[playerid][2], 0.0, 0.0, 0.0);
new string[20+MAX_PLAYER_NAME],
named[MAX_PLAYER_NAME];
GetPlayerName(playerid, named, sizeof(named));
format(string,sizeof(string), "Поставил: {FFFFFF}%s",named);
b_box3D[playerid] = CreateDynamic3DTextLabel(string,COLOR_GREEN,BumBoxPos[playerid][0], BumBoxPos[playerid][1], BumBoxPos[playerid][2],8.0,INVALID_PLAYER_ID,INVALID_PLAYER_ID,0,-1,-1,-1,5.0);
RemovePlayerAttachedObject(playerid, 5);
}
return 1;
}
