Git Product home page Git Product logo

cw-prints's Introduction

cw-prints ๐Ÿ–จ

This script enables player created business cards. Comes with a warp to an interior but this can easily be ignored if you want to use it in any other fashion. Easilyconfigured in the Config.Lua. In the future we plan to make it support any type of printable item (flyers etc)

Preview ๐Ÿ“ฝ

YOUTUBE VIDEO

Developed by Coffeelot and Wuggie

More scripts by us ๐Ÿ‘ˆ

Support, updates and script previews:

Join The discord!

All our scripts are and will remain free. If you want to support what we do, you can buy us a coffee here:

Buy Us a Coffee

Config ๐Ÿ”ง

JobIsRequired: Set to true if you want to lock this behind a job. Default isfalse
AllowedJob: The job you want to be able to use it. Only needed if JobIsRequired istrue
Locations: Vectors for the warps and the interaction point
Texts: Strings for the interaction point
Item: The item that is created and added to your inventory
Cost: Cost per card\

Changing interaction shake

If you don't want to use the current warp and interior then all you need to do is add this event to wherever you want to call it: "cw-prints:client:openInteraction" This will open the interaction menu for the script.

Add to qb-core โ—

Items to add to qb-core>shared>items.lua if you want to used the included item

NOTE: Currently the field ["unique"] is set to true on all objects. This means after you get the initial stack, if you split it you can't restack again! Change these to false if you rather want them to stack but risk losing some, as stacking different kinds will make them all one of a kind.

Basically: false:

  • can restack
  • will overwrite if placed in stack with different ones

true:

  • Wont overwrite
  • can't restack
["business_card"] 					 = {["name"] ="business_card", 			  	  		["label"] = "A business card", 			["weight"] = 0, 		["type"] = "item", 		["image"] = "bctest.png", 			["unique"] = true,	 	["useable"] = true,			["created"] = nil,		["decay"] =nil, 	["shouldClose"] = false, ["combinable"] = nil,   ["description"] = "A businesscard"},
["coupon"] 					 = {["name"] = "coupon", 			  	  		["label"] ="Coupon", 				["weight"] = 0, 		["type"] = "item", 		["image"] ="coupon.png", 				["unique"] = true,	 	["useable"] = true,		["created"] = nil,		["decay"] = nil, 	["shouldClose"] = false, ["combinable"] =nil,   ["description"] = "A Coupon"},
["flyer"] 					 = {["name"] = "flyer", 			  	  		["label"] ="Flyer", 				["weight"] = 0, 		["type"] = "item", 		["image"] ="flyer.png", 				["unique"] = true,	 	["useable"] = true,		["created"] = nil,		["decay"] = nil, 	["shouldClose"] = false, ["combinable"] =nil,   ["description"] = "A Flyer"},
["menu"] 					 = {["name"] = "menu", 			  	  		["label"] ="Menu", 				["weight"] = 0, 		["type"] = "item", 		["image"] ="menu.png", 				["unique"] = true,	 	["useable"] = true,		["created"] = nil,		["decay"] = nil, 	["shouldClose"] = false, ["combinable"] =nil,   ["description"] = "A Menu"}
["book"] 					 = {["name"] = "book", 			  	  		["label"] = "Book", 				["weight"] = 0, 		["type"] = "item", 		["image"] = "book.png", 				["unique"] = true,	 	["useable"] = true,			["created"] = nil,		["decay"] = nil, 	["shouldClose"] = false, ["combinable"] = nil,   ["description"] = "A book"},
["newspaper"] 					 = {["name"] = "newspaper", 			  	  		["label"] = "newspaper", 				["weight"] = 0, 		["type"] = "item", 		["image"] = "newspaper.png", 				["unique"] = true,	 	["useable"] = true,			["created"] = nil,		["decay"] = nil, 	["shouldClose"] = false, ["combinable"] = nil,   ["description"] = "A newspaper"},

Also make sure the images are in qb-inventory>html>images

Adding print actions (to instantly give items) to QB-radialmenu:

If you want to have the options to hand over business cards etc to nearest player then add this where you want it in the config.lua for qb-radialmenu (suggestion: after interactions, at line 95 for us at least). Any new item you add to the config.lua for cw-prints needs to be added here also if you want it to show up. Just set the id to the same thing as what you name your item and it should work!

{
    id = 'prints',
    title = 'Prints',
    icon = 'address-card',
    items = {
        {
            id = 'business_card',
            title = 'Give Business Card',
            icon = 'address-card',
            type = 'client',
            event = 'cw-prints:client:GivePrint',
            shouldClose = true
        }, {
            id = 'flyer',
            title = 'Give Flyer',
            icon = 'scroll',
            type = 'client',
            event = 'cw-prints:client:GivePrint',
            shouldClose = true
        }, {
            id = 'coupon',
            title = 'Give Coupon',
            icon = 'percent',
            type = 'client',
            event = 'cw-prints:client:GivePrint',
            shouldClose = true
        }, {
            id = 'menu',
            title = 'Give Menu',
            icon = 'file-alt',
            type = 'client',
            event = 'cw-prints:client:GivePrint',
            shouldClose = true
        }
    }
}

Adding text to QB-inventory

If you want to make the bussiness name show up in QB-Inventory: Open app.js in qb-inventory. In the function FormatItemInfo you will find several if statements. Head to the bottom of these and add this before the second to last else statement (after the else if that has itemData.name == "labkey"). Then add this between them:

else if (itemData.name == "coupon" || itemData.name == "business_card" || itemData.name == "flyer") {
            $(".item-info-title").html("<p>" + itemData.label + "</p>");
            $(".item-info-description").html("<p>Business: " + itemData.info.business + "</p>");
        }

Adding text to Ox_Inventory

Kudos to Khatrie for this ๐Ÿ™ If you want to use ox_inventory you can toggle it in the Config.Lua. Simply set Config.Inv to 'ox' if you want to use that rather than qb-inventory!

Dependencies

cw-prints's People

Contributors

coffeelot avatar khatrie avatar mrfrostdev avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.