Jump to content

Team weapon shop


Xwad

Recommended Posts

its a cool script i made 2 maerker and i replaced the guns and it works. But i have a problem when i passed over the marker then there i cant buy the shotgun i click on it and nothing happens. The other weapons works only the shotgun has error. here is the code :

Client.lua

local marker = createMarker(222.2, 1866.1, 13.1,"cylinder",2.0,0,255,0,255)

function draw()

base = dxDrawRectangle(358, 185, 456, 385, tocolor(1, 3, 0, 150), false)

dxDrawLine(358, 445, 811, 445, tocolor(255, 255, 255, 255), 1, false)

dxDrawText("Weapon Shop", 462, 195, 709, 241, tocolor(0, 255, 0, 255), 1.50, "pricedown", "left", "top", false, false, false, false, false)

dxDrawText("Weapon Shop By Shaman\nCopyright By Shaman 2015", 363, 466, 522, 556, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)

dxDrawText("Close", 700, 518, 825, 562, tocolor(255, 255, 255, 255), 1.30, "pricedown", "left", "top", false, false, false, false, false)

dxDrawText("Browning", 377, 297, 487, 347, tocolor(255, 255, 255, 255), 1.30, "pricedown", "left", "top", false, false, false, false, false)

dxDrawText("Bazooka", 545, 300, 657, 344, tocolor(255, 255, 255, 255), 1.30, "pricedown", "left", "top", false, false, false, false, false)

dxDrawText("Shotgun", 701, 300, 825, 347, tocolor(255, 255, 255, 255), 1.10, "pricedown", "left", "top", false, false, false, false, false)

dxDrawText("Colt 1911", 373, 379, 483, 429, tocolor(255, 255, 255, 255), 1.30, "pricedown", "left", "top", false, false, false, false, false)

dxDrawText("Thompson", 547, 379, 657, 429, tocolor(255, 255, 255, 255), 1.30, "pricedown", "left", "top", false, false, false, false, false)

dxDrawText("Sniper", 701, 379, 811, 429, tocolor(255, 255, 255, 255), 1.30, "pricedown", "left", "top", false, false, false, false, false)

dxDrawText("Cost-2000$", 387, 342, 482, 357, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)

dxDrawText("Cost-2000$", 552, 342, 647, 357, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)

dxDrawText("Cost-850$", 716, 342, 811, 357, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)

dxDrawText("Cost-2000$", 387, 424, 482, 439, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)

dxDrawText("Cost-2000$", 547, 424, 642, 439, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)

dxDrawText("Cost-2000$", 716, 424, 811, 439, tocolor(255, 255, 255, 255), 1.00, "default-bold", "left", "top", false, false, false, false, false)

showcursor (true)

end

button = guiCreateButton(532, 294, 105, 42, "Shotgun-1800$", true)

button2 = guiCreateButton(368, 294, 105, 42, "Browning-6000$", false)

button3 = guiCreateButton(699, 294, 105, 42, "rocketlauncher-3500$", false)

button4 = guiCreateButton(368, 380, 105, 42, "Colt 1911-500$", false)

button5 = guiCreateButton(532, 380, 105, 42, "Thompson-2800$", false)

button6 = guiCreateButton(699, 380, 105, 42, "Sniper-3500$", false)

button7 = guiCreateButton(691, 523, 110, 37, "Close", false)

guiSetVisible(button2, false)

guiSetVisible(button3, false)

guiSetVisible(button4, false)

guiSetVisible(button5, false)

guiSetVisible(button6, false)

guiSetVisible(button7, false)

guiSetVisible(button, false)

local drawingPanel = false;

function startDrawing_CMD()

if(drawingPanel == false) then

addEventHandler("onClientPreRender", getRootElement(), draw);

guiSetVisible(button, true)

drawingPanel = true;

showCursor(true)

else

removeEventHandler("onClientPreRender", getRootElement(), draw);

guiSetVisible(button, false)

drawingPanel = false;

showCursor(false)

end

end

addEventHandler("onClientMarkerHit", marker,

function (p)

if p == localPlayer then

count = 10

addEventHandler("onClientPreRender", getRootElement(), draw);

guiSetVisible(button, true)

guiSetVisible(button2, true)

guiSetVisible(button3, true)

guiSetVisible(button4, true)

guiSetVisible(button5, true)

guiSetVisible(button6, true)

guiSetVisible(button7, true)

guiSetAlpha(button, 0)

guiSetAlpha(button2, 0)

guiSetAlpha(button3, 0)

guiSetAlpha(button4, 0)

guiSetAlpha(button5, 0)

guiSetAlpha(button6, 0)

guiSetAlpha(button7, 0)

showCursor(true)

end

end

)

addEventHandler("onClientGUIClick",button7,function()

if ( source == button7) then

removeEventHandler("onClientPreRender", getRootElement(), draw);

guiSetVisible(button, false)

guiSetVisible(button2, false)

guiSetVisible(button3, false)

guiSetVisible(button4, false)

guiSetVisible(button5, false)

guiSetVisible(button6, false)

guiSetVisible(button7, false)

showCursor(false)

end

end )

addEventHandler("onClientGUIClick",button2,function()

if ( source == button2) then

showCursor(true)

triggerServerEvent ("giveweaponak47",getLocalPlayer(),giveweaponak47)

end

end )

addEventHandler("onClientGUIClick",button5,function()

if ( source == button5) then

showCursor(true)

triggerServerEvent ("giveweapontec9",getLocalPlayer(),giveweapontec9)

end

end )

addEventHandler("onClientGUIClick",button3,function()

if ( source == button3) then

showCursor(true)

triggerServerEvent ("giveweaponrocketlauncher",getLocalPlayer(),giveweaponrocketlauncher)

end

end )

addEventHandler("onClientGUIClick",button4,function()

if ( source == button4) then

showCursor(true)

triggerServerEvent ("giveweaponcolt45",getLocalPlayer(),giveweaponcolt45)

end

end )

addEventHandler("onClientGUIClick",button6,function()

if ( source == button6) then

showCursor(true)

triggerServerEvent ("giveweaponsniper",getLocalPlayer(),giveweaponsniper)

end

end )

addEventHandler("onClientGUIClick",button,function()

if ( source == button) then

showCursor(true)

triggerServerEvent ("giveweaponshotgun",getLocalPlayer(),giveweaponshotgun)

end

end )

server.lua

addEvent("giveweaponak47",true)

addEventHandler("giveweaponak47",root,

function()

if ( getPlayerMoney (source) >= 6000 ) then

takePlayerMoney(source, 6000)

giveWeapon (source,30,150,true)

else

outputChatBox('You don\'t have enough money to buy this weapon.', source, 255, 0, 0 )

end

end)

addEvent("giveweaponshotgun",true)

addEventHandler("giveweaponshotgun",root,

function()

if ( getPlayerMoney (source) >= 1800 ) then

takePlayerMoney(source, 1800)

giveWeapon (source,25,40,true)

else

outputChatBox('You don\'t have enough money to buy this weapon.', source, 255, 0, 0 )

end

end)

addEvent("giveweaponcolt45",true)

addEventHandler("giveweaponcolt45",root,

function()

if ( getPlayerMoney (source) >= 500 ) then

takePlayerMoney(source, 500)

giveWeapon (source,22,40,true)

else

outputChatBox('You don\'t have enough money to buy this weapon.', source, 255, 0, 0 )

end

end)

addEvent("giveweaponrocketlauncher",true)

addEventHandler("giveweaponrocketlauncher",root,

function()

if ( getPlayerMoney (source) >= 3500 ) then

takePlayerMoney(source, 3500)

giveWeapon (source,35,5,true)

else

outputChatBox('You don\'t have enough money to buy this weapon.', source, 255, 0, 0 )

end

end)

addEvent("giveweaponsniper",true)

addEventHandler("giveweaponsniper",root,

function()

if ( getPlayerMoney (source) >= 3500 ) then

takePlayerMoney(source, 3500)

giveWeapon (source,34,40,true)

else

outputChatBox('You don\'t have enough money to buy this weapon.', source, 255, 0, 0 )

end

end)

addEvent("giveweapontec9",true)

addEventHandler("giveweapontec9",root,

function()

if ( getPlayerMoney (source) >= 2800 ) then

takePlayerMoney(source, 2800)

giveWeapon (source,32,80,true)

else

outputChatBox('You don\'t have enough money to buy this weapon.', source, 255, 0, 0 )

end

end)

Link to comment

nono . its allowed thats why its in the community i was just curious. by the way ur problem.i see no problems... but try re-writing the function of the shotgun both in client / server.lua or try to rename the giveweaponshotgun to giveweaponshot or in any different names in client and server.lua or if there is an error in /debugscript 3 just tell me

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...