Skip to content

Instantly share code, notes, and snippets.

Valentin Funk Kamshak

Block or report user

Report or block Kamshak

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Kamshak
Kamshak / 0Guide.MD
Last active Mar 24, 2018
Making Customizable Weaponry 2.0 Attachments work with Pointshop 2 Tutorial. Full Code: https://github.com/Kamshak/ps2-customizable-weaponry
View 0Guide.MD

Generating Pointshop 2 Items programatically

The goal here is to integrate an external system into Pointshop 2 by using items. Since they are already created we only need to map them to PS2 items. For this example Attachments for Customizable Weaponry 2 are used. CW2 offers a system where players can pick attachments in a menu. Players can only pick attachments that they own.

  1. Players should be able to buy attachments in Pointshop2
  2. Players should be given all attachments they own in Pointshop2 so that CW can pick them up
  3. It should be possible to set the price for the attachments individually
@Kamshak
Kamshak / action.lua
Created Feb 21, 2018
Prometheus Action for increasing player's pointshop 2 inventory size (slots)
View action.lua
Pointshop2.DB.DoQuery(Format("UPDATE inventories SET numSlots = numSlots + 40 WHERE ownerId = (SELECT id FROM libk_player WHERE player = %s)", Prometheus.Temp.SteamID))
Prometheus.Temp.Ply.fullyLoadedPromise:Then(function() Pointshop2Controller:initializeInventory(Prometheus.Temp.Ply))
@Kamshak
Kamshak / cl_myview.lua
Last active Feb 20, 2018
LibK Networking
View cl_myview.lua
MyView = class( "MyView" )
MyView:include( BaseView )
-- Set the controller to use
MyView.static.controller = "MyController"
function MyView:OnMapChanged(map)
hook.Run("ServerMapChanged", map)
-- This is a useful pattern for derma updating:
--[[
function PANEL:Init()
View gist:ed70170f5530cd7d4ca78edd9305c77e
import sqlite3
from optparse import OptionParser
ps2Tables = [
"libk_player",
"ps2_itemexpiration",
"ps2_settings",
"ps2_plyjoinstreak",
"ps2_wallet",
"ps2_itempersistence",
@Kamshak
Kamshak / Guide.md
Last active Jun 13, 2018
Bind to F6. Put in lua/autorun
View Guide.md

Binding Pointshop 2 to a key other than F1-F3

Put this script into lua/autorun. You can change KEY_F6 to any other key, for a list of keys look here: List of Keys - Gmod Wiki

@Kamshak
Kamshak / sv_ps2_knifepoints.lua
Last active Feb 12, 2018
Give extra points on knife kill (Pointshop 2). Create the file below in garrysmod/lua/autorun
View sv_ps2_knifepoints.lua
local ptsMap = {
["csgo_bayonet"] = 10,
others = 5
}
hook.Add( "PlayerDeath", "ExtraPointsForKnifeKill", function( victim, inflictor, attacker )
if not IsValid( inflictor ) or not IsValid( attacker ) or not attacker:IsPlayer( ) then
return
end
@Kamshak
Kamshak / user.service.ts
Created Feb 2, 2018
Firebase Universal Example
View user.service.ts
@Injectable()
export class UserService {
constructor(private db: AngularFireDatabase, private zone: NgZone) {}
getUser(id: string | number): Observable<User> {
const user$ = this.database.object('profiles/' + id);
this.universalBlockUntilFirst(user$);
return user$;
}
@Kamshak
Kamshak / cl_playermodel.lua
Last active Jan 30, 2018
Put this in Pointshop2/lua/ps2/modules/mu_integration/cl_playermodel.lua
View cl_playermodel.lua
hook.Add("PS2_GetPreviewModel", "ForMurder", function()
if GAMEMODE.Spectating then
return {
model = player_manager.TranslatePlayerModel("male03"),
bodygroups = "0",
skin = 0
}
end
end)
@Kamshak
Kamshak / Dockerfile
Created Jan 30, 2018
Dockerfile for firebase bug
View Dockerfile
FROM node:6.11-slim
RUN yarn global add firebase-tools
RUN mkdir app
WORKDIR /app
RUN mkdir functions
COPY functions/package.json functions/package.json
RUN cd functions && yarn
COPY . .
View itemfromcategoryfactory.lua
local function generateStattrakItemInfo( itemClass, itemChance )
local info = {
chance = itemChance * 0.1, -- 10% chance of original item = get stattrak item
itemOrInfo = {
isInfoTable = true,
item = itemClass,
getIcon = function()
local icon = vgui.Create("DCsgoItemIcon")
icon:SetItemClass(itemClass)
-- Force border to red
You can’t perform that action at this time.