Jump to content

Не очень баговое явление в скрипте.


Recommended Posts

вот сам код скрипта:

local spawnpoint 
  
function PlayerClotnesOff(source) 
    removePedClothes (source, 16 )     -- remove the helmet 
    removePedClothes (source, 15 )     -- remove the helmet 
    removePedClothes (source, 14 )     -- remove the helmet 
    removePedClothes (source, 13 )     -- remove the helmet 
    removePedClothes (source, 12 )     -- remove the helmet 
    removePedClothes (source, 11 )     -- remove the helmet 
    removePedClothes (source, 10 )     -- remove the helmet 
    removePedClothes (source, 9 )     -- remove the helmet 
    removePedClothes (source, 8 )     -- remove the helmet 
    removePedClothes (source, 7 )     -- remove the helmet 
    removePedClothes (source, 6 )     -- remove the helmet 
    removePedClothes (source, 5 )     -- remove the helmet 
    removePedClothes (source, 4 )     -- remove the helmet 
    removePedClothes (source, 3 )     -- remove the helmet 
    removePedClothes (source, 2 )     -- remove the helmet 
    removePedClothes (source, 1 )     -- remove the helmet 
    removePedClothes (source, 0 )     -- remove the helmet 
end 
  
addEventHandler("onResourceStart", resourceRoot, 
    function() 
            resetMapInfo() 
            spawn(player) 
        end 
  
) 
  
function spawn(player) 
    fadeCamera(player, true) 
    setCameraTarget(player, player) 
    showChat(player, true) 
  
     
    setElementPosition(player, 2316.1623, 49.6955, 26.482)  --put v bomjatnik 
    setElementModel(player, 0) 
    setElementFrozen(player, false) 
    addPedClothes ( player, "moto", "moto", 16 ) 
    PlayerClotnesOff(player) 
     
    createBlipAttachedTo ( player, 52 ) 
    createBlip (100.0, -500.0, 17.0, 0, 4, 255, 125, 0, 255, 0, 1000.0, getRootElement()) 
     
end 
  
function getRandomSpawnPoint () 
  
end 
  
addEventHandler("onPlayerJoin", root, 
    function() 
        spawn(source) 
    end 
) 
  
addEventHandler("onPlayerWasted", root, 
    function() 
        setTimer(spawn, 1800, 1, source) 
    end 
) 

а вот конфиг

<meta> 
    <info author="Sektor (c) Ivanov Vitaly" description="Testing mod..." version="1" type="gamemode" /> 
    <include resource="spawnmanager" /> 
    <include resource="freeroam" /> 
     
    <map src="broph.map" type="client"/> 
    <script src="broph.lua"/> 
</meta> 

вот когда я спавнюсь все казалось бы норм, как какой-то игрок ко мне подсоединяется на сервер, так он меня видет лежавшим, и я его вижу лежавшим:

screenshot053ri.jpg

Uploaded with ImageShack.us

и еще идет баг с загрузкой файла (не у меня а у другого клиент) т.е написано 600 кб до завершения скачки, а у него все равно свыше 600 кб идет, притом бесконечно!!!А вот жалобы лога:

=========================================================== 
= Multi Theft Auto: San Andreas v1.1.1 
=========================================================== 
= Server name      : SEKTOR SERVER TEST 
= Server IP address:  
= Server port      : 22003 
=  
= Log file         : .. 1.1/Server/mods/deathmatch/logs/server.log 
= Maximum players  : 1024 
= HTTP port        : 22005 
= Voice Chat       : Disabled 
=========================================================== 
[2011-11-07 19:41:03] Resources: 186 loaded, 0 failed 
[2011-11-07 19:41:03] Querying game-monitor.com master server... unavailable! 
[2011-11-07 19:41:03] Querying backup master server... success! 
[2011-11-07 19:41:04] Starting resources................. 
[2011-11-07 19:41:06] WARNING: test\broph.lua:33: Bad argument @ 'fadeCamera' 
[2011-11-07 19:41:06] WARNING: test\broph.lua:34: Bad argument @ 'setCameraTarget' 
[2011-11-07 19:41:06] WARNING: test\broph.lua:35: Bad argument @ 'showChat' 
[2011-11-07 19:41:06] WARNING: test\broph.lua:38: Bad argument @ 'setElementPosition' 
[2011-11-07 19:41:06] WARNING: test\broph.lua:39: Bad argument @ 'setElementModel' 
[2011-11-07 19:41:06] WARNING: test\broph.lua:40: Bad argument @ 'setElementFrozen' 
[2011-11-07 19:41:06] WARNING: test\broph.lua:41: Bad argument @ 'addPedClothes' 
[2011-11-07 19:41:06] WARNING: test\broph.lua:5: Bad argument @ 'removePedClothes' 
[2011-11-07 19:41:06] WARNING: test\broph.lua:6: Bad argument @ 'removePedClothes' 
[2011-11-07 19:41:06] WARNING: test\broph.lua:7: Bad argument @ 'removePedClothes' 
[2011-11-07 19:41:06] WARNING: test\broph.lua:8: Bad argument @ 'removePedClothes' 
[2011-11-07 19:41:06] WARNING: test\broph.lua:9: Bad argument @ 'removePedClothes' 
[2011-11-07 19:41:06] WARNING: test\broph.lua:10: Bad argument @ 'removePedClothes' 
[2011-11-07 19:41:06] WARNING: test\broph.lua:11: Bad argument @ 'removePedClothes' 
[2011-11-07 19:41:06] WARNING: test\broph.lua:12: Bad argument @ 'removePedClothes' 
[2011-11-07 19:41:06] WARNING: test\broph.lua:13: Bad argument @ 'removePedClothes' 
[2011-11-07 19:41:06] WARNING: test\broph.lua:14: Bad argument @ 'removePedClothes' 
[2011-11-07 19:41:06] WARNING: test\broph.lua:15: Bad argument @ 'removePedClothes' 
[2011-11-07 19:41:06] WARNING: test\broph.lua:16: Bad argument @ 'removePedClothes' 
[2011-11-07 19:41:06] WARNING: test\broph.lua:17: Bad argument @ 'removePedClothes' 
[2011-11-07 19:41:06] WARNING: test\broph.lua:18: Bad argument @ 'removePedClothes' 
[2011-11-07 19:41:06] WARNING: test\broph.lua:19: Bad argument @ 'removePedClothes' 
[2011-11-07 19:41:06] WARNING: test\broph.lua:20: Bad argument @ 'removePedClothes' 
[2011-11-07 19:41:06] WARNING: test\broph.lua:21: Bad argument @ 'removePedClothes' 
[2011-11-07 19:41:06] WARNING: test\broph.lua:44: Bad argument @ 'createBlipAttachedTo' 
[2011-11-07 19:41:06] Server started and is ready to accept connections! 
[2011-11-07 19:41:06] Type 'help' for a list of commands. 
[2011-11-07 19:41:21] CONNECT: Sektor connected (IP: 93.79.66.188  Serial: D354463D938B43FB117CE0E8000FB8F4  Version: 1.1.1-9.03293.0) 
[2011-11-07 19:41:22] JOIN: Sektor joined the game (IP: 93.79.66.188) 
[2011-11-07 19:41:59] CONNECT: JonRadiation connected (IP: 93.88.12.247  Serial: 821B9705C2486BE55ED7F92A0E76AA94  Version: 1.1.1-9.03293.0) 
[2011-11-07 19:41:59] JOIN: JonRadiation joined the game (IP: 93.88.12.247) 
[2011-11-07 19:44:10] QUIT: JonRadiation left the game [Quit] 
[2011-11-07 19:44:12] CONNECT: JonRadiation connected (IP: 93.88.12.247  Serial: 821B9705C2486BE55ED7F92A0E76AA94  Version: 1.1.1-9.03293.0) 
[2011-11-07 19:44:13] JOIN: JonRadiation joined the game (IP: 93.88.12.247) 
[2011-11-07 19:44:41] CHAT: Sektor: :Oяяяяяяяя да что за хуйня 
[2011-11-07 19:53:26] Server stopped! 
[2011-11-07 19:53:26] Stopping resources.................... 
[2011-11-07 19:53:26] Closing SQLite3 database 
[2011-11-07 19:53:26] Closing SQLite3 database 

Link to comment
function PlayerClotnesOff( player ) 
    for i = 0,16 do 
        local texture ,model = getPedClothes( player,i ) 
        if type( texture ) ~= 'string' and type( model ) ~= 'string' then 
            break 
        end 
        removePedClothes ( player, i, texture ,model ) 
    end 
end 
  
addEventHandler("onResourceStart", resourceRoot, 
    function() 
        resetMapInfo() 
        local players = getElementsByType("player") 
        if type( players ) == 'table' then 
            for i,v in ipairs( players ) do 
                  spawn( v ) 
            end 
        end 
    end 
) 
  
function spawn( player ) 
    local player = player or source 
    spawnPlayer( player,2316.1623, 49.6955, 26.482 ) 
    addPedClothes ( player, "moto", "moto", 16 ) 
    PlayerClotnesOff(player) 
    fadeCamera(player, true) 
    setCameraTarget(player, player) 
    showChat(player, true) 
    createBlipAttachedTo ( player, 52 ) 
    createBlip (100.0, -500.0, 17.0, 0, 4, 255, 125, 0, 255, 0, 1000.0, root)  
end 
  
addEventHandler("onPlayerJoin", root, 
    function() 
        spawn( source ) 
    end 
) 
  
addEventHandler("onPlayerWasted", root, 
    function() 
        setTimer( spawn, 1800, 1, source ) 
    end 
) 

Когда игрок умер или вошёл на сервер нужно использовать не setElementPosition а spawnPlayer

p.s переписал скрипт

Link to comment

26 строку первого кода нужно заменить на

local players = getElementsByType('player') 
  
if type(players) == 'table' then 
    for i, player in ipairs(players) do 
        spawn(player) 
    end 
end 

потому что в том событии нет такой переменной как player

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...