Расстояние между изображениями трейла

Тема в разделе "Программирование / Скриптинг", создана пользователем Игорь Романов, 24 апр 2013.

  1. Игорь Романов

    Игорь Романов

    Сообщения:
    5
    Симпатии:
    0
    Всем добрый день!
    Проблему в следующем, есть плагин дающий игроку выбрать трейл, плагин написан на Eventscripts, при его использование каждый рисунок трейла не показывается до конца, то есть получается такая картина, к примеру показывается половина рисунка и сразу заканчивается и начинается снова, то есть сам хвост отображается нормально, но из половинчатых картинок.

    В плагине есть такие параметры, но они не отвечают за вывод изображения кусками:
    lifetime = 1.0
    startwidth = 10.0
    endwidth = 10.0
    colors = '255, 255, 255'

    Подскажите, скорее всего должен быть параметр, который выводит полностью vmt изображение а не его часть.
    Заранее спасибо!

    Ниже исходник кода
    from __future__ import with_statement
    from path import path
    import re
    import es
    import playerlib
    import popuplib
    from configobj import ConfigObj
    import cPickle
    import os
    import gamethread
    import effectlib
    import vecmath

    #> Config

    '''Removes the Trails on the Death(0 = no, 1 = yes)'''
    REMOVE_TRAIL_ON_DEATH = 1

    '''Trails only for Admins?(0 = no, 1 = yes)'''
    ADMIN_ONLY = 0

    '''If its Admin only, should we use the Sourcemod Admins or a own File(1 = sourcemod, 2 = own File)'''
    GET_ADMINS_METHOD = 1

    '''Method to show the trail(1 = using effectlib, all trails should work but looks not perfect, 2 = creates env_spritetrail, its a good choice)'''
    SHOW_TRAIL_METHOD = 2

    '''Enable Autokick Disabler, its needed if you dont have it(0 = no, 1 = yes)'''
    ENABLE_AUTOKICK_DISABLER = 1

    '''Commands to open the Trail menu'''
    COMMANDS_TO_OPEN_TRAILS = ("!trails", "!trail", "!t")

    '''Commands to disable Trail'''
    COMMANDS_TO_DISABLE_TRAIL = ("!removetrail", "!stoptrail", "!deletetrail")

    #> Config End, changes under this Line will have fatal errors

    info = es.AddonInfo()
    info.author = "Jackmaster"
    info.name = "trails"
    info.basename = "trails"
    info.version = "1.0.4 Public"


    trails = {}

    trailsPath = ConfigObj(es.getAddonPath("trails") + "/Trails.ini")
    TrailsDictPath = os.path.join(es.getAddonPath("trails"), "data.db")
    SM_ADMIN_PATH = path(es.ServerVar('eventscripts_gamedir')).joinpath('addons', 'sourcemod', 'configs', 'admins_simple.ini')
    RE_STEAMID = re.compile(r'STEAM\_\d\:\d\:\d+')


    def load():
    if os.path.isfile(TrailsDictPath):
    fileStream = open(TrailsDictPath, 'r')
    trails = cPickle.load(fileStream)
    fileStream.close()
    makeDownload()
    es.msg("#multi", "#darkgreenTrails:#lightgreen by Jackmaster has been loaded")

    if ENABLE_AUTOKICK_DISABLER == 1:
    for userid in es.getUseridList():
    disableAutokick(userid)

    def unload():
    for a in es.getUseridList():
    gamethread.cancelDelayed('trail_%s' % a)
    es.msg("#multi", "#darkgreenTrails:#lightgreen by Jackmaster has been unloaded")


    def savedb():
    fileStream = open(TrailsDictPath, 'w')
    cPickle.dump(trails, fileStream)
    fileStream.close()

    def givemeatrail(userid):
    PMMenu = popuplib.easymenu('trailsmenu', None, trails_select)
    PMMenu.settitle("Choose a Trail:")
    for trail in trailsPath:
    PMMenu.addoption(trail, trail)

    PMMenu.send(userid)

    def trails_select(userid, choice, popupid):
    steamid = es.getplayersteamid(userid)
    if not steamid in trails:
    trails[steamid] = {}
    trails[steamid]["index"] = 0
    trails[steamid]["trailModel"] = trailsPath[choice]['path']
    trails[steamid]["trailTime"] = trailsPath[choice]['lifetime']
    trails[steamid]["trailStartwidth"] = trailsPath[choice]['startwidth']
    trails[steamid]["trailEndwitdth"] = trailsPath[choice]['endwidth']
    trails[steamid]["trailColor"] = trailsPath[choice]['colors']
    es.tell(userid, '#multi', '#darkgreenTrails:#default You choose the Trail#green %s'% str(choice))
    killtrail(userid)
    if SHOW_TRAIL_METHOD == 1:
    CreateTrailMethodI(userid)
    else:
    CreateTrailMethodII(userid, trailsPath[choice]['path'], trailsPath[choice]['lifetime'], trailsPath[choice]['startwidth'], trailsPath[choice]['endwidth'], trailsPath[choice]['colors'])

    def player_spawn(ev):
    userid = ev["userid"]
    steamid = es.getplayersteamid(userid)
    if not steamid in trails:
    return

    if SHOW_TRAIL_METHOD == 1:
    CreateTrailMethodI(userid)

    else:
    CreateTrailMethodII(userid, trails[steamid]["trailModel"], trails[steamid]["trailTime"], trails[steamid]["trailStartwidth"], trails[steamid]["trailEndwitdth"], trails[steamid]["trailColor"])

    def player_death(ev):
    userid = ev["userid"]
    steamid = es.getplayersteamid(userid)
    if not steamid in trails:
    return
    if REMOVE_TRAIL_ON_DEATH == 1:
    if SHOW_TRAIL_METHOD == 1:
    gamethread.cancelDelayed('trail_%s' % userid)

    else:
    killtrail(userid)



    def player_say(ev):
    userid = ev["userid"]
    steamid = es.getplayersteamid(userid)
    text = ev["text"]
    if text in COMMANDS_TO_OPEN_TRAILS:
    if ADMIN_ONLY == 0:
    givemeatrail(userid)

    else:
    if GET_ADMINS_METHOD == 1:
    if steamid in getSMAdmins():
    givemeatrail(userid)

    else:
    es.tell(userid, '#multi', '#darkgreenTrails:#default You have no access to the trails menu')

    if GET_ADMINS_METHOD == 2:
    if steamid in getAdminsviaFile():
    givemeatrail(userid)

    else:
    es.tell(userid, '#multi', '#darkgreenTrails:#default You have no access to the trails menu')

    if text in COMMANDS_TO_DISABLE_TRAIL:
    if SHOW_TRAIL_METHOD == 1:
    gamethread.cancelDelayed('trail_%s' % userid)

    else:
    killtrail(userid)

    es.tell(userid, '#multi', '#darkgreenTrails:#default You have disabled your Trail')

    def getAdminsviaFile():
    addonpath = es.getAddonPath("trails").replace("\\", "/")
    userfile = open(addonpath + '/admins.txt', 'rb')
    userdata = userfile.read()
    userfile.close()
    return userdata.split('\n')

    def makeDownload():
    addonpath = es.getAddonPath("trails").replace("\\", "/")
    userfile = open(addonpath + '/downloads.txt', 'rb')
    userdata = userfile.read()
    userfile.close()
    for a in userdata.split('\n'):
    es.stringtable("downloadables", a)

    def round_end(ev):
    savedb()

    def es_map_start(ev):
    makeDownload()

    def CreateTrailMethodII(userid, material, time, sw, ew, col):
    es.precachemodel('%s'% material)
    steamid = es.getplayersteamid(userid)
    index = es.createentity('env_spritetrail')
    es.setentityname(index, index)
    es.entitysetvalue(index, 'lifetime', time)
    es.entitysetvalue(index, 'startwidth', sw)
    es.entitysetvalue(index, 'endwidth', ew)
    es.entitysetvalue(index, 'rendercolor', col)
    es.entitysetvalue(index, 'renderamt', 255)
    es.entitysetvalue(index, 'rendermode', 0)
    es.entitysetvalue(index, 'spritename', '%s'% material)
    target = es.getplayerlocation(userid)
    es.entitysetvalue(index, 'origin', '%s %s %s' % (target[0], target[1], target[2] + 10))
    es.server.insertcmd('es_xspawnentity %s'% index)
    es.fire(userid, index, 'setparent', '!activator')
    es.setindexprop(index, 'CSpriteTrail.m_flTextureRes', 0.05)
    es.fire(userid, index, 'showsprite')
    trails[steamid]["index"] = index


    def killtrail(userid):
    global trails
    steamid = es.getplayersteamid(userid)
    if trails[steamid]['index'] == 0:
    return
    if SHOW_TRAIL_METHOD == 1:
    gamethread.cancelDelayed('trail_%s' % userid)
    if trails[steamid]['index'] == 0:
    return
    if SHOW_TRAIL_METHOD == 2:
    es.fire(userid, trails[steamid]['index'], 'ClearParent')
    es.server.queuecmd('es_xremove %s'% trails[steamid]['index'])
    trails[steamid]['index'] = 0

    def CreateTrailMethodI(userid):
    if not es.getplayerprop(userid, 'CCSPlayer.baseclass.pl.deadflag'):
    gamethread.delayedname(0.1, 'trail_%s'% userid, check,(es.getplayerlocation(userid), userid))

    def check((x2,y2,z2), userid):
    x,y,z = es.getplayerlocation(userid)
    steamid = es.getplayersteamid(userid)
    gamethread.cancelDelayed('trail_%s' % userid)
    if (x,y,z) != (x2,y2,z2):
    sw = trails[steamid]["trailStartwidth"]
    ew = trails[steamid]["trailEndwitdth"]
    col = trails[steamid]["trailColor"]
    effectlib.drawLine((x2,y2,z2 + 10), (x,y,z + 10), trails[steamid]["trailModel"], 'materials/sprites/halo01.vmt', 1, sw, ew, col, 255)
    (x2,y2,z2) = x,y,z

    gamethread.delayedname(0.1, 'trail_%s'% userid, check,((x2,y2,z2), userid))

    def player_activate(ev):
    userid = ev["userid"]
    if ENABLE_AUTOKICK_DISABLER == 1:
    disableAutokick(userid)

    def disableAutokick(userid):
    es.server.mp_disable_autokick(userid)

    def round_start(ev):
    es.msg("#multi", "#darkgreenTrails:#lightgreen This Server runs the Trails Plugin by Jackmaster")
    if ADMIN_ONLY == 0:
    es.msg("#multi", "#darkgreenTrails:#lightgreen Write#default %s#lightgreen to choose a Trail"% str(COMMANDS_TO_OPEN_TRAILS[0]))

    def getSMAdmins():
    with SM_ADMIN_PATH.open() as f:
    return RE_STEAMID.findall(f.read())
     
  2. spore

    spore SubPlay.ru

    Сообщения:
    640
    Симпатии:
    148
    Заскринил бы хоть.
     
    Последнее редактирование: 24 апр 2013
  3. Черная вдова

    Черная вдова

    Сообщения:
    1.621
    Симпатии:
    234
    На sm перешл бы хоть.