Jump to content

Buy a gun with a coin. Help me


Recommended Posts

Hello friends

I'm new and I do not know much.
I want some tips
1-I downloaded this coin script from this link: https://tinyurl.com/y5mqbsmn

2- And I downloaded the gun store script: https://tinyurl.com/y3lvw6wc

My friends want the players to buy some weapons from the gun just through the coin.
If anyone knows how to change the price of the store guns for coins.
If you know a script that can help me, please guide.

I'm sorry my English is Poor.

Very Thanks.

Link to comment

Hy, change this in the gun store server sided script file:
 

 addEvent( "BuyW", true)
addEventHandler( "BuyW", getRootElement(),
function ( tPM , gWA, wID )
local PlayerMoney = getPlayerMoney(source)
	if PlayerMoney >= tPM then
	giveWeapon (source, wID, gWA )
	takePlayerMoney(source, tPM)
	setPedWeaponSlot(source, getSlotFromWeapon(tonumber(wID)))
	outputChatBox ( "#FFFF1A*** You Bought Weapon By : "..tonumber(tPM).."$   ***", source, 255, 0, 0, true )
	else
    outputChatBox("you don't have $"..tonumber(tPM).." to buy This Weapon !", source, 255, 0, 0)	
	end
end)

to this:
 

 addEvent( "BuyW", true)
addEventHandler( "BuyW", getRootElement(),
function ( tPM , gWA, wID )
	local data = getElementData(source, "moneycoins");
    thePoints = tonumber(data);
	if thePoints >= tPM then
	giveWeapon (source, wID, gWA )
	setElementData(source, "moneycoins", data-tPM)
	setPedWeaponSlot(source, getSlotFromWeapon(tonumber(wID)))
	outputChatBox ( "#FFFF1A*** You Bought Weapon By : "..tonumber(tPM).."$   ***", source, 255, 0, 0, true )
	else
    outputChatBox("you don't have $"..tonumber(tPM).." to buy This Weapon !", source, 255, 0, 0)	
	end
end)

 

Link to comment
53 minutes ago, Jalapeno said:

Hy, change this in the gun store server sided script file:
  


 addEvent( "BuyW", true)
addEventHandler( "BuyW", getRootElement(),
function ( tPM , gWA, wID )
local PlayerMoney = getPlayerMoney(source)
	if PlayerMoney >= tPM then
	giveWeapon (source, wID, gWA )
	takePlayerMoney(source, tPM)
	setPedWeaponSlot(source, getSlotFromWeapon(tonumber(wID)))
	outputChatBox ( "#FFFF1A*** You Bought Weapon By : "..tonumber(tPM).."$   ***", source, 255, 0, 0, true )
	else
    outputChatBox("you don't have $"..tonumber(tPM).." to buy This Weapon !", source, 255, 0, 0)	
	end
end)

to this:
 


 addEvent( "BuyW", true)
addEventHandler( "BuyW", getRootElement(),
function ( tPM , gWA, wID )
	local data = getElementData(source, "moneycoins");
    thePoints = tonumber(data);
	if thePoints >= tPM then
	giveWeapon (source, wID, gWA )
	setElementData(source, "moneycoins", data-tPM)
	setPedWeaponSlot(source, getSlotFromWeapon(tonumber(wID)))
	outputChatBox ( "#FFFF1A*** You Bought Weapon By : "..tonumber(tPM).."$   ***", source, 255, 0, 0, true )
	else
    outputChatBox("you don't have $"..tonumber(tPM).." to buy This Weapon !", source, 255, 0, 0)	
	end
end)

 

Very Thanks @Jalapeno
Worked well.
But I want some weapons to change for Coin, not all of them.
Now the price of all the weapons has changed to the coin, but I want to change some weapons to coins.

please guide me
Thanks

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...