MGO Posted October 1, 2023 Share Posted October 1, 2023 So I'm making this resource for an RP server that will take an item from the player's inventory and give him another item instead. so I used this addEvent("GivetoPlayer", true) addEventHandler("GivetoPlayer", root, function() exports.global:giveItem(client, 33, 10) outputChatBox("#ffffff[ #FC861DDrug-System#ffffff ] : You harvested 10 grams of Unprocessed PCP.",source,255,255,255,true) end ) exports.global:giveItem(client, 33, 10) So I'm making this resource for an RP server that will take an item from the player's inventory and give him another item instead. so I used this addEvent("GivetoPlayer", true) addEventHandler("GivetoPlayer", root, function() exports.global:giveItem(client, 33, 10) exports.global:giveItem(client, 33, 10) outputChatBox("#ffffff[ #FC861DDrug-System#ffffff ] : You harvested 10 grams of Unprocessed PCP.",source,255,255,255,true) end ) so the script does indeed give the item 2 to the player but idk why it won't remove the item 1 from the player's inventory So I'm making this resource for an RP server that will take an item from the player's inventory and give him another item instead. so I used this addEvent("GivetoPlayer", true) addEventHandler("GivetoPlayer", root, function() exports.global:takeItem(client, 33, 1) exports.global:giveItem(client, 33, 10) outputChatBox("#ffffff[ #FC861DDrug-System#ffffff ] : You got 10.",source,255,255,255,true) end ) so the script does indeed give the item 2 to the player but idk why it won't remove the item 1 from the player's inventory Link to comment
5150 Posted October 3, 2023 Share Posted October 3, 2023 first, this code isnt formatted using the LUA code formatting and its very hard to read. But otherwise, it looks like you're only taking a value of one cigarette away from the player. remove the '1' from takeitem and it should work (i think, i havent tested it). If not, I'd have to look further into it Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now