Jump to content

Помогите убрать ошибки в моем моде


kino

Recommended Posts

написал мод за 2 месяца не разу не проверял писал вслепую запускаю так даже форма логина непоказываеться а при ручном логине вообще не то что вообщем все зря но спасти

serverlog

 [2011-10-25 20:22:21] Stopping mode0
[2011-10-25 20:22:21] WARNING: [gamemodes]/mode0/loadp.lua:110: Bad argument @ 'xmlNodeFindChild'
[2011-10-25 20:22:21] WARNING: [gamemodes]/mode0/loadp.lua:125: Bad argument @ 'xmlSaveFile'
[2011-10-25 20:22:21] WARNING: [gamemodes]/mode0/loadp.lua:43: Bad argument @ 'xmlNodeFindChild'
[2011-10-25 20:22:21] INFO: Factions saved!
[2011-10-25 20:22:21] Starting mode0
[2011-10-25 20:22:21] WARNING: [gamemodes]/mode0/loadp.lua:9: Bad argument @ 'xmlNodeFindChild'
[2011-10-25 20:22:21] INFO: Factions loaded!
[2011-10-25 20:22:21] WARNING: [gamemodes]/mode0/loadp.lua:75: Bad argument @ 'xmlNodeFindChild'
[2011-10-25 20:22:21] INFO: gzload
[2011-10-25 20:22:21] Gamemode 'crm-rdm' started.
[2011-10-25 20:22:21] mode0 restarted successfully
[2011-10-25 20:23:27] QUIT: kinogfj left the game [Quit]
[2011-10-25 20:23:53] CONNECT: kinogfj connected (IP: 192.168.137.212  Serial: FD1E74264CB8CB1DDF76FC5675FA56B2  Version: 1.1.1-9.03293.0)
[2011-10-25 20:23:53] JOIN: kinogfj joined the game (IP: 192.168.137.212)
[2011-10-25 20:24:04] ERROR: [gamemodes]/mode0/loadp.lua:229: attempt to perform arithmetic on local 'r' (a nil value)

clilog:

 [2011-10-25 18:56:03] INFO: votemanager precreateGuiElements
[2011-10-25 19:52:10] INFO: votemanager precreateGuiElements
[2011-10-25 20:11:37] INFO: votemanager precreateGuiElements
[2011-10-25 20:19:25] INFO: votemanager precreateGuiElements

server:

  
factions={}
gz={}
gzd={}
--gzc={}
team={}
function loadFactions ()
  local root = xmlLoadFile ("factions.xml")
  local factionroot = xmlFindChild (root,"factiones",0)
  if (factionroot) then
      for i,v in ipairs (xmlNodeGetChildren(factionroot)) do
      local name = xmlNodeGetAttribute (v,"name")
      local leader = tonumber(xmlNodeGetAttribute (v,"leader"))
      local fnum = tonumber(xmlNodeGetAttribute (v,"num"))
      local spawnx = tonumber(xmlNodeGetAttribute (v,"x"))
      local spawny = tonumber(xmlNodeGetAttribute (v,"y"))
      local spawnz = tonumber(xmlNodeGetAttribute (v,"z"))
      local rang1 = tonumber(xmlNodeGetAttribute (v,"rang1"))
      local rang2 = tonumber(xmlNodeGetAttribute (v,"rang2"))
      local rang3 = tonumber(xmlNodeGetAttribute (v,"rang3"))
      local rang4 = tonumber(xmlNodeGetAttribute (v,"rang4"))
      local rang5 = tonumber(xmlNodeGetAttribute (v,"rang5"))
      local skin1 = tonumber(xmlNodeGetAttribute (v,"skin1"))
      local skin2 = tonumber(xmlNodeGetAttribute (v,"skin2"))
      local skin3 = tonumber(xmlNodeGetAttribute (v,"skin3"))
      local skin4 = tonumber(xmlNodeGetAttribute (v,"skin4"))
      local skin5 = tonumber(xmlNodeGetAttribute (v,"skin5"))
      local ftype = tonumber(xmlNodeGetAttribute (v,"type"))
      local fmoney = tonumber(xmlNodeGetAttribute (v,"money"))
    local r = tonumber(xmlNodeGetAttribute (v,"r"))
      local g = tonumber(xmlNodeGetAttribute (v,"g"))
      local b = tonumber(xmlNodeGetAttribute (v,"b"))
     
      factions[i]={name,leader,fnum,spawnx,spawny,spawnz,rang1,rang2,rang3,rang4,rang5,skin1,skin2,skin3,skin4,skin5,ftype,fmoney,r,g,b}
    team[i]=createTeam(name,r,g,b)
      end
  end
  outputDebugString ("Factions loaded!")
end
 
function saveFactions ()
  local root = xmlLoadFile ("factions.xml")
  local factionroot = xmlFindChild (root,"factiones",0)
  if (factionroot) then
      for i,v in ipairs (xmlNodeGetChildren(factionroot)) do
          xmlNodeSetAttribute ( v, "name", factions[i][1] )
          xmlNodeSetAttribute ( v, "leader", factions[i][2] )
          xmlNodeSetAttribute ( v, "num", factions[i][3] )
          xmlNodeSetAttribute ( v, "x", factions[i][4] )
          xmlNodeSetAttribute ( v, "y", factions[i][5] )
          xmlNodeSetAttribute ( v, "z", factions[i][6] )
          xmlNodeSetAttribute ( v, "rang1", factions[i][7] )
          xmlNodeSetAttribute ( v, "rang2", factions[i][8] )
          xmlNodeSetAttribute ( v, "rang3", factions[i][9] )
          xmlNodeSetAttribute ( v, "rang4", factions[i][10] )
          xmlNodeSetAttribute ( v, "rang5", factions[i][11] )
          xmlNodeSetAttribute ( v, "skin1", factions[i][12] )
          xmlNodeSetAttribute ( v, "skin2", factions[i][13] )
          xmlNodeSetAttribute ( v, "skin3", factions[i][14] )
          xmlNodeSetAttribute ( v, "skin4", factions[i][15] )
          xmlNodeSetAttribute ( v, "skin5", factions[i][16] )
          xmlNodeSetAttribute ( v, "type", factions[i][17] )
          xmlNodeSetAttribute ( v, "money", factions[i][18] )
  xmlNodeSetAttribute ( v, "r", factions[i][19] )   
    xmlNodeSetAttribute ( v, "g", factions[i][20] )
    xmlNodeSetAttribute ( v, "b", factions[i][21] )
      end
        xmlSaveFile(root)
    end
    outputDebugString ("Factions saved!")
end
 
function loadgz ()
  local root = xmlLoadFile ("gz.xml")
  local factionroot = xmlFindChild (root,"gz",0)
  if (factionroot) then
      for i,v in ipairs (xmlNodeGetChildren(factionroot)) do
--       local name = xmlNodeGetAttribute (v,"name")
      local x = tonumber(xmlNodeGetAttribute (v,"x"))
      local y = tonumber(xmlNodeGetAttribute (v,"y"))
      local sizex = tonumber(xmlNodeGetAttribute (v,"sizex"))
      local sizey = tonumber(xmlNodeGetAttribute (v,"sizey"))
      local r = tonumber(xmlNodeGetAttribute (v,"r"))
      local g = tonumber(xmlNodeGetAttribute (v,"g"))
      local b = tonumber(xmlNodeGetAttribute (v,"b"))
      local a = tonumber(xmlNodeGetAttribute (v,"a"))
      local f = tonumber(xmlNodeGetAttribute (v,"f"))
--[[      local rang1 = tonumber(xmlNodeGetAttribute (v,"rang1"))
      local rang2 = tonumber(xmlNodeGetAttribute (v,"rang2"))
      local rang3 = tonumber(xmlNodeGetAttribute (v,"rang3"))
      local rang4 = tonumber(xmlNodeGetAttribute (v,"rang4"))
      local rang5 = tonumber(xmlNodeGetAttribute (v,"rang5"))
      local skin1 = tonumber(xmlNodeGetAttribute (v,"skin1"))
      local skin2 = tonumber(xmlNodeGetAttribute (v,"skin2"))
      local skin3 = tonumber(xmlNodeGetAttribute (v,"skin3"))
      local skin4 = tonumber(xmlNodeGetAttribute (v,"skin4"))
      local skin5 = tonumber(xmlNodeGetAttribute (v,"skin5"))
      local ftype = tonumber(xmlNodeGetAttribute (v,"type"))
      local fmoney = tonumber(xmlNodeGetAttribute (v,"money"))]]
     gzd[i]={x,y,sizex,sizey,r,g,b,a,f}
    gz[i]=createRadarArea(x,y,sizex,sizey,r,g,b,a)
--    gzc[i]=createColRectangle(x,y,200,200)        
       end
           end
           outputDebugString("gzload")
         end
 
     function savegz ()
  local root = xmlLoadFile ("gz.xml")
  local factionroot = xmlFindChild (root,"gz",0)
  if (factionroot) then
      for i,v in ipairs (xmlNodeGetChildren(factionroot)) do
--       local name = xmlNodeGetAttribute (v,"name")
    xmlNodeSetAttribute ( v, "x",gzd[i][1])
    xmlNodeSetAttribute ( v, "y",gzd[i][2])
    xmlNodeSetAttribute ( v, "sizex",gzd[i][3])
    xmlNodeSetAttribute ( v, "sizey",gzd[i][4])
    xmlNodeSetAttribute ( v, "r",gzd[i][5])
    xmlNodeSetAttribute ( v, "g",gzd[i][6])
xmlNodeSetAttribute ( v, "b",gzd[i][7])
xmlNodeSetAttribute ( v, "a",gzd[i][8])
xmlNodeSetAttribute ( v, "f",gzd[i][9])
      end
  end
  xmlSaveFile(root)
     end
     
     function pkill(amm,killed,re,bp)
      hosted(killed)
       local killer=source;
       local zone
       if getPlayerTeam(killer) ~= getPlayerTeam(killed)  and killer~=killed and killer~=nill  then
    local   killer=getPlayerTeam(killer);
    local   killed=getPlayerTeam(killed);
    local fkilled=getElementData(killed,"fnum")
    local fkiller=getElementData(killer,"fnum")
    setElementData(killed,"dead",getElementData(killed,"dead")+1)
     setElementData(killed,"kill",getElementData(killer,"kill")+1)
     for i=1,#gz do
 
       if isa(killer,gz[i])==isa(killed,gz[i])then
         zone=i;
     end
     end
if fkiller==zone  then
  gzd[zone]["k"]= gzd[zone]["k"]-1
 
elseif fkilled==zone and gzd[zone]["k"]~=0 then 
  gzd[zone]["k"]= gzd[zone]["k"]+1   
       
end
if gzd[zone]["k"]>=2 then
  startowngz(zone,fkiller,fd)
 
       elseif gzd[zone]["k"]>=5 then
       fowngz(zone,fkiller,fkilled)
     end
       end
     
       
   
       
end 
     
--------------------------------------------------------------------
     function isa ( theElement, theArea )
    -- get the x, y coordinates from getElementPosition (z gets silently discarded)
    local posX, posY = getElementPosition( theElement )
    -- call isInsideRadarArea with those coordinates and return its result
    if isInsideRadarArea ( theArea, posX, posY )then
      return theArea
    else
      return false
    end
   
     
end
function startowngz(z,f,fd)
  gzd[z]["s"]=1
    setRadarAreaFlashing ( gz[z], true )
    local ta =getTeamName(team.f)
    local td =getTeamName(team.fd)
    outputChatBox("команда" ..tostring(ta) .. "начала захват зоны" ..tostring(td) "в" .. getElementZoneName(gz[z]) .."!!!", team.f,255,255.255,true)
    outputChatBox("команда" ..tostring(ta) .. "начала захват зоны" ..tostring(td) "в" .. getElementZoneName(gz[z]) .."!!!", team.fd,255,255,255,true)
end
function fowngz(z,f,fd)
  local ta =getTeamName(team.f)
    local td =getTeamName(team.fd)
 
  if   gzd[z]["k"]>=5 then
    outputChatBox("команда" ..tostring(ta) .. "успешно захватила зону" ..tostring(td) "в" .. getElementZoneName(gz[z]) .."!!!", team.f,255,255,255,true)
    outputChatBox("команда" ..tostring(ta)  "успешно захватила зону " ..tostring(td) "в" .. getElementZoneName(gz[z]) .."!!!", team.fd,255,255,255,true)
    r,g,b = getTeamColor(ta)
    gzd[z][5]=r
    gzd[z][6]=g
    gzd[z][7]=b
    gzd[z][9]=f
    setRadarAreaFlashing(gz[z],false)
    setRadarAreaColor(gz[z],r,g,b,0)
      gzd[z]["k"]=0
  else
    setRadarAreaFlashing(gz[z],false)
    --setRadarAreaColor(gz[z],r,g,b,0)
      gzd[z]["k"]=0
   outputChatBox("команда" ..tostring(td) .. "успешно отбила атаку" ..tostring(ta) "в" .. getElementZoneName(gz[z]) .."!!!", team.f,255,255,255,true)
   outputChatBox("команда" ..tostring(td) .. "успешно отбила атаку " ..tostring(ta) "в" .. getElementZoneName(gz[z]) .."!!!", team.fd,255,255,255,true)
  end
end
function hosted(s)
  setTimer( spawnPlayer, 40000, 1, s, 1177.5682373047, -1323.2587890625, 14.077121734619 )
end
function preload()
  loadFactions()
  loadgz()
end
function presave()
  savegz()
  saveFactions()
end
  --resource
addEventHandler ( "onResourceStart", resourceRoot, preload )
addEventHandler ( "onResourceStop", resourceRoot, presave )
-------==========spawn_mod-si.lua================
function spawnf(s,f,r)
  local r2
  if r==0 then
    r2=7
  else
    r2=6+r
  end
 
  spawnPlayer (s, factions[f][4], factions[f][5], factions[f][6], 0, r2, 0, 0, team.f) -- spawns player with random skin
    fadeCamera (s, true)
setCameraTarget (s, s)
setElementData(s,"fnum",f)
setElementData(s,"frank",r)
end
--------------------[[account system]]-------------p
function addac(Login,pass,sax)
  if (not getAccount(Login)) then
--cxml ( login )
addAccount(Login, pass)
else
outputChatBox("#CC0033[СЕРВЕР]: #339933Такой ник уже зарегистрирован, выберите себе другой ник", source, 0, 0, 0,true)
 return 0--[[
if sax==nil or sax==0 then
outputChatBox("#CC0033[СЕРВЕР]: #CC0033 ошибка возможно не выбран пол играка", source, 0, 0, 0,true)
return 0]]
end
--local pol=tonumber(sax)
local playerAccount =
Edited by Guest
Link to comment

У тебя код не оптимизированный очень ..

Ты хочешь обновлять функцию: renderSpawnButton в редере? :shock:

Ты клиент повесишь ...

Используй таймер вместо рендера.

Едит:Код мельком посмотрел.

Link to comment
У тебя код не оптимизированный очень ..

Ты хочешь обновлять функцию: renderSpawnButton в редере? :shock:

Ты клиент повесишь ...

Используй таймер вместо рендера.

Едит:Код мельком посмотрел.

спасибо,поправил просто делал на примере гангвара

вам +

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...