Hi New here

A place for requesting new Source.Python plugins to be made for your server.

Please request only one plugin per thread.
donkeyman
Junior Member
Posts: 18
Joined: Mon Nov 06, 2017 8:43 pm

Hi New here

Postby donkeyman » Mon Nov 06, 2017 8:46 pm

Hi . I am wondering if it is possible to make gunmenu on server side?
very cool site.
D
User avatar
L'In20Cible
Project Leader
Posts: 1044
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Hi New here

Postby L'In20Cible » Tue Nov 07, 2017 2:15 am

Welcome to the forums!

What kind of gunmenu?
donkeyman
Junior Member
Posts: 18
Joined: Mon Nov 06, 2017 8:43 pm

Re: Hi New here

Postby donkeyman » Tue Nov 07, 2017 1:09 pm

Thankyou! I am looking for Gunmenu for Css. I want to be able to chose a primary list and a Secondary list.
Id also like to be able to spawn with equipment. I use a plug that does all this but the problem is when you pick up ak and your spawn is set for M4a1
the ak is stripped at next round.I want to be able to keep weapons you pick up.
D
User avatar
satoon101
Project Leader
Posts: 2533
Joined: Sat Jul 07, 2012 1:59 am

Re: Hi New here

Postby satoon101 » Tue Nov 07, 2017 5:11 pm

Yes, this is all certainly possible. Are you wanting someone to create this for you or are you looking for assistance in learning to create this yourself?
Image
donkeyman
Junior Member
Posts: 18
Joined: Mon Nov 06, 2017 8:43 pm

Re: Hi New here

Postby donkeyman » Tue Nov 07, 2017 7:24 pm

I am looking for someone to make one for me..thanks
D
This is server side also
User avatar
satoon101
Project Leader
Posts: 2533
Joined: Sat Jul 07, 2012 1:59 am

Re: Hi New here

Postby satoon101 » Tue Nov 07, 2017 10:46 pm

Moved to the appropriate forum.
Image
User avatar
Ayuto
Project Leader
Posts: 1824
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Hi New here

Postby Ayuto » Fri Nov 10, 2017 5:13 pm

Something like this?

Syntax: Select all

# ==============================================================================
# >> IMPORTS
# ==============================================================================
from players.entity import Player
from players.dictionary import PlayerDictionary
from menus import PagedMenu
from menus import PagedOption
from commands.say import SayCommand
from events import Event


# ==============================================================================
# >> CONSTANTS/CONFIG
# ==============================================================================
# <display name>: <classname>
PRIMARY_WEAPONS = [
('Maverick M4A1 Carbine', 'weapon_m4a1'),
('AK47', 'weapon_ak47'),
('Schmidt Scout', 'weapon_scout'),
('Krieg 552', 'weapon_sg552'),
('IDF Defender', 'weapon_galil'),
('FAMAS', 'weapon_famas'),
('Bullpup', 'weapon_aug'),
('M249-SAW', 'weapon_m249'),
('KM UMP45', 'weapon_ump45'),
('MP5 Navy', 'weapon_mp5navy'),
('Leone 12 Gauge Super', 'weapon_m3'),
('Leone YG1265 Auto Shotgun', 'weapon_xm1014'),
('Schmidt Machine Pistol', 'weapon_tmp'),
('Ingram Mac-10', 'weapon_mac10'),
('ES C90', 'weapon_p90')
]

SECONDARY_WEAPONS = [
('USP Tactical', 'weapon_usp'),
('Glock', 'weapon_glock'),
('Desert Eagle', 'weapon_deagle'),
('P228', 'weapon_p228'),
('Dual 96G Elite Berettas', 'weapon_elite'),
('ES Five Seven', 'weapon_fiveseven'),
]

# Commands that open the weapon menu
WEAPON_COMMANDS = [
'!weapons',
'!guns',
]

# Health amount to give (0 to use default from game/other plugin)
HEALTH = 0

# Armor amount to give
ARMOR = 100

# Whether to give a helmet. If you want to disable armor, you must
# set this to "False" as well as setting armor to 0.
HELMET = True

# Whether to give flashbangs
FLASHBANGS = True

# Whether to give a smoke grenade
SMOKEGRENADE = False

# Whether to give an HE grenade
HEGRENADE = True

# Whether to give defusekits to CTs
DEFUSE_KITS = True


# ==============================================================================
# >> GLOBAL VARIABLES
# ==============================================================================
primary_menu = PagedMenu(
list(PagedOption(x, y) for x, y in PRIMARY_WEAPONS),
title='Choose a primary weapon'
)

secondary_menu = PagedMenu(
list(PagedOption(x, y) for x, y in SECONDARY_WEAPONS),
title='Choose a secondary weapon'
)


# ==============================================================================
# >> CLASSES
# ==============================================================================
class PlayerWeapons(object):
def __init__(self, index):
self.player = Player(index)
self.primary = None
self.secondary = None

player_weapons = PlayerDictionary(PlayerWeapons)


# ==============================================================================
# >> CALLBACKS
# ==============================================================================
@primary_menu.register_select_callback
def on_primary_menu_select(menu, index, option):
weapons = player_weapons[index]
player = weapons.player
for weapon in player.weapons(is_filters='primary'):
weapon.remove()

weapons.primary = option.value
player.give_named_item(option.value)

@secondary_menu.register_select_callback
def on_secondary_menu_select(menu, index, option):
weapons = player_weapons[index]
player = weapons.player
for weapon in player.weapons(is_filters='secondary'):
weapon.remove()

weapons.secondary = option.value
player.give_named_item(option.value)


# ==============================================================================
# >> COMMANDS
# ==============================================================================
@SayCommand(WEAPON_COMMANDS)
def on_weapons(command, index, team_only):
primary_menu.send(index)
secondary_menu.send(index)


# ==============================================================================
# >> EVENTS
# ==============================================================================
@Event('player_spawn')
def on_player_spawn(event):
weapons = player_weapons.from_userid(event['userid'])
player = weapons.player
if HEALTH != 0:
player.health += HEALTH

player.armor = ARMOR

if HELMET:
player.has_helmet = HELMET

if FLASHBANGS:
if player.get_projectile_ammo('flashbang') == 0:
player.give_named_item('weapon_flashbang')

player.set_projectile_ammo('flashbang', 2)

if SMOKEGRENADE and player.get_projectile_ammo('smokegrenade') == 0:
player.give_named_item('weapon_smokegrenade')

if HEGRENADE and player.get_projectile_ammo('hegrenade') == 0:
player.give_named_item('weapon_hegrenade')

if DEFUSE_KITS:
player.has_defuser = True

if weapons.primary is not None and player.primary is None:
player.give_named_item(weapons.primary)

if weapons.secondary is not None and player.secondary is None:
player.give_named_item(weapons.secondary)
donkeyman
Junior Member
Posts: 18
Joined: Mon Nov 06, 2017 8:43 pm

Re: Hi New here

Postby donkeyman » Sat Nov 11, 2017 12:08 am

what you have looks great. Id like to have menu of all weapons. Almost like a gun game menu.
Here is menu I am using at this time however it takes guns away from you on new spawn.I want to be able to keep weapon you pick up.
It also has spawn items.
Thanks.


"Gun Menu Config"
{
"Settings"
{
// Sound to play when player scores
"frag_sound" "buttons/bell1.wav"

// Allow players to have C4 bomb
"allow_c4" "yes"

// Allow buy zones on map
"buy_zones" "yes"

// Allow players to keep weapons
"keep_weapons" "yes"
}

"SpawnItems"
{
// Health amount to give (0 to use default from game/other plugin)
"health" "0"

// Armor amount to give
"armor" "100"

// Whether to give a helmet. If you want to disable armor, you must
// set this to "no" as well as setting armor to 0.
"helmet" "yes"

// Whether to give flashbangs
"flashbangs" "yes"

// Whether to give a smoke grenade
"smokegrenade" "no"

// Whether to give an HE grenade
"hegrenade" "yes"

// Whether to give defusekits to CTs
"defusekits" "yes"

}

"PrimaryMenu"
{
"weapon_m4a1" "Maverick M4A1 Carbine"
"weapon_ak47" "AK47"
"weapon_scout" "Schmidt Scout "
"weapon_sg552" "Krieg 552"
"weapon_galil" "IDF Defender"
"weapon_famas" "FAMAS"
"weapon_aug" "Bullpup"
"weapon_m249" "M249-SAW"
"weapon_ump45" "KM UMP45"
"weapon_mp5navy" "MP5 Navy"
"weapon_m3" "Leone 12 Gauge Super"
"weapon_xm1014" "Leone YG1265 Auto Shotgun"
"weapon_tmp" "Schmidt Machine Pistol"
"weapon_mac10" "Ingram Mac-10"
"weapon_p90" "ES C90"
}

"SecondaryMenu"
{
"weapon_usp" "USP Tactical"
"weapon_glock" "Glock"
"weapon_deagle" "Desert Eagle"
"weapon_p228" "P228"
"weapon_elite" "Dual 96G Elite Berettas"
"weapon_fiveseven" "ES Five Seven"
}
}
User avatar
Ayuto
Project Leader
Posts: 1824
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Hi New here

Postby Ayuto » Sat Nov 11, 2017 10:21 am

I have updated the code in my previous post.
donkeyman
Junior Member
Posts: 18
Joined: Mon Nov 06, 2017 8:43 pm

Re: Hi New here

Postby donkeyman » Sat Nov 11, 2017 5:38 pm

Hi do I make your code into a smx plug now ? how do I install server side?
User avatar
Ayuto
Project Leader
Posts: 1824
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Hi New here

Postby Ayuto » Sat Nov 11, 2017 5:59 pm

This is Source.Python, not SourceMod. So, this has nothing to do with SMX files (they are for SourceMod).

To install my snippet please do the following steps:
  • Create a new folder (e.g. gun_menu) in ../addons/source-python/plugins.
  • Create a new py-file inside of the created folder. The file must have the same name like the folder (e.g. gun_menu.py).
  • Copy the snippet into the file and save it.
  • Load it with: sp plugin load gun_menu
donkeyman
Junior Member
Posts: 18
Joined: Mon Nov 06, 2017 8:43 pm

Re: Hi New here

Postby donkeyman » Sat Nov 11, 2017 8:15 pm

First id like to say thankyou.
Second Am I creating a new folder called source-python inside addonsbwith plugin folderinside ?
I use source mod for several things in server . will this cause an issues?
User avatar
Ayuto
Project Leader
Posts: 1824
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Hi New here

Postby Ayuto » Sat Nov 11, 2017 8:26 pm

Well, you need to install Source.Python at first:
http://wiki.sourcepython.com/general/installation.html

SourceMod and Source.Python can run on the same server. The only (known) issue that can occur is described here:
https://github.com/Source-Python-Dev-Te ... issues/108

A workaround is also provided.
donkeyman
Junior Member
Posts: 18
Joined: Mon Nov 06, 2017 8:43 pm

Re: Hi New here

Postby donkeyman » Sat Nov 11, 2017 8:32 pm

so I made gun_menu folder in ../addons/source-python/plugins. I added the save code you made on notepad and called it gun_menu.py I saved it but I'm not sure what format you wanted me to. I am a little confused on Load it with: sp plugin load gun_menu.I put load gun menu in console and got this message.
load gun_menu
Can't load in multiplayer games.
I'm sorry I am clueless with this stuff.
D
User avatar
Ayuto
Project Leader
Posts: 1824
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Hi New here

Postby Ayuto » Sat Nov 11, 2017 8:41 pm

Just enter sp plugin load gun_menu in the server console or put it into your autoexec.cfg.
donkeyman
Junior Member
Posts: 18
Joined: Mon Nov 06, 2017 8:43 pm

Re: Hi New here

Postby donkeyman » Sat Nov 11, 2017 8:43 pm

I'm trying to install source python right now . thanks
I will update u :)
donkeyman
Junior Member
Posts: 18
Joined: Mon Nov 06, 2017 8:43 pm

Re: Hi New here

Postby donkeyman » Sat Nov 11, 2017 9:24 pm

sp plugin load gun_menu will not load menu. I installed
http://wiki.sourcepython.com/general/installation.html
in console I entered

] plugin_print
Loaded plugins:
---------------------
---------------------
-----------------
] sp_version
Unknown command: sp_version

] sp plugin load gun_menu
Unknown command: sp


I am using gameservers. I believe its a Linux server
donkeyman
Junior Member
Posts: 18
Joined: Mon Nov 06, 2017 8:43 pm

Re: Hi New here

Postby donkeyman » Sat Nov 11, 2017 9:25 pm

this is a test server if u want to look at the ftp of server
User avatar
Ayuto
Project Leader
Posts: 1824
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: Hi New here

Postby Ayuto » Sat Nov 11, 2017 9:27 pm

What's the output of the server console?
donkeyman
Junior Member
Posts: 18
Joined: Mon Nov 06, 2017 8:43 pm

Re: Hi New here

Postby donkeyman » Sat Nov 11, 2017 9:29 pm

I am not sure what that means?

Return to “Plugin Requests”

Who is online

Users browsing this forum: No registered users and 2 guests