Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function buyweapons ( thePlayer, commandName, wid, clip)
- if ( thePlayer ) then
- local weapon = getWeaponNameFromID ( wid )
- local weaponid = getWeaponIDFromName ( weapon )
- local money = getPlayerMoney ( thePlayer )
- if ( weaponid == 1 ) then
- if money >= 1000 then
- giveWeapon ( thePlayer, 1 )
- takePlayerMoney ( thePlayer, 1000 )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. "#0000FF!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* #FFFFFFYou don't have enought money to buy #FF0000" .. weapon , thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 2 ) then
- if money >= 1500 then
- giveWeapon ( thePlayer, 2 )
- takePlayerMoney ( thePlayer, 1500 )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. "!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* You don't have enought money to buy #FF0000" ..weapon , thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 3 ) then
- if money >= 100 then
- giveWeapon ( thePlayer, 3)
- takePlayerMoney ( thePlayer, 100 )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. "!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* You don't have enought money to buy #FF0000" ..weapon , thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 4 ) then
- if money >= 100000 then
- giveWeapon ( thePlayer, 4)
- takePlayerMoney ( thePlayer, 100000 )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. "!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* You don't have enought money to buy #FF0000" ..weapon , thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 5 ) then
- if money >= 100 then
- giveWeapon ( thePlayer, 5)
- takePlayerMoney ( thePlayer, 100 )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. "!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* You don't have enought money to buy #FF0000" ..weapon , thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 6 ) then
- if money >= 50 then
- giveWeapon ( thePlayer, 6)
- takePlayerMoney ( thePlayer, 50 )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. "!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* You don't have enought money to buy #FF0000" ..weapon , thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 7 ) then
- if money >= 100 then
- giveWeapon ( thePlayer, 7)
- takePlayerMoney ( thePlayer, 100 )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. "!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* You don't have enought money to buy #FF0000" ..weapon , thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 8 ) then
- if money >= 100000 then
- giveWeapon ( thePlayer, 8)
- takePlayerMoney ( thePlayer, 100000 )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. "!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* You don't have enought money to buy #FF0000" ..weapon , thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 9 ) then
- if money >= 500 then
- giveWeapon ( thePlayer, 9)
- takePlayerMoney ( thePlayer, 500 )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. "!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* You don't have enought money to buy #FF0000" ..weapon , thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 10 ) then
- if money >= 50 then
- giveWeapon ( thePlayer, 10)
- takePlayerMoney ( thePlayer, 50 )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. "!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* You don't have enought money to buy #FF0000" ..weapon , thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 11 ) then
- if money >= 100 then
- giveWeapon ( thePlayer, 11)
- takePlayerMoney ( thePlayer, 100 )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. "!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* You don't have enought money to buy #FF0000" ..weapon , thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 12 ) then
- if money >= 100 then
- giveWeapon ( thePlayer, 12)
- takePlayerMoney ( thePlayer, 100 )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. "!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* You don't have enought money to buy #FF0000" ..weapon , thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 14 ) then
- if money >= 10 then
- giveWeapon ( thePlayer, 14)
- takePlayerMoney ( thePlayer, 10 )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. "!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* You don't have enought money to buy #FF0000" ..weapon , thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 15 ) then
- if money >= 100 then
- giveWeapon ( thePlayer, 15)
- takePlayerMoney ( thePlayer, 100 )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. "!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* You don't have enought money to buy #FF0000" ..weapon , thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 44 ) then
- if money >= 100 then
- giveWeapon ( thePlayer, 3)
- takePlayerMoney ( thePlayer, 100 )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. "!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* You don't have enought money to buy #FF0000" ..weapon , thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 45 ) then
- if money >= 1000 then
- giveWeapon ( thePlayer, 3)
- takePlayerMoney ( thePlayer, 1000 )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. "!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* You don't have enought money to buy #FF0000" ..weapon , thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 46 ) then
- if money >= 10 then
- giveWeapon ( thePlayer, 46)
- takePlayerMoney ( thePlayer, 10 )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. "!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* You don't have enought money to buy #FF0000" ..weapon , thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 22 ) then
- if money >= 500*clip then
- ammo = 17*clip
- giveWeapon ( thePlayer, 22, ammo )
- takePlayerMoney ( thePlayer, 500*clip )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. " #0000FFand #FF0000" .. clip .." #0000FFclips of ammo for it!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* #FFFFFFYou don't have enought money to buy #FF0000" ..clip.." #FFFFFFclips of ammo for #FF0000" ..weapon.. "#FFFFFF!", thePlayer, 255, 0, 0,true)
- end
- elseif ( weaponid == 23 ) then
- if money >= 500*clip then
- ammo = 17*clip
- giveWeapon ( thePlayer, 23, ammo )
- takePlayerMoney ( thePlayer, 500*clip )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. " #0000FFand #FF0000" .. clip .." #0000FFclips of ammo for it!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* #FFFFFFYou don't have enought money to buy #FF0000" ..clip.." #FFFFFFclips of ammo for #FF0000" ..weapon.. "#FFFFFF!", thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 24 ) then
- if money >= 450*clip then
- ammo = 7*clip
- giveWeapon ( thePlayer, 24, ammo )
- takePlayerMoney ( thePlayer, 450*clip )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. " #0000FFand #FF0000" .. clip .." #0000FFclips of ammo for it!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* #FFFFFFYou don't have enought money to buy #FF0000" ..clip.." #FFFFFFclips of ammo for #FF0000" ..weapon.. "#FFFFFF!", thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 25 ) then
- if money >= 25*clip then
- ammo = 1*clip
- giveWeapon ( thePlayer, 25, ammo )
- takePlayerMoney ( thePlayer, 25*clip )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. " #0000FFand #FF0000" .. clip .." #0000FFclips of ammo for it!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* #FFFFFFYou don't have enought money to buy #FF0000" ..clip.." #FFFFFFclips of ammo for #FF0000" ..weapon.. "#FFFFFF!", thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 26 ) then
- if money >= 150*clip then
- ammo = 2*clip
- giveWeapon ( thePlayer, 26, ammo )
- takePlayerMoney ( thePlayer, 150*clip )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. " #0000FFand #FF0000" .. clip .." #0000FFclips of ammo for it!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* #FFFFFFYou don't have enought money to buy #FF0000" ..clip.." #FFFFFFclips of ammo for #FF0000" ..weapon.. "#FFFFFF!", thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 27 ) then
- if money >= 350*clip then
- ammo = 7*clip
- giveWeapon ( thePlayer, 27, ammo )
- takePlayerMoney ( thePlayer, 350*clip )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. " #0000FFand #FF0000" .. clip .." #0000FFclips of ammo for it!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* #FFFFFFYou don't have enought money to buy #FF0000" ..clip.." #FFFFFFclips of ammo for #FF0000" ..weapon.. "#FFFFFF!", thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 28 ) then
- if money >= 750*clip then
- ammo = 50*clip
- giveWeapon ( thePlayer, 28, ammo )
- takePlayerMoney ( thePlayer, 750*clip )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. " #0000FFand #FF0000" .. clip .." #0000FFclips of ammo for it!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* #FFFFFFYou don't have enought money to buy #FF0000" ..clip.." #FFFFFFclips of ammo for #FF0000" ..weapon.. "#FFFFFF!", thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 29 ) then
- if money >= 850*clip then
- ammo = 30*clip
- giveWeapon ( thePlayer, 29, ammo )
- takePlayerMoney ( thePlayer, 650*clip )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. " #0000FFand #FF0000" .. clip .." #0000FFclips of ammo for it!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* #FFFFFFYou don't have enought money to buy #FF0000" ..clip.." #FFFFFFclips of ammo for #FF0000" ..weapon.. "#FFFFFF!", thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 32 ) then
- if money >= 800*clip then
- ammo = 50*clip
- giveWeapon ( thePlayer, 32, ammo )
- takePlayerMoney ( thePlayer, 800*clip )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. " #0000FFand #FF0000" .. clip .." #0000FFclips of ammo for it!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* #FFFFFFYou don't have enought money to buy #FF0000" ..clip.." #FFFFFFclips of ammo for #FF0000" ..weapon.. "#FFFFFF!", thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 30 ) then
- if money >= 1000*clip then
- ammo = 30*clip
- giveWeapon ( thePlayer, 30, ammo )
- takePlayerMoney ( thePlayer, 1000*clip )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. " #0000FFand #FF0000" .. clip .." #0000FFclips of ammo for it!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* #FFFFFFYou don't have enought money to buy #FF0000" ..clip.." #FFFFFFclips of ammo for #FF0000" ..weapon.. "#FFFFFF!", thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 31 ) then
- if money >= 1250*clip then
- ammo = 50*clip
- giveWeapon ( thePlayer, 31, ammo )
- takePlayerMoney ( thePlayer, 1250*clip )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. " #0000FFand #FF0000" .. clip .." #0000FFclips of ammo for it!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* #FFFFFFYou don't have enought money to buy #FF0000" ..clip.." #FFFFFFclips of ammo for #FF0000" ..weapon.. "#FFFFFF!", thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 33 ) then
- if money >= 30*clip then
- ammo = 1*clip
- giveWeapon ( thePlayer, 33, ammo )
- takePlayerMoney ( thePlayer, 30*clip )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. " #0000FFand #FF0000" .. clip .." #0000FFclips of ammo for it!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* #FFFFFFYou don't have enought money to buy #FF0000" ..clip.." #FFFFFFclips of ammo for #FF0000" ..weapon.. "#FFFFFF!", thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 34 ) then
- if money >= 50*clip then
- ammo = 1*clip
- giveWeapon ( thePlayer, 34, ammo )
- takePlayerMoney ( thePlayer, 50*clip )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. " #0000FFand #FF0000" .. clip .." #0000FFclips of ammo for it!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* #FFFFFFYou don't have enought money to buy #FF0000" ..clip.." #FFFFFFclips of ammo for #FF0000" ..weapon.. "#FFFFFF!", thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 35 ) then
- if money >= 5000*clip then
- ammo = 1*clip
- giveWeapon ( thePlayer, 35, ammo )
- takePlayerMoney ( thePlayer, 5000*clip )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. " #0000FFand #FF0000" .. clip .." #0000FFclips of ammo for it!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* #FFFFFFYou don't have enought money to buy #FF0000" ..clip.." #FFFFFFclips of ammo for #FF0000" ..weapon.. "#FFFFFF!", thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 36 ) then
- if money >= 10000*clip then
- ammo = 1*clip
- giveWeapon ( thePlayer, 36, ammo )
- takePlayerMoney ( thePlayer, 10000*clip )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. " #0000FFand #FF0000" .. clip .." #0000FFclips of ammo for it!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* #FFFFFFYou don't have enought money to buy #FF0000" ..clip.." #FFFFFFclips of ammo for #FF0000" ..weapon.. "#FFFFFF!", thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 37 ) then
- if money >= 400*clip then
- ammo = 50*clip
- giveWeapon ( thePlayer, 37, ammo )
- takePlayerMoney ( thePlayer, 400*clip )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. " #0000FFand #FF0000" .. clip .." #0000FFclips of ammo for it!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* #FFFFFFYou don't have enought money to buy #FF0000" ..clip.." #FFFFFFclips of ammo for #FF0000" ..weapon.. "#FFFFFF!", thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 38 ) then
- if money >= 25000*clip then
- ammo = 500*clip
- giveWeapon ( thePlayer, 38, ammo )
- takePlayerMoney ( thePlayer, 25000*clip )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. " #0000FFand #FF0000" .. clip .." #0000FFclips of ammo for it!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* #FFFFFFYou don't have enought money to buy #FF0000" ..clip.." #FFFFFFclips of ammo for #FF0000" ..weapon.. "#FFFFFF!", thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 16 ) then
- if money >= 900*clip then
- ammo = 1*clip
- giveWeapon ( thePlayer, 16, ammo )
- takePlayerMoney ( thePlayer, 900*clip )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. " #0000FFand #FF0000" .. clip .." #0000FFclips of ammo for it!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* #FFFFFFYou don't have enought money to buy #FF0000" ..clip.." #FFFFFFclips of ammo for #FF0000" ..weapon.. "#FFFFFF!", thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 17 ) then
- if money >= 750*clip then
- ammo = 1*clip
- giveWeapon ( thePlayer, 17, ammo )
- takePlayerMoney ( thePlayer, 750*clip )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. " #0000FFand #FF0000" .. clip .." #0000FFclips of ammo for it!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* #FFFFFFYou don't have enought money to buy #FF0000" ..clip.." #FFFFFFclips of ammo for #FF0000" ..weapon.. "#FFFFFF!", thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 18 ) then
- if money >= 250*clip then
- ammo = 1*clip
- giveWeapon ( thePlayer, 18, ammo )
- takePlayerMoney ( thePlayer, 250*clip )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. " #0000FFand #FF0000" .. clip .." #0000FFclips of ammo for it!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* #FFFFFFYou don't have enought money to buy #FF0000" ..clip.." #FFFFFFclips of ammo for #FF0000" ..weapon.. "#FFFFFF!", thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 39 ) then
- if money >= 750*clip then
- ammo = 1*clip
- giveWeapon ( thePlayer, 39, ammo )
- takePlayerMoney ( thePlayer, 750*clip )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. " #0000FFand #FF0000" .. clip .." #0000FFclips of ammo for it!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* #FFFFFFYou don't have enought money to buy #FF0000" ..clip.." #FFFFFFclips of ammo for #FF0000" ..weapon.. "#FFFFFF!", thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 41 ) then
- if money >= 500*clip then
- ammo = 500*clip
- giveWeapon ( thePlayer, 41, ammo )
- takePlayerMoney ( thePlayer, 500*clip )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. " #0000FFand #FF0000" .. clip .." #0000FFclips of ammo for it!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* #FFFFFFYou don't have enought money to buy #FF0000" ..clip.." #FFFFFFclips of ammo for #FF0000" ..weapon.. "#FFFFFF!", thePlayer, 255, 0, 0, true)
- end
- elseif ( weaponid == 42 ) then
- if money >= 50*clip then
- ammo = 500*clip
- giveWeapon ( thePlayer, 42, ammo )
- takePlayerMoney ( thePlayer, 50*clip )
- outputChatBox ( "* #0000FFCongratulations you have bought #FF0000" .. weapon .. " #0000FFand #FF0000" .. clip .." #0000FFclips of ammo for it!", thePlayer, 0, 255, 255, true)
- else
- outputChatBox ( "* #FFFFFFYou don't have enought money to buy #FF0000" ..clip.." #FFFFFFclips of ammo for #FF0000" ..weapon.. "#FFFFFF!", thePlayer, 255, 0, 0, true)
- end
- else
- outputChatBox ( "* #FFFFFFInvalid weapon ID: #FF0000".. wid .. "#FFFFFF!", thePlayer, 255, 0, 0, true)
- end
- else
- outputChatBox("debug1s")
- end
- end
- addEvent("buyweaponevent", true)
- addEventHandler("buyweaponevent", getRootElement(), buyweapons)
- addCommandHandler ("buyweapon", buyweapons)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement