Jump to content

iron015

Members
  • Posts

    32
  • Joined

  • Last visited

Everything posted by iron015

  1. Добрый вечер. Скачал дрифт счетчик, но не сохраняются рекорды. В чем проблема? local xmlFile = xmlLoadFile("recordDrift.xml") if xmlFile then local temp = xmlFindChild(xmlFile, "score", 0) if not temp then temp = xmlCreateChild(xmlFile, "score") end xmlNodeSetValue(temp, tostring(drift_mejor)) temp = xmlFindChild(xmlFile, "name", 0) if not temp then temp = xmlCreateChild(xmlFile, "name") end xmlNodeSetValue(temp, drift_nombre) xmlSaveFile(xmlFile) xmlUnloadFile(xmlFile) end
  2. Спасибо за помощь, все работает
  3. Код я не нашел, просто есть опыт в pawno, вот и попробовал написать тут.
  4. Не работает. При нажатии кнопки показывает, что включен/выключен, но пассажиры могут сидеть. antipas = {} function switchAntiPas(thePlayer) local veh = getPedOccupiedVehicle ( thePlayer ) local controller = getVehicleController ( veh ) if veh and (thePlayer == controller) then if not antipas[veh] then antipas[veh] = true outputChatBox("#FFFF00Анти-Пассажир #00FF00Включен#FFFF00!",thePlayer,255,255,255,true) else antipas[veh] = false outputChatBox("#FFFF00Анти-Пассажир #00FF00Выключен#FFFF00!",thePlayer,255,255,255,true) end end end function testPas ( ) local Vehicle = getPedOccupiedVehicle ( v ) local controller = getVehicleController ( Vehicle ) if Vehicle and antipas[Vehicle] and (v ~= controller) then removePedFromVehicle ( v ) outputChatBox("#FF0000Этот игрок запрещает садится каким-либо пассажирам в свою машину!", v,255,255,255,true) end end function ResourceStart ( name, root ) for k,v in ipairs ( getElementsByType ( "player" ) ) do bindKey( v, "u", "down", switchAntiPas ) setTimer ( testPas, 1000, 1) end end addEventHandler ( "onResourceStart", getResourceRootElement(), ResourceStart ) Извините, что так много вопросов, я совсем не знаю lua
  5. ну чтобы при запуске ресурса биндилась кнопка. а то если сидя в машине создать новую, кнопка биндится повторно, и при нажатии в чате выходит 2 сообщения. я просто не знаю lua
  6. Спасибо, все работает. А как вместо onVehicleEnter сделать onResourceStart, а вместо onVehicleExit - onResourceStop?
  7. Добрый вечер! Хотел сделать скрипт, чтобы при нажатии на кнопку включалась/выключалась защита, не дающая пассажирам сидеть в вашей машине. Но скрипт не работает, помогите, пожалуйста. antipas = {} function switchAntiPas(thePlayer) local veh = getPedOccupiedVehicle (thePlayer) if veh then if not antipas[veh] then antipas[veh] = true outputChatBox("#FFFF00Анти-Пассажир #00FF00Включен#FFFF00!",thePlayer,255,255,255,true) else antipas[veh] = false outputChatBox("#FFFF00Анти-Пассажир #00FF00Выключен#FFFF00!",thePlayer,255,255,255,true) end end end function testPas ( thePlayer ) local Vehicle = getPedOccupiedVehicle ( thePlayer ) local controller = getVehicleController ( Vehicle ) if Vehicle and controller then for id, player in ipairs(getElementsByType("player")) do local Vehicle2 = getPedOccupiedVehicle ( player ) local controller2 = getVehicleController ( Vehicle2 ) if Vehicle2 and not controller2 then if Vehicle == Vehicle2 then if antipas[Vehicle] then removePedFromVehicle ( player ) outputChatBox("#FF0000Этот игрок запрещает садится кому-либо пассажиром в свою машину!",player,255,255,255,true) end end end end end end addEventHandler ( "onVehicleEnter", getRootElement(), function(thePlayer) bindKey(thePlayer, "u", "down", switchAntiPas) setTimer ( testPas, 1000, 1, thePlayer ) end) addEventHandler ( "onVehicleExit", getRootElement(), function(thePlayer) unbindKey(thePlayer, "u", "down", switchAntiPas) end)
×
×
  • Create New...