• Add Weapon to Inventory
    11 replies, posted
Hey Folks, I'm mind blocking myself right now. I try to give a player a an item in there PS2 Inventory over Prometheus. The thing is i want it to be only once after purchase. I tried to get it over the "actions" option and the "command" one. actions like this: Prometheus.Temp.Ply:PS_AddItem("itemname") and i tryed it with the ulx ranlua command. Does anyone have a simpler or more efficient solution?
What do you mean with "only once after purchase"? Also, the only function I found for Pointshop 2 to give a player an item is player:PS2_EasyAddItem( class ).
Thats why i wrote in prometheus. It has the option to execute an Console command or an action (lua script) once someone purchase a preconfiguerd pack.
It might be me but I am having a hard time to understand what exactly your question/problem is. Doesn't it work or do you just want a different solution?
I would use the player:PS2_EasyAddItem( class ). syntax but i always get a ni value out if i try to use it. I just need a solution that can put an Weapon like an AUG automaticly in a player inventory
What do you mean with "I always get a nil value". This function should not return anything. Maybe the class is wrong. I recommend this documentation. Show me what you got atm.
Prometheus.Temp.Ply:PS2_EasyAddItem( "Weapon_Dropmarker" ) is my function. Prometheus.Temp.Ply is a variable of mine that returns a Steam player name. The rest should work like in the doc or not? The console always returns allways an error massage that the item class is not viable. The rest of the parameters are optional. my thougt was that that it can't accsess my mysql database for the player inventory but there is only a part for the player wallet that discribes how to get at the values
If Prometheus.Temp.Ply is a variable representing a steam name you're going to run into if you're trying to run functions as if it were a player. I could've horribly misunderstood here but just like CupCake I find it slightly difficult to understand what's going on here.
To be clear: Prometheus is a script that provides an webinterface for selling ranks and stuff. the important thing is that it has an option to run a lua script at the time a packet is bought. In my understanding the so called "actions" are capeable of straight forward lua. this is the message im getting : [Prometheus error at 19:51:41 - 19/12/2018] Error while running RUN custom action for player: TVP1 - Mirron{STEAM_0:0:42453116} Error message: Custom_action_90_for_TVP1 - Mirron:3: attempt to call method 'PS2_EasyAddItem' (a nil value)
PS2_EasyAddItem isn't a viable function for the Prometheus.Temp.Ply variable. I'm not familiar with how Prometheus works but if the variable in question is the steam name of a player in the form of a string as you seemed to suggest before then that would cause this issue. If on the other hand it's the player which is that you should be using here it means the PS2_EasyAddItem function most likely doesn't exist and you should take a look at your pointshop addon.
i finaly got it: unction GiveItemByPrintName( ply, printName ) local itemClass = Pointshop2.GetItemClassByPrintName( printName ) if not itemClass then error( "Invalid item " .. tostring( printName ) ) end return Prometheus.Temp.Ply:PS2_EasyAddItem( itemClass.className ) end GiveItemByPrintName( player.GetByID( 1 ), "Marker" ) It adds an item with the name "marker" to the player inv in ps2. suitable as prometheus action
Does this actually work though? It looks like a mess and seems as if it would break things. Also seeing as you were having trouble with the PS2_EasyAddItem function not existing as a method for Prometheus.Temp.Ply I really don't see how this fixes it. But oh well.
Sorry, you need to Log In to post a reply to this thread.