5
« on: April 02, 2016, 02:01:09 PM »
Gembo doesn't know how to use tables xD. I fixed it for you.
Here u go
-- Weapon Selector
local weaponSelect = 1
MissionSetup = function()
AreaTransitionXYZ(0,270,-110,6)
F_SetupWeapons()
end
function MissionCleanup()
end
function F_SetupWeapons()
weapons = {
{name = "Apple",model = 310},
{name = "Banana",model = 358},
{name = "Baseball",model = 302},
{name = "Basket Ball",model = 381},
{name = "Bat",model = 300},
{name = "Big Firework",model = 397},
{name = "Books 1",model = 405},
{name = "Books 2",model = 413},
{name = "Books 3",model = 414},
{name = "Books 4",model = 415},
{name = "Books 5",model = 416},
{name = "Brick",model = 311},
{name = "Broom",model = 377},
{name = "Camera",model = 426},
{name = "Dead Rat",model = 346},
{name = "Devil Fork",model = 409},
{name = "Dish",model = 338},
{name = "Egg",model = 312},
{name = "Fire Extinguisher",model = 326},
{name = "Firework",model = 301},
{name = "Flowers",model = 359},
{name = "Football",model = 331},
{name = "Football (Bomb)",model = 400},
{name = "Frisbee",model = 335},
{name = "Gold Pipe",model = 418},
{name = "Itchy Powder",model = 394},
{name = "Kick Me",model = 372},
{name = "Lunch Tray",model = 348},
{name = "Marbles",model = 349},
{name = "News Roll",model = 320},
{name = "Pinky Wand",model = 410},
{name = "Plate",model = 355},
{name = "Poison Gun",model = 395},
{name = "Rocket Launcher",model = 307},
{name = "Rubber Band",model = 325},
{name = "Shield",model = 387},
{name = "Metal Plate",model = 360},
{name = "Skateboard",model = 437},
{name = "Sledge Hammer",model = 324},
{name = "Slingshot",model = 303},
{name = "Snowball",model = 313},
{name = "Snowball 2",model = 330},
{name = "Soccer Ball",model = 329},
{name = "Spray Can",model = 321},
{name = "Spud Gun",model = 305},
{name = "Stink Bomb",model = 309},
{name = "Super Slingshot",model = 306},
{name = "Super Spud Gun",model = 396},
{name = "Trash Lid",model = 315},
{name = "Trophy",model = 385},
{name = "Umbrella",model = 404},
{name = "Vase 1",model = 354},
{name = "Vase 2",model = 353},
{name = "Vase 3",model = 345},
{name = "Water Baloon",model = 383},
{name = "Water Pipe",model = 342},
{name = "Whip",model = 411},
{name = "Wood Paddle",model = 357},
{name = "Wood Plank",model = 323},
{name = "Yardstick",model = 299},
}
end
function main()
repeat
F_WeaponSelect()
Wait(0)
until not Alive
end
F_WeaponSelect = function()
if IsButtonBeingPressed(0,0) and weaponSelect > 1 then
weaponSelect = weaponSelect - 1
elseif IsButtonBeingPressed(1,0) and weaponSelect < table.getn(weapons) then
weaponSelect = weaponSelect + 1
elseif IsButtonBeingPressed(3,0) then
PedSetWeapon(gPlayer,weapons[weaponSelect].model,50)
end
TextPrintString("Weapon Selector\n\nWeapon: "..weapons[weaponSelect].name,1,1)
end