Добро пожаловать на Pro Pawn - Портал о PAWN-скриптинге.

Реклама


**Как получить V.I.P** (Перейти)
Чтобы заказать рекламу на Pro-Pawn.Ru, обращайтесь в Skype.
Баннерная реклама 200руб/мес, Текстовая 100руб/мес.
Показано с 1 по 6 из 6
  1. #1
    Аватар для Maranzalla
    Заблокирован

    Статус
    Оффлайн
    Регистрация
    25.04.2014
    Адрес
    Moscow
    Сообщений
    108
    Репутация:
    -1 ±

    Быдлокод или так и должно быть?

    Столкнулся вот с таким кодом-тут как бы создание динамических обьектов- хотел сделать их глобальными для всех но порылся немного и понял что обьекты можно создавать для каждого игрока отдельно - вопрос такой - стоит ли так делать или нет?
    PHP код:
        for(new playeridplayerid MAX_PLAYERSplayerid ++ )
        {
            
    CreateDynamicObject(14867,1474.3525391,-1370.1582031,119.4369965,0.0000000,0.0000000,0.0000000,playerid); //object(bobbie-cupboards) (1)
            
    CreateDynamicObject(14867,1474.3554688,-1369.2958984,119.4369965,0.0000000,0.0000000,0.0000000,playerid); //object(bobbie-cupboards) (2)
            
    CreateDynamicObject(14867,1474.3535156,-1368.4316406,119.4369965,0.0000000,0.0000000,0.0000000,playerid); //object(bobbie-cupboards) (4)
            
    CreateDynamicObject(14867,1474.3564453,-1367.5654297,119.4369965,0.0000000,0.0000000,0.0000000,playerid); //object(bobbie-cupboards) (5)
            
    CreateDynamicObject(14867,1474.3574219,-1366.7080078,119.4369965,0.0000000,0.0000000,0.0000000,playerid); //object(bobbie-cupboards) (devil)
            
    CreateDynamicObject(14867,1482.2607422,-1370.1650391,119.4369965,0.0000000,0.0000000,0.0000000,playerid); //object(bobbie-cupboards) (14)
            
    CreateDynamicObject(14867,1482.2568359,-1369.2988281,119.4369965,0.0000000,0.0000000,0.0000000,playerid); //object(bobbie-cupboards) (15)
            
    CreateDynamicObject(14867,1482.2529297,-1368.4306641,119.4369965,0.0000000,0.0000000,0.0000000,playerid); //object(bobbie-cupboards) (15)
            
    CreateDynamicObject(14867,1482.2559814,-1367.5620117,119.4369965,0.0000000,0.0000000,0.0000000,playerid); //object(bobbie-cupboards) (15)
            
    CreateDynamicObject(14867,1482.2530518,-1366.6929932,119.4369965,0.0000000,0.0000000,0.0000000,playerid); //object(bobbie-cupboards) (15)
            
    CreateDynamicObject(2432,1478.3299561,-1370.2220459,119.8889999,0.0000000,0.0000000,0.0000000,playerid); //object(cj_ff_list3) (4)
            
    CreateDynamicObject(2432,1478.2039795,-1370.2209473,121.2839966,0.0000000,270.2087402,0.0000000,playerid); //object(cj_ff_list3) (devil)
            
    CreateDynamicObject(18758,1480.0240479,-1372.6529541,122.8759995,0.0000000,0.0000000,270.0878906,playerid); //object(vcelevatorfront1) (devil)
            
    CreateDynamicObject(2432,1479.6191406,-1370.2216797,119.8889999,0.0000000,0.0000000,0.0000000,playerid); //object(cj_ff_list3) (15)
            
    CreateDynamicObject(2432,1482.8399658,-1370.2220459,121.2839966,0.0000000,270.2087402,0.0000000,playerid); //object(cj_ff_list3) (16)
            
    CreateDynamicObject(2432,1482.8480225,-1370.2230225,124.1709976,0.0000000,270.2087402,0.0000000,playerid); //object(cj_ff_list3) (18)
            
    CreateDynamicObject(2432,1478.2139893,-1370.2209473,124.1770020,0.0000000,270.2087402,0.0000000,playerid); //object(cj_ff_list3) (19)
            
    CreateDynamicObject(2432,1473.6319580,-1370.2299805,119.8889999,0.0000000,0.0000000,0.0000000,playerid); //object(cj_ff_list3) (23)
            
    CreateDynamicObject(2432,1470.7380371,-1370.2309570,119.8889999,0.0000000,0.0000000,0.0000000,playerid); //object(cj_ff_list3) (24)
            
    CreateDynamicObject(2432,1472.2792969,-1370.2265625,121.2839966,0.0000000,270.2087402,0.0000000,playerid); //object(cj_ff_list3) (26)
            
    CreateDynamicObject(2432,1476.9830322,-1370.2299805,121.2839966,0.0000000,270.2087402,0.0000000,playerid); //object(cj_ff_list3) (29)
            
    CreateDynamicObject(2432,1476.9930420,-1370.2290039,124.1520004,0.0000000,270.2087402,0.0000000,playerid); //object(cj_ff_list3) (30)
            
    CreateDynamicObject(18758,1485.9785156,-1362.6943359,122.8759995,0.0000000,0.0000000,359.9780273,playerid); //object(vcelevatorfront1) (10)
            
    CreateDynamicObject(2432,1478.1689453,-1370.1739502,119.5500031,0.0000000,269.9656982,0.0000000,playerid); //object(cj_ff_list3) (36)
            
    CreateDynamicObject(2432,1477.1130371,-1370.1750488,119.5500031,0.0000000,269.9615479,0.0000000,playerid); //object(cj_ff_list3) (37)
            
    CreateDynamicObject(2432,1477.0279541,-1370.1739502,119.5500031,0.0000000,269.9615479,0.0000000,playerid); //object(cj_ff_list3) (38)
            
    CreateDynamicObject(2432,1482.9169922,-1370.1629639,119.5500031,0.0000000,269.9615479,0.0000000,playerid); //object(cj_ff_list3) (39)
            
    CreateDynamicObject(2432,1483.9716797,-1370.1601562,119.5500031,0.0000000,269.9615479,0.0000000,playerid); //object(cj_ff_list3) (40)
            
    CreateDynamicObject(2432,1483.4882812,-1369.4912109,119.5500031,0.0000000,269.9615479,90.0714111,playerid); //object(cj_ff_list3) (41)
            
    CreateDynamicObject(2432,1483.4863281,-1368.3925781,119.5500031,0.0000000,269.9615479,90.0714111,playerid); //object(cj_ff_list3) (42)
            
    CreateDynamicObject(2432,1483.4849854,-1367.2900391,119.5500031,0.0000000,269.9615479,90.0714111,playerid); //object(cj_ff_list3) (43)
            
    CreateDynamicObject(2432,1483.4859619,-1365.0860596,119.5500031,0.0000000,269.9615479,90.0714111,playerid); //object(cj_ff_list3) (51)
            
    CreateDynamicObject(2432,1483.4849854,-1364.0150146,119.5500031,0.0000000,269.9615479,90.0714111,playerid); //object(cj_ff_list3) (52)
            
    CreateDynamicObject(18001,1472.5340576,-1370.6490479,123.5029984,0.0000000,269.9656982,180.0461426,playerid); //object(int_barbera07) (1)
            
    CreateDynamicObject(18001,1473.9589844,-1370.6479492,123.5029984,0.0000000,269.9615479,180.0439453,playerid); //object(int_barbera07) (2)
            
    CreateDynamicObject(18001,1475.3800049,-1370.6440430,123.5029984,0.0000000,269.9615479,180.0439453,playerid); //object(int_barbera07) (3)
            
    CreateDynamicObject(18001,1478.5639648,-1370.6490479,123.5029984,0.0000000,269.9615479,180.0439453,playerid); //object(int_barbera07) (4)
            
    CreateDynamicObject(18001,1479.9890137,-1370.6479492,123.5029984,0.0000000,269.9615479,180.0439453,playerid); //object(int_barbera07) (5)
            
    CreateDynamicObject(18001,1481.4150391,-1370.6459961,123.5029984,0.0000000,269.9615479,180.0439453,playerid); //object(int_barbera07) (devil)
            
    CreateDynamicObject(2432,1479.6180420,-1370.2259521,123.8929977,0.0000000,0.0000000,0.0000000,playerid); //object(cj_ff_list3) (15)
            
    CreateDynamicObject(2432,1476.7070312,-1370.2280273,123.8949966,0.0000000,0.0000000,0.0000000,playerid); //object(cj_ff_list3) (15)
            
    CreateDynamicObject(948,1477.7939453,-1369.9909668,120.9810028,0.0000000,0.0000000,0.0000000,playerid); //object(plant_pot_10) (1)
            
    CreateDynamicObject(14455,1483.7060547,-1368.7919922,122.5009995,0.0000000,0.0000000,90.0447388,playerid); //object(gs_bookcase) (1)
            
    CreateDynamicObject(2432,1484.6700439,-1363.3750000,121.6579971,0.0000000,270.2087402,0.0000000,playerid); //object(cj_ff_list3) (16)
            
    CreateDynamicObject(18001,1483.5729980,-1364.4890137,120.4029999,0.0000000,269.9656982,270.6488037,playerid); //object(int_barbera07) (music)
            
    CreateDynamicObject(18001,1483.5799561,-1366.0140381,120.4029999,0.0000000,269.9615479,270.6481934,playerid); //object(int_barbera07) (9)
            
    CreateDynamicObject(18001,1483.5949707,-1367.4239502,120.4029999,0.0000000,269.9615479,270.6481934,playerid); //object(int_barbera07) (10)
            
    CreateDynamicObject(18001,1483.5880127,-1368.7860107,120.4029999,0.0000000,269.9615479,270.6481934,playerid); //object(int_barbera07) (11)
            
    CreateDynamicObject(2885,1484.0019531,-1365.1738281,126.0360031,270.0329590,179.9615479,89.9395752,playerid); //object(xref_garagedoor) (1)
            
    CreateDynamicObject(2885,1477.3110352,-1365.1590576,126.0410004,270.0329590,179.9615479,89.9450684,playerid); //object(xref_garagedoor) (2)
            
    CreateDynamicObject(2885,1477.2249756,-1365.1629639,126.0449982,270.0329590,179.9615479,89.9450684,playerid); //object(xref_garagedoor) (2)
            
    CreateDynamicObject(2262,1471.0250244,-1365.9499512,122.6630020,0.0000000,0.0000000,89.3713989,playerid); //object(frame_slim_3) (1)
            
    CreateDynamicObject(18758,1485.9890137,-1366.5999756,122.8759995,0.0000000,0.0000000,359.9780273,playerid); //object(vcelevatorfront1) (9)
            
    CreateDynamicObject(2432,1481.6533203,-1370.1591797,124.1360016,0.0000000,0.0000000,0.0000000,playerid); //object(cj_ff_list3) (15)
            
    CreateDynamicObject(2432,1478.7349854,-1370.1569824,124.1360016,0.0000000,0.0000000,0.0000000,playerid); //object(cj_ff_list3) (15)
            
    CreateDynamicObject(2432,1475.8110352,-1370.1550293,124.1360016,0.0000000,0.0000000,0.0000000,playerid); //object(cj_ff_list3) (15)
            
    CreateDynamicObject(1729,1482.2659912,-1369.8950195,120.9810028,0.0000000,0.0000000,220.0000000,playerid); //object(mrk_seating3b) (1)
            
    CreateDynamicObject(14751,1471.5820312,-1362.1920166,118.7330017,0.0000000,0.0000000,181.0000000,playerid); //object(sfhsm2bits) (1)
        


  2. #2
    Аватар для Londlem
    Модератор

    Статус
    Оффлайн
    Регистрация
    19.10.2013
    Сообщений
    1,360
    Репутация:
    767 ±
    Если уберёте цикл и вместо playerid поставите значение -1, то объект создадутся для всех игроков.

  3. #3
    Аватар для Maranzalla
    Заблокирован

    Статус
    Оффлайн
    Регистрация
    25.04.2014
    Адрес
    Moscow
    Сообщений
    108
    Репутация:
    -1 ±
    Да это я понял - но как лучше использовать?от какой меньше нагрузки?

  4. #4
    Аватар для Londlem
    Модератор

    Статус
    Оффлайн
    Регистрация
    19.10.2013
    Сообщений
    1,360
    Репутация:
    767 ±
    А если самим подумать? В первом случае у Вас цикл для игроков, а во втором его нет, объекты создаются один раз.

  5. #5
    Аватар для Maranzalla
    Заблокирован

    Статус
    Оффлайн
    Регистрация
    25.04.2014
    Адрес
    Moscow
    Сообщений
    108
    Репутация:
    -1 ±
    В этом вся суть и так и так создаются один раз -несмотря на цикл-я к чему и клоню стоит ли из цикла вытаскивать и делать глобальным для всех или же лучше создавать для каждого игрока персонально?

  6. #6
    Аватар для Londlem
    Модератор

    Статус
    Оффлайн
    Регистрация
    19.10.2013
    Сообщений
    1,360
    Репутация:
    767 ±
    Сразу для всех, без цикла.

  7. Пользователь сказал cпасибо:
    Maranzalla (28.02.2015)
 

 

Информация о теме

Пользователи, просматривающие эту тему

Эту тему просматривают: 1 (пользователей: 0 , гостей: 1)

Ваши права

  • Вы не можете создавать новые темы
  • Вы не можете отвечать в темах
  • Вы не можете прикреплять вложения
  • Вы не можете редактировать свои сообщения
  •