Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ######################
- ### Guns And Games ###
- ######################
- leg_1_location_t = "-255.500427,-1391.077637,128.093811"
- leg_1_location_ct = "-1840.713745,-1004.405701,162.085236"
- leg_2_location_ct = "-1840.713745,-1004.405701,162.085236"
- _CMD = '!ct'
- import es
- import psyco
- import random
- import popuplib
- import playerlib
- import gamethread
- global currentGame
- currentGame = 0
- psyco.full()
- Data = {}
- Data['guns'] = {}
- def load():
- global Menu_Main
- Menu_Main = popuplib.easymenu('Menu_Main',None, PopupChoiceThing)
- Menu_Main.settitle("- CT Menu\nPage:")
- Menu_Main.addoption("gunsMenu","Våben")
- Menu_Main.addoption("gamesMenu","Spil")
- global Menu_Guns
- Menu_Guns = popuplib.easymenu('Menu_Guns',None, PopupChoiceThing)
- Menu_Guns.submenu(10, Menu_Main)
- Menu_Guns.settitle("- CT Menu\n-- Våben\nPage:")
- Menu_Guns.addoption("Pistols","Pistoler")
- Menu_Guns.addoption("Rifles","Geværer")
- Menu_Guns.addoption("Others","Tilbehør")
- global Menu_Guns_Pistols
- Menu_Guns_Pistols = popuplib.easymenu('Menu_Guns_Pistols',None, PopupChoiceThingWeapon)
- Menu_Guns_Pistols.submenu(10, Menu_Guns)
- Menu_Guns_Pistols.settitle("- CT Menu\n-- Våben\n--- Pistoler\nPage:")
- Menu_Guns_Pistols.addoption("weapon_deagle","Deagle")
- Menu_Guns_Pistols.addoption("weapon_elite","Elite")
- Menu_Guns_Pistols.addoption("weapon_fiveseven","FiveSeven")
- Menu_Guns_Pistols.addoption("weapon_gglock","Glock")
- Menu_Guns_Pistols.addoption("weapon_p228","P228")
- Menu_Guns_Pistols.addoption("weapon_usp","USP")
- global Menu_Guns_Rifles
- Menu_Guns_Rifles = popuplib.easymenu('Menu_Guns_Rifles',None, PopupChoiceThingWeapon)
- Menu_Guns_Rifles.submenu(10, Menu_Guns)
- Menu_Guns_Rifles.settitle("- CT Menu\n-- Våben\n--- Geværer\nPage:")
- Menu_Guns_Rifles.addoption("weapon_ak47", "AK47")
- Menu_Guns_Rifles.addoption("weapon_aug", "AUG")
- Menu_Guns_Rifles.addoption("weapon_famas", "Famas")
- Menu_Guns_Rifles.addoption("weapon_galil", "Galil")
- Menu_Guns_Rifles.addoption("weapon_m4a1", "M4A1")
- Menu_Guns_Rifles.addoption("weapon_sg552", "SG552")
- global Menu_Guns_Others
- Menu_Guns_Others = popuplib.easymenu('Menu_Guns_Others',None, PopupChoiceThingWeapon)
- Menu_Guns_Others.submenu(10, Menu_Guns)
- Menu_Guns_Others.settitle("- CT Menu\n-- Våben\n--- Tilbehør\nPage:")
- Menu_Guns_Others.addoption("weapon_hegrenade","HE Grenade")
- Menu_Guns_Others.addoption("weapon_smokegrenade","Smoke Grenade")
- Menu_Guns_Others.addoption("weapon_flashbang","FlashBang")
- global Menu_Games
- Menu_Games = popuplib.easymenu('Menu_Games',None, PopupChoiceThingGames)
- Menu_Games.submenu(10, Menu_Main)
- Menu_Games.settitle("- CT Menu\n-- Spil\nPage:")
- Menu_Games.addoption("Game1|War","War")
- Menu_Games.addoption("Game2|Gemmeleg","Gemmeleg")
- Menu_Games.addoption("Game3|Barrel Roll","Barrel Roll")
- gamethread.delayed(.01,round_start,'lol')
- global TimeLeft
- TimeLeft = 0
- es.server.queuecmd("mp_restartgame 1")
- def unload():
- gamethread.cancelDelayed('TimeLeftCountDown')
- def PopupChoiceThingWeapon(userid,weapon,popupname):
- if IsDead(userid):
- es.tell(userid,'Du kan ikke få våben mens du er død!')
- return
- if int(userid) not in Data['guns']:
- Data['guns'][int(userid)] = 0
- Data['guns'][int(userid)] += 1
- if Data['guns'][int(userid)] > 1:
- es.tell(userid,'Du kan kun få ét våben per runde!')
- return
- es.server.queuecmd("es_xgive %s %s" %(userid,weapon))
- def PopupChoiceThingGames(userid2,game,popupname):
- GameName = game.split("|")[1]
- game = game.split("|")[0]
- if IsDead(userid2):
- es.tell(userid2,'Du kan ikke bruge denne kommando mens du er død!')
- return
- global currentGame
- if currentGame:
- es.tell(userid2,'Et spil (#%s) er allerede i gang!' %(currentGame))
- return
- if game == 'Game1':
- for PLAYER in playerlib.getPlayerList('#t,#alive'):
- es.entitysetvalue(PLAYER.index, 'origin', ' '.join(leg_1_location_t.split(',')))
- PLAYER.freeze(1)
- for PLAYER in playerlib.getPlayerList('#ct,#alive'):
- es.entitysetvalue(PLAYER.index, 'origin', ' '.join(leg_1_location_ct.split(',')))
- elif game == 'Game2':
- for PLAYER in playerlib.getPlayerList('#ct,#alive'):
- es.server.queuecmd("es_xgive %s %s" %(PLAYER.userid,'weapon_hegrenade'))
- for PLAYER in playerlib.getPlayerList('#ct,#alive'):
- es.entitysetvalue(PLAYER.index, 'origin', ' '.join(leg_2_location_ct.split(',')))
- PLAYER.freeze(1)
- elif game == 'Game3':
- for PLAYER in playerlib.getPlayerList('#ct,#alive'):
- PLAYER.freeze(1)
- Strip(PLAYER.userid)
- PLAYER.setModel('props/de_train/Barrel.mdl')
- es.precachemodel('models/props/de_train/Barrel.mdl')
- File = open(es.getAddonPath('gunandgames')+'/%s.txt' %(es.ServerVar("eventscripts_currentmap")),'r')
- for LINE in File.readlines():
- if random.randint(1,3) < 3:
- INDEX = es.createentity('prop_physics')
- es.entitysetvalue(INDEX, 'model', 'models/props/de_train/Barrel.mdl')
- es.entitysetvalue(INDEX, 'solid', 6)
- es.entitysetvalue(INDEX, 'origin', LINE.replace(",","").replace("(","").replace(")",""))
- es.entitysetvalue(INDEX, "spawnflags", 8)
- es.spawnentity(INDEX)
- File.close()
- else:
- return
- currentGame = int(str(game).replace('Game',''))
- for PLAYER in playerlib.getPlayerList('#alive'):
- PLAYER.noblock(1)
- es.msg('#multi','#darkgreen%s #greenstartede spil #darkgreen#%s#green - #darkgreen%s#green!' %(es.getplayername(userid2),currentGame,GameName))
- def Strip(userid):
- es.give(userid, 'player_weaponstrip')
- es.fire(userid, 'player_weaponstrip', 'strip')
- es.fire(userid, 'player_weaponstrip', 'kill')
- def PopupChoiceThing(userid,choice,popupname):
- if IsDead(userid):
- es.tell(userid,'Du kan ikke bruge denne menu mens du er død!')
- return
- if choice == 'Pistols': Menu_Guns_Pistols.send(userid)
- if choice == 'Rifles': Menu_Guns_Rifles.send(userid)
- if choice == 'Others': Menu_Guns_Others.send(userid)
- if choice == 'gamesMenu':
- if currentGame:
- es.tell(userid,'Et spil (#%s) er allerede i gang!' %(currentGame))
- return
- Menu_Games.send(userid)
- if choice == 'gunsMenu':
- if int(userid) not in Data['guns']:
- Data['guns'][int(userid)] = 0
- if Data['guns'][int(userid)] > 0:
- es.tell(userid,'Du kan kun få ét våben per runde!')
- return
- Menu_Guns.send(userid)
- def player_spawn(ev):
- Data['guns'][int(ev['userid'])] = 0
- def player_say(ev):
- message = ev['text'].lower()
- userid = ev['userid']
- team = int(ev['es_userteam'])
- if message == _CMD:
- if team == 3:
- if IsDead(userid):
- es.tell(userid,'Du kan ikke bruge denne menu mens du er død!')
- return
- Menu_Main.send(userid)
- else:
- es.tell(userid,'Denne kommando er kun for CTere')
- def item_pickup(ev):
- global currentGame
- if currentGame == 2:
- if int(ev['es_userteam']) == 2:
- if ev['item'] != 'weapon_hegrenade':
- Strip(ev['userid'])
- es.server.queuecmd("es_xgive %s %s" %(ev['userid'],'weapon_hegrenade'))
- if currentGame == 3:
- if int(ev['es_userteam']) == 3:
- Strip(ev['userid'])
- def round_start(ev):
- global currentGame
- currentGame = 0
- global TimeLeft
- TimeLeft = int(es.ServerVar("mp_roundtime")) * 60 + int(es.ServerVar("mp_freezetime"))
- gamethread.cancelDelayed('TimeLeftCountDown')
- gamethread.delayedname(1,'TimeLeftCountDown',TimeLeftCountDown)
- def TimeLeftCountDown():
- global TimeLeft
- gamethread.cancelDelayed('TimeLeftCountDown')
- gamethread.delayedname(1,'TimeLeftCountDown',TimeLeftCountDown)
- TimeLeft -= 1
- if currentGame == 1:
- if TimeLeft < 8 * 60 + 1:
- for PLAYER in playerlib.getPlayerList('#t,#alive'):
- PLAYER.freeze(0)
- gamethread.cancelDelayed('TimeLeftCountDown')
- if currentGame == 2:
- if TimeLeft < 8 * 60 + 1:
- for PLAYER in playerlib.getPlayerList('#ct,#alive'):
- PLAYER.freeze(0)
- gamethread.cancelDelayed('TimeLeftCountDown')
- if currentGame == 3:
- if TimeLeft < 4 * 60 + 1:
- if int(es.getplayercount(3)) > 0:
- es.msg("Terroristerne nåede ikke at dræbe alle Counter-Terroristerne!")
- for PLAYER in playerlib.getPlayerList('#t,#alive'):
- PLAYER.kill()
- for PLAYER in playerlib.getPlayerList('#ct,#alive'):
- PLAYER.freeze(0)
- gamethread.cancelDelayed('TimeLeftCountDown')
- def IsDead(userid):
- if not es.exists('userid',userid): return 0
- if int(es.getplayerteam(userid)) not in [2,3]: return 0
- return playerlib.getPlayer(userid).isdead
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement