Guest User

Untitled

a guest
Oct 18th, 2017
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 31.81 KB | None | 0 0
  1. import es
  2. import popuplib
  3. import random
  4. import gamethread
  5. import cfglib
  6. import langlib
  7. import playerlib
  8.  
  9. config = cfglib.AddonCFG(es.getAddonPath("starwars") + "/settings.cfg")
  10. config.text("**************************")
  11. config.text("Addon Settings")
  12. config.text("**************************")
  13. config.text(" ")
  14. config.text("*****************************************************************************")
  15. config.text("Configuration: General Settings\n//\n//Desc : Configure the general settings the mod uses")
  16. config.text("*****************************************************************************")
  17. sw_jediModeEnabled = config.cvar("sw_jediModeEnabled",   1, "1 Enable / 0 Disable Jedi Mod (Allows Users to use Yoda and Darth Vader)")
  18. sw_bobaJetsEnabled = config.cvar("bobaJetsEnabled",   1, "1 = Enable Boba Fetts Jetpack 0 = Disable it")
  19. sw_randomclasses  = config.cvar("sw_randomclasses",   1, "1 = When The users have no classes selceted there will be set a random one/ 0 = Disable it")
  20. effecttype = config.cvar("effecttype",   'effects/laser1.vmt', "Here you can set the Laser model")
  21. sw_showmenuoneveryspawn = config.cvar("sw_showmenuoneveryspawn",   0, "1 = Shows the Class menu on every spawn/ 0 = Disable it")
  22. sw_bobaJetstime = config.cvar("sw_bobaJetstime",   5, "Set the Time how long the Jetpack can be used")
  23. sw_weaponSoundsEnabled = config.cvar("sw_weaponSoundsEnabled",   1, "1 = Enable Weapon Sounds 0 = Disable it")
  24. sw_charSoundsEnabled = config.cvar("sw_charSoundsEnabled",   1, " 1 = Allow Death Sounds / 0 = Disable it")
  25. sw_lasers_enabled  = config.cvar("sw_lasers_enabled",   1, "1 = Allow Laser 0 = Disable it")
  26. sw_jabbaLaughEnabled  = config.cvar("sw_jabbaLaughEnabled",   1, "1 = Allow Jabba to laught after Bomb explode / 0 Disable it")
  27. sw_more_damage_for_jedi = config.cvar("sw_more_damage_for_jedi",   1, "1 = Allows Jedis to do more damage by lightsaber (knife)")
  28. sw_jedi_damage_by_knife = config.cvar("sw_jedi_damage_by_knife",  10, "Set the Value of Damage when jedi is hitting a player with lightsaber(knife)")
  29. config.write()
  30.  
  31. sw_admins = ["STEAM_0:1:11481373", "STEAM_0:1:12345678"]
  32.  
  33.  
  34. #####No EDIT HERE !
  35.  
  36. rebelsoldiermodel = 'models/player/b4p/b4p_rebel/b4p_rebel.mdl'
  37. wookiemodel = 'models/player/b4p/b4p_chewbacca/b4p_chewbacca.mdl'
  38. jawamodel = 'models/player/b4p/b4p_jawa/b4p_jawa.mdl'
  39. tuskenmodel = 'models/player/b4p/b4p_tusken/b4p_tusken.mdl'
  40. c3pomodel = 'models/player/b4p/b4p_c3po/b4p_c3po.mdl'
  41. yodamodel = 'models/player/b4p/b4p_yoda/b4p_yoda.mdl'
  42.  
  43. stormtroopermodel = 'models/player/b4p/b4p_stormt/b4p_stormt.mdl'
  44. snowtroopermodel = 'models/player/b4p/b4p_snowtrooper/b4p_snowtrooper.mdl'
  45. rodianmodel = 'models/player/b4p/b4p_rodian/b4p_rodian.mdl'
  46. officermodel = 'models/player/b4p/b4p_imperial/b4p_imperial.mdl'
  47. bobamodel = 'models/player/b4p/b4p_bobafett/b4p_bobafett.mdl'
  48. vadermodel = 'models/player/b4p/b4p_vader/b4p_vader.mdl'
  49.  
  50.  
  51. wanted_empire = {}
  52. empire_model_features = {}
  53. rebel_model_features = {}
  54. classname_dict = {}
  55. wanted_rebel = {}
  56.  
  57. def load():
  58.     global text
  59.     download()
  60.     es.doblock("corelib/noisy_on")
  61.     config.execute()
  62.     text = langlib.Strings(es.getAddonPath("starwars") + "/strings.ini")
  63.  
  64. def unload():
  65.     es.doblock("corelib/noisy_off")
  66.     empire_model_features.clear()
  67.     rebel_model_features.clear()
  68.     wanted_empire.clear()
  69.     wanted_empire.clear()
  70.     classname_dict.clear()
  71.  
  72.  
  73. def es_map_start(ev):
  74.     download()
  75.  
  76.  
  77. def rebelMenuShow(userid, steam):
  78.     global rebelPopup
  79.     if popuplib.exists('rebelPopup'):
  80.         popuplib.delete('rebelPopup')
  81.     rebelPopup = popuplib.create('rebelPopup')
  82.     rebelPopup.addline('Choose a Class (Rebel):')
  83.     rebelPopup.addline(' ')
  84.     if rebel_model_features.has_key(steam):
  85.         if rebel_model_features[steam] == 0:
  86.             rebelPopup.addline('Your Current Class is: None')
  87.         elif rebel_model_features[steam] == 1:
  88.             rebelPopup.addline('Your Current Class is: Rebel Soldier')
  89.         elif rebel_model_features[steam] == 2:
  90.             rebelPopup.addline('Your Current Class is: Wookie')
  91.         elif rebel_model_features[steam] == 3:
  92.             rebelPopup.addline('Your Current Class is: Jawa')
  93.         elif rebel_model_features[steam] == 4:
  94.             rebelPopup.addline('Your Current Class is: Tusken Raider')
  95.         elif rebel_model_features[steam] == 5:
  96.             rebelPopup.addline('Your Current Class is: C3PO')
  97.         if sw_jediModeEnabled == 1:
  98.             if rebel_model_features[steam] == 6:
  99.                 rebelPopup.addline('Your Current Class is: Yoda')
  100.     rebelPopup.addline(' ')
  101.     rebelPopup.addline('->1. Rebel Soldier')
  102.     rebelPopup.addline('->2. Wookie')
  103.     rebelPopup.addline('->3. Jawa')
  104.     rebelPopup.addline('->4. Tusken Raider')
  105.     rebelPopup.addline('->5. C3PO')
  106.     if sw_jediModeEnabled == 1:
  107.         rebelPopup.addline('->6. Yoda')
  108.     rebelPopup.addline(' ')
  109.     rebelPopup.addline('0. Exit')
  110.     rebelPopup.send(int(userid))
  111.     rebelPopup.menuselect = rebelPopup_select
  112.    
  113.    
  114. def adminMenu(userid, steam):
  115.     global check1, adminPopup,check2,check3,check4,check5,check6,check7,check8,sw_jediModeEnabled,sw_bobaJetsEnabled,sw_randomclasses,sw_showmenuoneveryspawn,sw_weaponSoundsEnabled,sw_charSoundsEnabled,sw_lasers_enabled,sw_jabbaLaughEnabled
  116.     if popuplib.exists('adminPopup'):
  117.         popuplib.delete('adminPopup')
  118.     adminPopup = popuplib.create('adminPopup')
  119.     adminPopup.addline('Admin Menu:')
  120.     adminPopup.addline(' ')
  121.     if sw_jediModeEnabled == 1:
  122.         adminPopup.addline('->1. Disable Jedi Mode')
  123.         check1 = 1
  124.     else:
  125.         check1 = 0
  126.         adminPopup.addline('->1. Enable Jedi Mode')
  127.     if sw_bobaJetsEnabled == 1:
  128.         check2 = 1
  129.         adminPopup.addline('->2. Disable Bobas Jet')
  130.     else:
  131.         check2 = 0
  132.         adminPopup.addline('->2. Enable Bobas Jet')
  133.     if sw_randomclasses == 1:
  134.         check3 = 1
  135.         adminPopup.addline('->3. Disable RandomClasses')
  136.     else:
  137.         check3 = 0
  138.         adminPopup.addline('->3. Disable RandomClasses')
  139.     if sw_showmenuoneveryspawn  == 1:
  140.         check4 = 1
  141.         adminPopup.addline('->4. Disable Menu Show on Spawn')
  142.     else:
  143.         check4 = 0
  144.         adminPopup.addline('->4. Disable Menu Show on Spawn')
  145.     if  sw_weaponSoundsEnabled == 1:
  146.         check5 = 1
  147.         adminPopup.addline('->5. Disable Weaponsounds')
  148.     else:
  149.         check5 = 0
  150.         adminPopup.addline('->5. Enable Weaponsounds')
  151.     if  sw_charSoundsEnabled == 1:
  152.         check6 = 1
  153.         adminPopup.addline('->6. Disable Death Sounds')
  154.     else:
  155.         check6 = 0
  156.         adminPopup.addline('->6. Enable Death Sounds')
  157.     if sw_lasers_enabled == 1:
  158.         check7 = 1
  159.         adminPopup.addline('->7. Disable Laser')
  160.     else:
  161.         check7 = 0
  162.         adminPopup.addline('->7. Enable Laser')
  163.     if sw_jabbaLaughEnabled  == 1:
  164.         check8 = 1
  165.         adminPopup.addline('->8. Disable Jabbas Laught')
  166.     else:
  167.         check8 = 0
  168.         adminPopup.addline('->8. Enable Jabbas Laught')
  169.     adminPopup.addline(' ')
  170.     adminPopup.addline('0. Exit')
  171.     adminPopup.send(userid)
  172.     adminPopup.menuselect = adminPopup_select
  173.    
  174. def adminPopup_select(userid, choice, popupid):
  175.     global check1,check2,check3,check4,check5,check6,check7,check8,sw_jediModeEnabled,sw_bobaJetsEnabled,sw_randomclasses,sw_showmenuoneveryspawn,sw_weaponSoundsEnabled,sw_charSoundsEnabled,sw_lasers_enabled,sw_jabbaLaughEnabled
  176.     player = playerlib.getPlayer(userid)
  177.     if choice == 1:
  178.         if check1 == 1:
  179.             sw_jediModeEnabled = 0
  180.             es.msg('#multi', text('admin1',{},player.get('lang')))
  181.         else:
  182.             sw_jediModeEnabled = 1
  183.             es.msg('#multi', text('admin2',{},player.get('lang')))
  184.     elif choice == 2:
  185.         if check2 == 1:
  186.             sw_bobaJetsEnabled = 0
  187.             es.msg('#multi', text('admin3',{},player.get('lang')))
  188.         else:
  189.             sw_bobaJetsEnabled = 1
  190.             es.msg('#multi', text('admin4',{},player.get('lang')))
  191.     elif choice == 3:
  192.         if check3  == 1:
  193.             sw_randomclasses = 0
  194.             es.msg('#multi', text('admin5',{},player.get('lang')))
  195.         else:
  196.             sw_randomclasses = 1
  197.             es.msg('#multi', text('admin6',{},player.get('lang')))
  198.     elif choice == 4:
  199.         if check4 == 1:
  200.             sw_showmenuoneveryspawn  = 0
  201.             es.msg('#multi', text('admin7',{},player.get('lang')))
  202.         else:
  203.             sw_showmenuoneveryspawn  = 1
  204.             es.msg('#multi', text('admin8',{},player.get('lang')))
  205.     elif choice == 5:
  206.         if  check5 == 1:
  207.             sw_weaponSoundsEnabled = 0
  208.             es.msg('#multi', text('admin9',{},player.get('lang')))
  209.         else:
  210.             sw_weaponSoundsEnabled = 1
  211.             es.msg('#multi', text('admin10',{},player.get('lang')))
  212.     elif choice == 6:
  213.         if  check6 == 1:
  214.             sw_charSoundsEnabled = 0
  215.             es.msg('#multi', text('admin11',{},player.get('lang')))
  216.         else:
  217.             sw_charSoundsEnabled = 1
  218.             es.msg('#multi', text('admin12',{},player.get('lang')))
  219.     elif choice == 7:
  220.         if check7 == 1:
  221.             sw_lasers_enabled = 0
  222.             es.msg('#multi', text('admin13',{},player.get('lang')))
  223.         else:
  224.             sw_lasers_enabled = 1
  225.             es.msg('#multi', text('admin14',{},player.get('lang')))
  226.     elif choice == 8:
  227.         if check8 == 1:
  228.             sw_jabbaLaughEnabled = 0
  229.             es.msg('#multi', text('admin15',{},player.get('lang')))
  230.         else:
  231.             sw_jabbaLaughEnabled = 1
  232.             es.msg('#multi', text('admin16',{},player.get('lang')))
  233.  
  234.    
  235.    
  236. def empireMenuShow(userid, steam):
  237.     global empirePopup
  238.     if popuplib.exists('empirePopup'):
  239.         popuplib.delete('empirePopup')
  240.     empirePopup = popuplib.create('empirePopup')
  241.     empirePopup.addline('Choose a Class (Empire):')
  242.     empirePopup.addline(' ')
  243.     if empire_model_features.has_key(steam):
  244.         if empire_model_features[steam] == 0:
  245.             empirePopup.addline('Your Current Class is: None')
  246.         elif empire_model_features[steam] == 1:
  247.             empirePopup.addline('Your Current Class is: Storm Trooper')
  248.         elif empire_model_features[steam] == 2:
  249.             empirePopup.addline('Your Current Class is: Snow Trooper')
  250.         elif empire_model_features[steam] == 3:
  251.             empirePopup.addline('Your Current Class is: Rodian')
  252.         elif empire_model_features[steam] == 4:
  253.             empirePopup.addline('Your Current Class is: Imperial Officer')
  254.         elif empire_model_features[steam] == 5:
  255.             empirePopup.addline('Your Current Class is: Boba Fett')
  256.         if sw_jediModeEnabled == 1:
  257.             if empire_model_features[steam] == 6:
  258.                 rebelPopup.addline('Your Current Class is: Darth Vader')
  259.     empirePopup.addline(' ')
  260.     empirePopup.addline('->1. Storm Trooper')
  261.     empirePopup.addline('->2. Snow Trooper')
  262.     empirePopup.addline('->3. Rodian')
  263.     empirePopup.addline('->4. Imperial Officer')
  264.     empirePopup.addline('->5. Boba Fett')
  265.     if sw_jediModeEnabled == 1:
  266.         empirePopup.addline('->6. Darth Vader')
  267.     empirePopup.addline(' ')
  268.     empirePopup.addline('0. Exit')
  269.     empirePopup.send(int(userid))
  270.     empirePopup.menuselect = empirePopup_select
  271.    
  272.  
  273. def rebelPopup_select(userid, choice, popupid):
  274.     steam = es.getplayersteamid(userid)
  275.     player = playerlib.getPlayer(userid)
  276.     if not wanted_rebel.has_key(steam):
  277.         wanted_rebel[steam] = 0
  278.     if not rebel_model_features.has_key(steam):
  279.         rebel_model_features[steam] = 0
  280.     if choice == 1:
  281.         wanted_rebel[steam] = rebelsoldiermodel
  282.         classname_dict[userid] = 'Rebel'
  283.         rebel_model_features[steam] = 1
  284.         change_skin_rebel(userid,steam)
  285.         es.tell(userid, '#multi', text('cho1',{'classn': classname_dict[userid]},player.get('lang')))
  286.     elif choice == 2:
  287.         wanted_rebel[steam] = wookiemodel
  288.         classname_dict[userid] = 'Wookie'
  289.         rebel_model_features[steam] = 2
  290.         change_skin_rebel(userid,steam)
  291.         es.tell(userid, '#multi', text('cho1',{'classn': classname_dict[userid]},player.get('lang')))
  292.     elif choice == 3:
  293.         wanted_rebel[steam] = jawamodel
  294.         classname_dict[userid] = 'Jawa'
  295.         rebel_model_features[steam] = 3
  296.         change_skin_rebel(userid,steam)
  297.         es.tell(userid, '#multi', text('cho1',{'classn': classname_dict[userid]},player.get('lang')))
  298.     elif choice == 4:
  299.         wanted_rebel[steam] = tuskenmodel
  300.         classname_dict[userid] = 'Tuske'
  301.         rebel_model_features[steam] = 4
  302.         change_skin_rebel(userid,steam)
  303.         es.tell(userid, '#multi', text('cho1',{'classn': classname_dict[userid]},player.get('lang')))
  304.     elif choice == 5:
  305.         wanted_rebel[steam] = c3pomodel
  306.         classname_dict[userid] = 'C3PO'
  307.         rebel_model_features[steam] = 5
  308.         change_skin_rebel(userid,steam)
  309.         es.tell(userid, '#multi', text('cho1',{'classn': classname_dict[userid]},player.get('lang')))
  310.     elif choice == 6:
  311.         if sw_jediModeEnabled == 1:
  312.             wanted_rebel[steam] = yodamodel
  313.             classname_dict[userid] = 'Yoda'
  314.             rebel_model_features[steam] = 6
  315.             change_skin_rebel(userid,steam)
  316.             es.tell(userid, '#multi', text('cho1',{'classn': classname_dict[userid]},player.get('lang')))
  317.  
  318. def empirePopup_select(userid, choice, popupid):
  319.     player = playerlib.getPlayer(userid)
  320.     steam = es.getplayersteamid(userid)
  321.     if not wanted_empire.has_key(steam):
  322.         wanted_empire[steam] = 0
  323.     if not empire_model_features.has_key(steam):
  324.         empire_model_features[steam] = 0
  325.     if choice == 1:
  326.         wanted_empire[steam] = stormtroopermodel
  327.         classname_dict[userid] = 'Stormtrooper'
  328.         empire_model_features[steam] = 1
  329.         change_skin_empire(userid,steam)
  330.         es.tell(userid, '#multi', text('cho1',{'classn': classname_dict[userid]},player.get('lang')))
  331.     elif choice == 2:
  332.         wanted_empire[steam] = snowtroopermodel
  333.         classname_dict[userid] = 'Snowtrooper'
  334.         empire_model_features[steam] = 2
  335.         change_skin_empire(userid,steam)
  336.         es.tell(userid, '#multi', text('cho1',{'classn': classname_dict[userid]},player.get('lang')))
  337.     elif choice == 3:
  338.         wanted_empire[steam] = rodianmodel
  339.         classname_dict[userid] = 'Rodian'
  340.         empire_model_features[steam] = 3
  341.         change_skin_empire(userid,steam)
  342.         es.tell(userid, '#multi', text('cho1',{'classn': classname_dict[userid]},player.get('lang')))
  343.     elif choice == 4:
  344.         wanted_empire[steam] = officermodel
  345.         classname_dict[userid] = 'Officer'
  346.         empire_model_features[steam] = 4
  347.         change_skin_empire(userid,steam)
  348.         es.tell(userid, '#multi', text('cho1',{'classn': classname_dict[userid]},player.get('lang')))
  349.     elif choice == 5:
  350.         wanted_empire[steam] = bobamodel
  351.         classname_dict[userid] = 'Boba Fett'
  352.         empire_model_features[steam] = 5
  353.         change_skin_empire(userid,steam)
  354.         es.tell(userid, '#multi', text('cho1',{'classn': classname_dict[userid]},player.get('lang')))
  355.     elif choice == 6:
  356.         if sw_jediModeEnabled == 1:
  357.             wanted_empire[steam] = vadermodel
  358.             classname_dict[userid] = 'Vader'
  359.             empire_model_features[steam] = 6
  360.             change_skin_empire(userid,steam)
  361.             es.tell(userid, '#multi', text('cho1',{'classn': classname_dict[userid]},player.get('lang')))
  362.    
  363. def change_skin_rebel(userid, steam):
  364.     player = playerlib.getPlayer(userid)
  365.     if rebel_model_features.has_key(steam):
  366.         playerlib.getPlayer(userid).setModel(wanted_rebel[steam])
  367.         if sw_jediModeEnabled == 0:
  368.             if rebel_model_features.has_key(steam):
  369.                 if rebel_model_features[steam] == 6:
  370.                     randomclasshb = random.randint(1, 5)
  371.                     if randomclasshb == 1:
  372.                         rebel_model_features[steam] = 1
  373.                         wanted_rebel[steam] = rebelsoldiermodel
  374.                         classname_dict[userid] = 'Rebel'
  375.                         es.tell(userid, '#multi', text('crsw',{'classn': classname_dict[userid]},player.get('lang')))
  376.                     elif randomclasshb == 2:
  377.                         rebel_model_features[steam] = 2
  378.                         wanted_rebel[steam] = wookiemodel
  379.                         classname_dict[userid] = 'Wookie'
  380.                         es.tell(userid, '#multi', text('crsw',{'classn': classname_dict[userid]},player.get('lang')))
  381.                     elif randomclasshb == 3:
  382.                         rebel_model_features[steam] = 3
  383.                         wanted_rebel[steam] = jawamodel
  384.                         classname_dict[userid] = 'Jawa'
  385.                         es.tell(userid, '#multi', text('crsw',{'classn': classname_dict[userid]},player.get('lang')))
  386.                     elif randomclasshb == 4:
  387.                         rebel_model_features[steam] = 4
  388.                         wanted_rebel[steam] = tuskenmodel
  389.                         classname_dict[userid] = 'Tuske'
  390.                         es.tell(userid, '#multi', text('crsw',{'classn': classname_dict[userid]},player.get('lang')))
  391.                     elif randomclasshb == 5:
  392.                         rebel_model_features[steam] = 5
  393.                         wanted_rebel[steam] = c3pomodel
  394.                         classname_dict[userid] = 'C3PO'
  395.                         es.tell(userid, '#multi', text('crsw',{'classn': classname_dict[userid]},player.get('lang')))
  396.  
  397. def player_hurt(ev):
  398.     steam = ev['es_steamid']
  399.     if sw_more_damage_for_jedi == 1:
  400.         if ev['weapon'] == 'knife':
  401.             if rebel_model_features.has_key(steam):
  402.                 if rebel_model_features[steam] == 6:
  403.                     playerlib.getPlayer(ev['userid']).health -= int(sw_jedi_damage_by_knife)
  404.             if empire_model_features.has_key(steam):
  405.                 if empire_model_features[steam] == 6:
  406.                     playerlib.getPlayer(ev['userid']).health -= int(sw_jedi_damage_by_knife)
  407.    
  408. def change_skin_empire(userid, steam):
  409.     player = playerlib.getPlayer(userid)
  410.     if empire_model_features.has_key(steam):
  411.         playerlib.getPlayer(userid).setModel(wanted_empire[steam])
  412.         if sw_jediModeEnabled == 0:
  413.             if empire_model_features.has_key(steam):
  414.                 if empire_model_features[steam] == 6:
  415.                     randomclassch = random.randint(1, 5)
  416.                     if randomclassch == 1:
  417.                         empire_model_features[steam] = 1
  418.                         wanted_empire[steam] = stormtroopermodel
  419.                         classname_dict[userid] = 'Stormtrooper'
  420.                         es.tell(userid, '#multi', text('crsw',{'classn': classname_dict[userid]},player.get('lang')))
  421.                     elif randomclassch == 2:
  422.                         empire_model_features[steam] = 2
  423.                         wanted_empire[steam] = snowtroopermodel
  424.                         classname_dict[userid] = 'Snowtrooper'
  425.                         es.tell(userid, '#multi', text('crsw',{'classn': classname_dict[userid]},player.get('lang')))
  426.                     elif randomclassch == 3:
  427.                         empire_model_features[steam] = 3
  428.                         wanted_empire[steam] = rodianmodel
  429.                         classname_dict[userid] = 'Rodian'
  430.                         es.tell(userid, '#multi', text('crsw',{'classn': classname_dict[userid]},player.get('lang')))
  431.                     elif randomclassch == 4:
  432.                         empire_model_features[steam] = 4
  433.                         wanted_empire[steam] = officermodel
  434.                         classname_dict[userid] = 'Officer'
  435.                         es.tell(userid, '#multi', text('crsw',{'classn': classname_dict[userid]},player.get('lang')))
  436.                     elif randomclassch == 5:
  437.                         empire_model_features[steam] = 5
  438.                         wanted_empire[steam] = bobamodel
  439.                         classname_dict[userid] = 'Boba Fett'
  440.                         es.tell(userid, '#multi', text('crsw',{'classn': classname_dict[userid]},player.get('lang')))
  441.  
  442.                    
  443.    
  444. def player_disconnect(ev):
  445.     steam = ev['networkid']
  446.     userid = ev['userid']
  447.     if empire_model_features.has_key(steam):
  448.         del empire_model_features[steam]
  449.     if rebel_model_features.has_key(steam):
  450.         del rebel_model_features[steam]
  451.     if wanted_empire.has_key(steam):
  452.         del wanted_empire[steam]
  453.     if wanted_empire.has_key(steam):
  454.         del wanted_empire[steam]
  455.     if classname_dict.has_key(userid):
  456.         del classname_dict[userid]
  457.    
  458.    
  459. def player_jump(ev):
  460.     userid = ev['userid']
  461.     steam = ev['es_steamid']
  462.     player = playerlib.getPlayer(userid)
  463.     if sw_bobaJetsEnabled == 1:
  464.         if empire_model_features.has_key(steam):
  465.             if empire_model_features[steam] == 5:
  466.                 player.set('jetpack', 1)
  467.                 es.emitsound("player", userid, "sw/weapons/boba/bf_flame.mp3", 1.0, 0.5)
  468.                 gamethread.delayed(sw_bobaJetstime, player.set,('jetpack', 0))
  469.            
  470. def weapon_fire(ev):
  471.     global weaponvector
  472.     userid = ev['userid']
  473.     if ev['weapon'] == 'knife':
  474.         if sw_weaponSoundsEnabled == 1:
  475.             randomknifesound = random.randint(1, 4)
  476.             if randomknifesound == 1:
  477.                 es.emitsound("player", userid, "sw/weapons/saber/saberhup1.mp3", 1.0, 0.5)
  478.             elif randomknifesound == 2:
  479.                 es.emitsound("player", userid, "sw/weapons/saber/saberhup2.mp3", 1.0, 0.5)
  480.             elif randomknifesound == 3:
  481.                 es.emitsound("player", userid, "sw/weapons/saber/saberhup3.mp3", 1.0, 0.5)
  482.             elif randomknifesound == 4:
  483.                 es.emitsound("player", userid, "sw/weapons/saber/saberhup4.mp3", 1.0, 0.5)
  484.     x,y,z = es.getplayerlocation(userid)
  485.     z = z + 50
  486.     weaponvector = es.createvectorstring(x,y,z)
  487.    
  488. def player_death(ev):
  489.     userid = ev['userid']
  490.     steam = ev['es_steamid']
  491.     if sw_charSoundsEnabled == 1:
  492.         if rebel_model_features.has_key(steam):
  493.             if rebel_model_features[steam] == 2:
  494.                 soundchew1 = random.randint(1, 3)
  495.                 if soundchew1 == 1:
  496.                     es.emitsound("player", userid, "sw/char/chewbacca/death1.mp3", 1.0, 0.5)
  497.                 elif soundchew1 == 2:
  498.                     es.emitsound("player", userid, "sw/char/chewbacca/death2.mp3", 1.0, 0.5)
  499.                 elif soundchew1 == 3:
  500.                     es.emitsound("player", userid, "sw/char/chewbacca/death3.mp3", 1.0, 0.5)
  501.             elif rebel_model_features[steam] == 3:
  502.                 soundjawa1 = random.randint(1, 3)
  503.                 if soundjawa1 == 1:
  504.                     es.emitsound("player", userid, "sw/char/jawa/death1.mp3", 1.0, 0.5)
  505.                 elif soundjawa1 == 2:
  506.                     es.emitsound("player", userid, "sw/char/jawa/death2.mp3", 1.0, 0.5)
  507.                 elif soundjawa1 == 3:
  508.                     es.emitsound("player", userid, "sw/char/jawa/death3.mp3", 1.0, 0.5)
  509.             elif rebel_model_features[steam] == 4:
  510.                 soundtus1 = random.randint(1, 2)
  511.                 if soundtus1 == 1:
  512.                     es.emitsound("player", userid, "sw/char/tusken/death1.mp3", 1.0, 0.5)
  513.                 elif soundtus1 == 2:
  514.                     es.emitsound("player", userid, "sw/char/tusken/death2.mp3", 1.0, 0.5)
  515.         if int(ev['headshot']):
  516.             if rebel_model_features.has_key(steam):
  517.                 if rebel_model_features[steam] == 2:
  518.                     soundchew2 = random.randint(1, 2)
  519.                     if soundchew2 == 1:
  520.                         es.emitsound("player", userid, "sw/char/chewbacca/taunt.mp3", 1.0, 0.5)
  521.                     elif soundchew2 == 2:
  522.                         es.emitsound("player", userid, "sw/char/chewbacca/victory1.mp3", 1.0, 0.5)
  523.                 elif rebel_model_features[steam] == 3:
  524.                     soundjawa2 = random.randint(1, 3)
  525.                     if soundjawa2 == 1:
  526.                         es.emitsound("player", userid, "sw/char/jawa/jawa1.wav", 1.0, 0.5)
  527.                     elif soundjawa2 == 2:
  528.                         es.emitsound("player", userid, "sw/char/jawa/victory2.mp3", 1.0, 0.5)
  529.                 elif rebel_model_features[steam] == 4:
  530.                     soundtus2 = random.randint(1, 2)
  531.                     if soundtus2 == 1:
  532.                         es.emitsound("player", userid, "sw/char/yoda/anger1.mp3", 1.0, 0.5)
  533.                     elif soundtus2 == 2:
  534.                         es.emitsound("player", userid, "sw/char/yoda/anger2.mp3", 1.0, 0.5)
  535.                 elif rebel_model_features[steam] == 6:
  536.                     soundjod = random.randint(1, 2)
  537.                     if soundjod == 1:
  538.                         es.emitsound("player", userid, "sw/char/yoda/laugh1.wav", 1.0, 0.5)
  539.                     elif soundjod == 2:
  540.                         es.emitsound("player", userid, "sw/char/yoda/laugh2.wav", 1.0, 0.5)
  541.                    
  542. def bullet_impact(ev):
  543.     global SoundPlayed, weaponvector
  544.     userid = ev['userid']
  545.     team = es.getplayerteam(userid)
  546.     steam = ev['es_steamid']
  547.     SoundPlayed = 0
  548.     if empire_model_features.has_key(steam):
  549.         if sw_weaponSoundsEnabled == 1:
  550.             if empire_model_features[steam] == 6:
  551.                 randomsound1 = random.randint(1, 4)
  552.                 if randomsound1 == 1:
  553.                     es.emitsound("player", userid, "sw/weapons/force/lightning.mp3", 1.0, 0.5)
  554.                 elif randomsound1 == 2:
  555.                     es.emitsound("player", userid, "sw/weapons/force/lightninghit1.mp3", 1.0, 0.5)
  556.                 elif randomsound1 == 3:
  557.                     es.emitsound("player", userid, "sw/weapons/force/lightninghit2.mp3", 1.0, 0.5)
  558.                 elif randomsound1 == 4:
  559.                     es.emitsound("player", userid, "sw/weapons/force/lightninghit3.mp3", 1.0, 0.5)
  560.                 SoundPlayed = 1
  561.     if rebel_model_features.has_key(steam):
  562.         if sw_weaponSoundsEnabled == 1:
  563.             if rebel_model_features[steam] == 6:
  564.                 randomsound2 = random.randint(1, 4)
  565.                 if randomsound2 == 1:
  566.                     es.emitsound("player", userid, "sw/weapons/force/lightning.mp3", 1.0, 0.5)
  567.                 elif randomsound2 == 2:
  568.                     es.emitsound("player", userid, "sw/weapons/force/lightninghit1.mp3", 1.0, 0.5)
  569.                 elif randomsound2 == 3:
  570.                     es.emitsound("player", userid, "sw/weapons/force/lightninghit2.mp3", 1.0, 0.5)
  571.                 elif randomsound2 == 4:
  572.                     es.emitsound("player", userid, "sw/weapons/force/lightninghit3.mp3", 1.0, 0.5)
  573.                 SoundPlayed = 1
  574.     if SoundPlayed != 1:
  575.         if sw_weaponSoundsEnabled == 1:
  576.             randomsound3 = random.randint(1, 4)
  577.             if randomsound3 == 1:
  578.                 es.emitsound("player", userid, "sw/weapons/blaster/fire.mp3", 1.0, 0.5)
  579.             elif randomsound3 != 1:
  580.                 es.emitsound("player", userid, "sw/weapons/blaster/alt_fire.mp3", 1.0, 0.5)        
  581.     weaponvector2 = es.createvectorstring(ev["x"],ev["y"],ev["z"])
  582.     premodel = es.precachemodel(effecttype)
  583.     if sw_lasers_enabled == 1:
  584.         if team == 3:
  585.             es.server.queuecmd("es_effect beam %s %s %s %s 0 0.2 0.1 6 6 0 0 0 0 255 255 100" % (weaponvector, weaponvector2, premodel, premodel))
  586.         elif team == 2:
  587.             es.server.queuecmd("es_effect beam %s %s %s %s  0 0.2 0.1 6 6 0 0 255 0 0 255 100" % (weaponvector, weaponvector2, premodel, premodel))
  588.    
  589.            
  590. def player_team(ev):
  591.     userid = ev['userid']
  592.     team = es.getplayerteam(int(userid))
  593.     steam = es.getplayersteamid(userid)
  594.     if team == 2:
  595.         rebelMenuShow(userid, steam)
  596.         if empire_model_features.has_key(steam):
  597.             del empire_model_features[steam]
  598.     if team == 3:
  599.         empireMenuShow(userid, steam)
  600.         if rebel_model_features.has_key(steam):
  601.             del rebel_model_features[steam]
  602.  
  603.            
  604. def bomb_beginplant(ev):
  605.     userid = ev['userid']
  606.     steam = ev['es_steamid']
  607.     if rebel_model_features.has_key(steam):
  608.         if rebel_model_features[steam] == 2:
  609.             es.emitsound("player", userid, "sw/char/chewbacca/chewbacca1.wav", 1.0, 0.5)
  610.         elif rebel_model_features[steam] == 3:
  611.             es.emitsound("player", userid, "sw/char/jawa/chatter2.mp3", 1.0, 0.5)
  612.         elif rebel_model_features[steam] == 4:
  613.             es.emitsound("player", userid, "sw/char/tusken/confuse1.mp3", 1.0, 0.5)
  614.    
  615. def bomb_planted(ev):
  616.     userid = ev['userid']
  617.     steam = ev['es_steamid']
  618.     if rebel_model_features.has_key(steam):
  619.         if rebel_model_features[steam] == 2:
  620.             es.emitsound("player", userid, "sw/char/chewbacca/taunt.mp3", 1.0, 0.5)
  621.         elif rebel_model_features[steam] == 3:
  622.             es.emitsound("player", userid, "sw/char/jawa/victory2.mp3", 1.0, 0.5)
  623.         elif rebel_model_features[steam] == 4:
  624.             es.emitsound("player", userid, "sw/char/tusken/taunt.mp3", 1.0, 0.5)
  625.         elif rebel_model_features[steam] == 6:
  626.             es.emitsound("player", userid, "sw/char/yoda/laugh1.wav", 1.0, 0.5)
  627.  
  628. def bomb_explode(ev):
  629.     if sw_jabbaLaughEnabled == 1:
  630.         for userid in es.getUseridList():
  631.             gamethread.delayed(1, es.playsound,(userid, 'sw/char/jabba/laugh1.wav', 1.0))
  632.            
  633. def player_say(ev):
  634.     userid = ev['userid']
  635.     team = es.getplayerteam(userid)
  636.     steam = es.getplayersteamid(userid)
  637.     text = ev['text']
  638.     player = playerlib.getPlayer(userid)
  639.     if text == '!swmenu':
  640.         if team == 2:
  641.             rebelMenuShow(userid, steam)
  642.         if team == 3:
  643.             empireMenuShow(userid, steam)
  644.     if text == '!swadmin':
  645.         if steam in sw_admins:
  646.             adminMenu(userid, steam)
  647.         else:
  648.             es.tell(userid, '#multi', text('notallowed',{},player.get('lang')))
  649.  
  650.    
  651.  
  652. def player_spawn(ev):
  653.     userid = ev['userid']
  654.     steam = ev['es_steamid']
  655.     team = es.getplayerteam(userid)
  656.     player = playerlib.getPlayer(userid)
  657.     if team == 2:
  658.         if wanted_rebel.has_key(steam):
  659.             change_skin_rebel(userid ,steam)
  660.             if rebel_model_features.has_key(steam):
  661.                 if rebel_model_features[steam] == 1:
  662.                     classname_dict[userid] = 'Rebel'
  663.                     es.tell(userid, '#multi', text('cho1',{'classn': classname_dict[userid]},player.get('lang')))
  664.                 if rebel_model_features[steam] == 2:
  665.                     classname_dict[userid] = 'Wookie'
  666.                     es.tell(userid, '#multi', text('cho1',{'classn': classname_dict[userid]},player.get('lang')))
  667.                 if rebel_model_features[steam] == 3:
  668.                     classname_dict[userid] = 'Jawa'
  669.                     es.tell(userid, '#multi', text('cho1',{'classn': classname_dict[userid]},player.get('lang')))
  670.                 if rebel_model_features[steam] == 4:
  671.                     classname_dict[userid] = 'Tuske'
  672.                     es.tell(userid, '#multi', text('cho1',{'classn': classname_dict[userid]},player.get('lang')))
  673.                 if rebel_model_features[steam] == 5:
  674.                     classname_dict[userid] = 'C3PO'
  675.                     es.tell(userid, '#multi', text('cho1',{'classn': classname_dict[userid]},player.get('lang')))
  676.                 if sw_jediModeEnabled == 1:
  677.                     if rebel_model_features[steam] == 6:
  678.                         classname_dict[userid] = 'Yoda'
  679.                         es.tell(userid, '#multi', text('cho1',{'classn': classname_dict[userid]},player.get('lang')))
  680.         else:
  681.             if sw_randomclasses == 1:
  682.                 randomclass1 = random.randint(1, 6)
  683.                 if randomclass1 == 1:
  684.                     rebel_model_features[steam] = 1
  685.                     wanted_rebel[steam] = rebelsoldiermodel
  686.                     classname_dict[userid] = 'Rebel'
  687.                     es.tell(userid, '#multi', text('crsw',{'classn': classname_dict[userid]},player.get('lang')))
  688.                 elif randomclass1 == 2:
  689.                     rebel_model_features[steam] = 2
  690.                     wanted_rebel[steam] = wookiemodel
  691.                     classname_dict[userid] = 'Wookie'
  692.                     es.tell(userid, '#multi', text('crsw',{'classn': classname_dict[userid]},player.get('lang')))
  693.                 elif randomclass1 == 3:
  694.                     rebel_model_features[steam] = 3
  695.                     wanted_rebel[steam] = jawamodel
  696.                     classname_dict[userid] = 'Jawa'
  697.                     es.tell(userid, '#multi', text('crsw',{'classn': classname_dict[userid]},player.get('lang')))
  698.                 elif randomclass1 == 4:
  699.                     rebel_model_features[steam] = 4
  700.                     wanted_rebel[steam] = tuskenmodel
  701.                     classname_dict[userid] = 'Tuske'
  702.                     es.tell(userid, '#multi', text('crsw',{'classn': classname_dict[userid]},player.get('lang')))
  703.                 elif randomclass1 == 5:
  704.                     rebel_model_features[steam] = 5
  705.                     wanted_rebel[steam] = c3pomodel
  706.                     classname_dict[userid] = 'C3PO'
  707.                     es.tell(userid, '#multi', text('crsw',{'classn': classname_dict[userid]},player.get('lang')))
  708.                 if sw_jediModeEnabled == 1:
  709.                     if randomclass1 == 6:
  710.                         rebel_model_features[steam] = 6
  711.                         wanted_rebel[steam] = yodamodel
  712.                         classname_dict[userid] = 'Yoda'
  713.                         es.tell(userid, '#multi', text('crsw',{'classn': classname_dict[userid]},player.get('lang')))
  714.             rebelMenuShow(userid, steam)
  715.         if sw_showmenuoneveryspawn == 1:
  716.             rebelMenuShow(userid, steam)   
  717.     if team == 3:
  718.         if wanted_empire.has_key(steam):
  719.             change_skin_empire(userid, steam)
  720.             if empire_model_features.has_key(steam):
  721.                 if empire_model_features[steam] == 1:
  722.                     classname_dict[userid] = 'Stormtrooper'
  723.                     es.tell(userid, '#multi', text('cho1',{'classn': classname_dict[userid]},player.get('lang')))
  724.                 if empire_model_features[steam] == 2:
  725.                     classname_dict[userid] = 'Snowtrooper'
  726.                     es.tell(userid, '#multi', text('cho1',{'classn': classname_dict[userid]},player.get('lang')))
  727.                 if empire_model_features[steam] == 3:
  728.                     classname_dict[userid] = 'Rodian'
  729.                     es.tell(userid, '#multi', text('cho1',{'classn': classname_dict[userid]},player.get('lang')))
  730.                 if empire_model_features[steam] == 4:
  731.                     classname_dict[userid] = 'Officer'
  732.                     es.tell(userid, '#multi', text('cho1',{'classn': classname_dict[userid]},player.get('lang')))
  733.                 if empire_model_features[steam] == 5:
  734.                     classname_dict[userid] = 'Boba Fett'
  735.                     es.tell(userid, '#multi', text('cho1',{'classn': classname_dict[userid]},player.get('lang')))
  736.                     if sw_bobaJetsEnabled  == 1:
  737.                         es.tell(userid, '#multi', text('cho1',{'classn': classname_dict[userid]},player.get('lang')))
  738.                 if sw_jediModeEnabled == 1:
  739.                     if empire_model_features[steam] == 6:
  740.                         classname_dict[userid] = 'Vader'
  741.                         es.tell(userid, '#multi', text('cho1',{'classn': classname_dict[userid]},player.get('lang')))
  742.         else:
  743.             if sw_randomclasses == 1:
  744.                 randomclass2 = random.randint(1, 6)
  745.                 if randomclass2 == 1:
  746.                     empire_model_features[steam] = 1
  747.                     wanted_empire[steam] = stormtroopermodel
  748.                     classname_dict[userid] = 'Stormtrooper'
  749.                     es.tell(userid, '#multi', text('crsw',{'classn': classname_dict[userid]},player.get('lang')))
  750.                 elif randomclass2 == 2:
  751.                     empire_model_features[steam] = 2
  752.                     wanted_empire[steam] = snowtroopermodel
  753.                     classname_dict[userid] = 'Snowtrooper'
  754.                     es.tell(userid, '#multi', text('crsw',{'classn': classname_dict[userid]},player.get('lang')))
  755.                 elif randomclass2 == 3:
  756.                     empire_model_features[steam] = 3
  757.                     wanted_empire[steam] = rodianmodel
  758.                     classname_dict[userid] = 'Rodian'
  759.                     es.tell(userid, '#multi', text('crsw',{'classn': classname_dict[userid]},player.get('lang')))
  760.                 elif randomclass2 == 4:
  761.                     empire_model_features[steam] = 4
  762.                     wanted_empire[steam] = officermodel
  763.                     classname_dict[userid] = 'Officer'
  764.                     es.tell(userid, '#multi', text('crsw',{'classn': classname_dict[userid]},player.get('lang')))
  765.                 elif randomclass2 == 5:
  766.                     empire_model_features[steam] = 5
  767.                     wanted_empire[steam] = bobamodel
  768.                     classname_dict[userid] = 'Boba Fett'
  769.                     es.tell(userid, '#multi', text('crsw',{'classn': classname_dict[userid]},player.get('lang')))
  770.                     if sw_bobaJetsEnabled  == 1:
  771.                         es.tell(userid, '#multi', text('crsw',{'classn': classname_dict[userid]},player.get('lang')))
  772.                 if sw_jediModeEnabled == 1:
  773.                     if randomclass2 == 6:
  774.                         empire_model_features[steam] = 6
  775.                         wanted_empire[steam] = vadermodel
  776.                         classname_dict[userid] = 'Vader'
  777.                         es.tell(userid, '#multi', text('crsw',{'classn': classname_dict[userid]},player.get('lang')))
  778.             empireMenuShow(userid, steam)
  779.         if sw_showmenuoneveryspawn == 1:
  780.             empireMenuShow(userid, steam)
Add Comment
Please, Sign In to add comment