Jump to content

Bug script skinshops


Scot_land

Recommended Posts

Every time I add a special id skin for clans only, but every time I add the id skin in groups script Stop or don't download

code: server-side
------------------------------------------------------------------------------------------------------------------------------

conn = dbConnect( "mysql", "dbname="..tostring(exports["NGSQL"]:getMySQLData()[3])..";host=globalhost.sytes.net", tostring(exports["NGSQL"]:getMySQLData()[1]), tostring(exports["NGSQL"]:getMySQLData()[2]), "share=1" )

local Groups = {
{222,"Terrorists"}
}
local clothingTable = {

    {194, "Millie Perkins"},

    {140, "Buxom Bikini"},

    {190, "Barbara Schternvart"},

    {191, "Helena Wankstein"},

    {192, "Michelle Cannes"},
 


    {193, "Katie Zhan"},

    {195, "Denise Robinson"},

    {45, "Beach Mustache"},

    {96, "Soccer Player"},

    {97, "Baywatch Dude"},

    {138, "Bikini Tattoo"},

    {139, "Yellow Bikini"},

    {154, "Beach Blonde"},

    {7, "Casual Jeanjacket"},

    {14, "Floral Shirt"},

    {15, "Plaid Baldy"},

    {20, "Fresh Prince"},

    {32, "Eyepatch"},

    {39, "Old Maid"},

    {54, "Hispanic Woman"},

    {58, "Chinese Plaid"},

    {60, "Chinese Casual"},

    {62, "Pajama Man 1"},

    {69, "Denim Girl"},

    {72, "Bearded Hippie"},

    {93, "Hoop Earrings 1"},

    {101, "Jacket Hippie"},

    {136, "Old Rasta"},

    {142, "African 1"},

    {143, "Sam Jackson"},

    {170, "PubeStache Tshirt"},

    {182, "Pajama Man 2"},

    {188, "Green Shirt"},

    {215, "Explorer"},

    {218, "Old Woman"},

    {220, "African 2"},

    {224, "Elderly Asian 1"},

    {225, "Elderly Asian 2"},

    {229, "Asian Tourist"},

    {231, "Grannie"},

    {232, "Grouchy lady"},

    {233, "Hoop Earrings 2"},

    {234, "Buzzcut"},

    {250, "Green Tshirt"},

    {262, "Pajama Man 2 b"},

    {240, "Hugh Grant"},

    {31, "Fat Cowgirl"},

    {33, "Bounty Hunter"},

    {34, "Marlboro Man"},

    {44, "Tatooed Plaid"},

    {129, "Native Librarian"},

    {130, "Native Ugly"},

    {131, "Native Sexy"},

    {132, "Native Geezer"},

    {157, "Farmer Girl"},

    {158, "Farmer"},

    {159, "Farmer Redneck"},

    {160, "Bald Redneck"},

    {161, "Smoking Cowboy"},

    {162, "Inbred"},

    {196, "Aunt May"},

    {198, "Ranch Cowgirl"},

    {199, "Heidi"},

    {201, "Trucker Girl"},

    {202, "Beer Trucker"},

    {236, "Happy Old Man"},

    {261, "Southerner"},

    {56, "Legwarmers 1"},

    {226, "Legwarmers 2"},

    {221, "Beardo Casual"},

    {254, "Biker Vest B"},


    {164, "Casino Bouncer 2"},

    {165, "Agent Kay"},

    {105, "Grove Sweater"},

    {197, "Smoking Maid"},

    {207, "Grove Booty"},

    {245, "Ghetto Ho"},

    {258, "Joe Pesci"},

    {259, "Chris Penn"},

    {9, "Business Lady"},

    {17, "Black suit"},

    {57, "Chinese Businessman"},

    {76, "Businesswoman 1"},

    {141, "Cute Librarian"},

    {147, "Sigmund Freud"},

    {148, "Businesswoman 2"},

    {149, "Businesswoman 2 B"},

    {150, "Businesswoman 3"},

    {169, "Asian Escort"},

    {186, "Teacher"},

    {187, "Japanese Businessman 1"},

    {219, "Lady In Red"},

    {227, "Japanese Businessman 2"},

    {228, "Japanese Businessman 3"},

    {263, "Asian Hostess"},

    {49, "Ninja Sensei"},

    {80, "Red Boxer"},

    {81, "Blue Boxer"},

    {203, "Ninja 1"},

    {204, "Ninja 2"},

    {114, "Aztecas Stripes"},

    {115, "Aztecas Jacket"},

    {116, "Aztecas Shorts"},

    {102, "Baller Shirt"},

    {103, "Baller Jacket"},

    {104, "Baller Sweater"},

    {100, "Biker Blackshirt"},

    {247, "Biker Vest"},

    {248, "Biker Headband"},

    {121, "Da Nang Army"},

    {122, "Da Nang Bandana"},

    {123, "Da Nang Shades"},

    {0, "CJ"},

    {106, "Grove Topbutton"},

    {107, "Grove Jersey"},

    {125, "Mafia Enforcer"},

    {126, "Mafia Wiseguy"},

    {127, "Mafia Hitman"},

    {173, "Rifa Hat"},

    {174, "Rifa Vest"},

    {175, "Rifa Suspenders"},

    {111, "Russian Muscle"},

    {112, "Russian Hitman"},

    {113, "Russian Boss"},

    {120, "Sindacco Suit"},

    {124, "Sindacco Muscle"},

    {117, "Triad 1"},

    {118, "Triad 2"},

    {119, "Triad 3"},

    {108, "Vagos Topless"},

    {109, "Vagos Pants"},

    {110, "Vagos Shorts"},

    {19, "Beach Gangsta"},

    {28, "Black Dealer"},

    {47, "Top Button Essey"},

    {67, "Red Bandana"},

    {241, "Afro Brother"},

    {242, "Dreadlock Brother"},

    {243, "Ghetto Booty"},

    {78, "Homeless Scarf"},

    {95, "Poor Old Man"},

    {134, "Homeless Smoker"},

    {135, "Skullcap Hobo"},

    {200, "Hairy Redneck"},

    {213, "Hobo Elvis"},

    {43, "Porn Producer"},

    {46, "Dark Romeo"},

    {59, "Chinese Romeo"},

    {185, "Nervous Guy"},

    {223, "Greasy Nightclubber"},

    {63, "Trashy Hooker"},

    {64, "Transvestite"},

    {85, "Furcoat Hooker"},

    {87, "Firecrotch"},

    {90, "Barely Covered"},

    {152, "Schoolgirl 1"},

    {178, "Masked Stripper"},

    {237, "Leopard Hooker"},

    {238, "Amazon"},

    {244, "Lace Stripper"},

    {246, "Cop Stripper"},

    {249, "Pimp"},

    {256, "Shoolgirl 2"},

    {257, "Bondage Girl"},

    {13, "Homegirl"},

    {21, "Striped Gangsta"},

    {22, "Orange Sportsman"},

    {23, "Skater Kid"},

    {24, "LS Coach"},

    {25, "Varsity jacket"},

    {36, "Mailman"},

    {51, "Black Bicyclist"},

    {52, "White Bicyclist"},

    {66, "Varsity Bandits"},

    {92, "Rollergirl"},

    {180, "Bball Player"},

    {18, "Black Beachguy"},

    {183, "Klingon"},

    {35, "Fisherman"},

    {37, "Baseball Dad"},

    {210, "Sloppy Tourist"},

    {235, "Retired Tourist"},

    {12, "Classy Gold Hooker"},

    {40, "Classy Dark Hooker"},

    {41, "Tracksuit Girl"},

    {55, "Rich Bitch"},

    {91, "Sharon Stone"},

    {99, "Rollerguy"},

    {216, "Turtleneck"},

    {75, "Skanky Hooker"},

    {137, "Boxhead"},

    {167, "Chicken"},

    {181, "Punk"},

    {212, "Tin Foil Hat"},

    {230, "Hooded Hobo"},

    {252, "Naked Freak"},

    {264, "Whoopee the Clown"},

    {156, "Old Reece"},

    {176, "Style Barber"},

    {177, "Vanilla Ice Barber"},

    {61, "Pilot"},

    {68, "Preist"},

    {70, "Scientist"},

    {11, "Card Dealer 1"},

    {82, "Fatty Elvis"},

    {83, "Whitesuit Elvis"},

    {84, "Bluesuit Elvis"},

    {163, "Casino Bouncer 1"},

    {171, "Card Dealer 2"},

    {172, "Card Dealer 3"},

    {214, "Caligula Waitress"},

    {16, "Earmuff Worker"},

    {27, "Construction 1"},

    {153, "Foreman"},

    {260, "Construction 2"},

    {29, "White Dealer"},

    {144, "Drug Worker 1"},

    {145, "Drug Worker 2"},

    {146, "Drug Worker 3"},

    {155, "Pizza Guy"},

    {168, "Hotdog Vender"},

    {205, "Burger Girl"},

    {209, "Noodle Vender"},

    {50, "Mechanic"},

    {71, "Security Guard"},

    {189, "Valet"},

    {211, "Staff Girl"},

    {251, "Lifeguard"},

    {253, "Bus Driver"},

    {255, "Limo Driver"},

    {128, "Native Rancher"},

    {133, "Furys Trucker"},

    {206, "Money Trucker"},

    {30, "Spanish dude"},

    {48, "Glasses dude"},

    {1, "Truth"},

    {2, "Maccer"},

    {265, "Tenpenny"},

    {266, "Pulaski"},

    {267, "Hern"},

    {268, "Dwayne"},

    {269, "Big Smoke"},
    
    
    {298, "Catlaina"},

}

maskTable = {

{1512,"Devil",1200000,51},

{1455,"Alien",1400000,52},

{1484,"Bag",100000,53},

{1485,"Cat",1500000,54},

{1543,"Darthvader",1300000,55},

{1544,"Fox",1600000,56},

{1666,"Guyfawkes",4,57},

{1667,"Hockey",30,58},

{1668,"Monkey",1700000,59},

{1950,"Monster",1200000,60},

{1951,"Owl",1800000,61},

{1551,"Pig",1900000,62},

{1546,"Pumpkin",1990000,63},

{1669,"Raccoon",1990000,64},

{1853,"Skull",12950000,65},

{1854,"Vampire",19990000,66},

{1855,"Zombie",20000000,67}

}

allowed = {

["Gangster"] = true,

["Terrorists"] = true,

["Unemployed"] = true,

 


["None"] = true,

}

function playerBuysSkin(type, itt)
 if type == "Skins" then

    if not allowed[getElementData(client, "Job")] then return     exports["SAUCMessages"]:sendClientMessage("Skin shop: You cannot buy skins as "..getElementData(client,"Job").."",client, 255, 255, 0) end

    local playeraccount = getPlayerAccount(client)

    dbb = dbQuery(conn, "SELECT * FROM SkinTextures WHERE STName=? LIMIT 1", getAccountData(playeraccount, "appliedTexture"))

    for k, v in ipairs(dbPoll(dbb, -1)) do

    if v["Equipped"] == 2 then return exports["SAUCMessages"]:sendClientMessage("Skin shop: please un-equip the skin texture before buying new skin.",client, 255, 255, 0) end

    end

    if (getPlayerMoney(client) >= 1000)  then

        setElementData ( client, "SAUCUser.UnemployedSkin", itt )

        takePlayerMoney(client, 1000)

        setElementPosition(client,161.54,-83.25,1001.8)

        triggerClientEvent(client, "closeSkinShop", client)

        exports["SAUCMessages"]:sendClientMessage("Skin shop: You have bought a skin for $1000.",client, 255, 255, 0)

        exports["SAUCMessages"]:sendClientMessage("Skin shop: wait 2 seconds you will get it.",client, 255, 255, 0)

        setTimer(setElementModel, 2000, 1, client, getElementData ( client, "SAUCUser.UnemployedSkin" ))

    end

    elseif type == "Masks" then
    if (getPlayerMoney(client) <= itt[2])then exports["SAUCMessages"]:sendClientMessage("Skin Shop: You need a total of  $"..convertNumber(itt[2]).." to buy this mask! ",client,255,0,0) end
    
if (getPlayerMoney(client) >= itt[2])  then
        exports.SAUCInventory:addPlayerItem(client,itt[3],1)

        triggerClientEvent(client, "closeSkinShop", client)

        takePlayerMoney(client, tonumber(itt[2]))

        exports["SAUCMessages"]:sendClientMessage("Skin shop: You have bought a Mask for $"..convertNumber(itt[2]).." .",client, 0, 255, 0)

    end
    elseif type == "Group Skins" then
    if getElementData(client,"Clan") ~= itt[2]then exports["SAUCMessages"]:sendClientMessage("Skin Shop: You need to be a member of "..itt[2].." to buy use this skin! ",client,255,0,0) end
    
if getElementData(client,"Clan") == itt[2]  then
      setElementData ( client, "SAUCUser.UnemployedSkin", itt[1] )

        takePlayerMoney(client, 1000)

        setElementPosition(client,161.54,-83.25,1001.8)

        triggerClientEvent(client, "closeSkinShop", client)

        exports["SAUCMessages"]:sendClientMessage("Skin shop: You now have "..itt[2].." skin equipped.",client, 0, 255, 0)


    setElementModel(client,getElementData ( client, "SAUCUser.UnemployedSkin" ))

    
    end
    end

end

addEvent("BuySkinShop", true)

addEventHandler("BuySkinShop", root, playerBuysSkin)

addEvent("requstGridSkinShop",true)

addEventHandler("requstGridSkinShop",root,function (type)

    local clinetTable = {}

    if type == "Skins" then


    for i,v in ipairs (clothingTable) do

        table.insert(

            clinetTable,{

                name = v[2],

                value = v[1],

                }

            )

        table.sort(clinetTable, function(a, b) return a.value < b.value end )

    end

    triggerClientEvent(client, "clientGotTable", client,clinetTable)

    elseif type == "Masks" then

    for i,v in ipairs (maskTable) do

        table.insert(

            clinetTable,{

                name = v[2],

                value = v[3],

                mask = v[1],

                maskid = v[4]

                }

            )
            table.sort(clinetTable, function(a, b) return a.value > b.value end )

    

    end
         triggerClientEvent(client, "clientGotTable", client,clinetTable)
    elseif type == "Group Skins" then

    for i,v in ipairs (Groups) do

        table.insert(

            clinetTable,{

                id = v[1],

                group = v[2],

    
                }

            )
        

table.sort(clinetTable, function(a, b) return a.value > b.value end )

    
    end

        triggerClientEvent(client, "clientGotTable", client,clinetTable)

    end

end)

function playerHitsClothingStore(player, MD)

    if (MD and getElementType(player) == "player") then

        if getElementData(player,"inSkinShop") == true  then setElementData(player,"inSkinShop",false) return end

        setPlayerHudComponentVisible(player,"radar",false)

        setElementPosition(player,2108.15, -681.27, 99.07)

        triggerClientEvent(player, "showSkinShop", player)

        setElementData(player,"inSkinShop",true)

        setElementData(player,"skinShopTempSkin",tonumber(getElementModel(player)))

    end

end

function convertNumber ( number )

    local formatted = number

    while true do

        formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2')

        if ( k==0 ) then

            break

        end

    end

    return formatted

end

local SkinLocs = {

        [1] = {

                outPos = { 1459.16, -1140.48, 24.06 },

                inPos = { 180.5, -88.39, 1002.02 },

                int = 18,

                dim = 1

        },

        [2] = {

                outPos = { 2244.91, -1662.91, 15.48 },

                inPos = { 180.5, -88.39, 1002.02 },

                int = 18,

                dim = 2

        },

        [3] = {

                outPos = { 461.71, -1500.87, 31.04 },

                inPos = { 180.5, -88.39, 1002.02 },

                int = 18,

                dim = 3

        },

                [4] = {

                outPos = { 503.46, -1406.01, 16.16 },

                inPos = { 180.5, -88.39, 1002.02 },

                int = 18,

                dim = 4

        },

                        [5] = {

                outPos = { 1657.03, 1733.4, 10.83 },

                inPos = { 180.5, -88.39, 1002.02 },

                int = 18,

                dim = 5

        },

                        [6] = {

                outPos = { 2572.25, 1904.95, 11.02 },

                inPos = { 180.5, -88.39, 1002.02 },

                int = 18,

                dim = 6

        },

        [7] = {

                outPos = {2826.15, 2407.5, 11.06 },

                inPos = { 180.5, -88.39, 1002.02 },

                int = 18,

                dim = 7

        },

        [8] = {

                outPos = {2899.9, 2469.38, 11.07 },

                inPos = { 180.5, -88.39, 1002.02 },

                int = 18,

                dim = 8

        },

        [9] = {

                outPos = {-2373.78, 910.16, 45.45 },

                inPos = { 180.5, -88.39, 1002.02 },

                int = 18,

                dim = 9

        },

                [10] = {

                outPos = {3503.83, -1864.45, 36.565 },

                inPos = { 180.5, -88.39, 1002.02 },

                int = 18,

                dim = 10

        },

                [11] = {

                outPos = {-1694.62, 951.84, 24.89 },

                inPos = { 180.5, -88.39, 1002.02 },

                int = 18,

                dim = 11

        },

                [12] = {

                outPos = {-1882.16, 866.4, 35.17 },

                inPos = { 180.5, -88.39, 1002.02 },

                int = 18,

                dim = 12

        },

                [13] = {

                outPos = {        -2288.17, -79.93, 35.32 },

                inPos = { 180.5, -88.39, 1002.02 },

                int = 18,

                dim = 13

        },

                [14] = {

                outPos = {        -2479.55, 2317.7, 4.98 },

                inPos = { 180.5, -88.39, 1002.02 },

                int = 18,

                dim = 14

        },

        [15] = {

                outPos = {        -1454.85, 2611.47, 56.84 },

                inPos = { 180.5, -88.39, 1002.02 },

                int = 18,

                dim = 15

        },

        [16] = {

                outPos = {        -176.23, 1112.17, 19.74 },

                inPos = { 180.5, -88.39, 1002.02 },

                int = 18,

                dim = 16

        },

                [17] = {

                outPos = {-2169.82, -2319.34, 30.63},

                inPos = { 180.5, -88.39, 1002.02 },

                int = 18,

                dim = 17

        },

                        [18] = {

                outPos = {2101.89, 2257.5, 11.02},

                inPos = { 180.5, -88.39, 1002.02 },

                int = 18,

                dim = 18

        },

                                [19] = {

                outPos = {2090.49, 2224.7, 11.02},

                inPos = { 180.5, -88.39, 1002.02 },

                int = 18,

                dim = 19

        },

}

local clothingShops = {

    {shop="LS Binco GS", x=161.54, y=-83.25, z=1001.8, dim=1, int=18, bx=2243.997, by=-1672.211},

    {shop="LS Zip", x=161.54, y=-83.25, z=1001.8, dim=2, int=18, bx=1458.20, by=-1139.63},

    {shop="LS Pro Laps", x=161.54, y=-83.25, z=1001.8, dim=0, int=3, bx=500.44, by=-1358.57},

    {shop="SF Zip", x=161.54, y=-83.25, z=1001.8, dim=3, int=18, bx=-1883.2, by=865.4},

    {shop="LV Zip", x=161.54, y=-83.25, z=1001.8, dim=4, int=18, bx=2572.0, by=1904.8},

    {shop="LV2 Zip", x=161.54, y=-83.25, z=1001.8, dim=5, int=18, bx=2090.5, by=2224.2},

    {shop="SF Binco", x=161.54, y=-83.25, z=1001.8, dim=6, int=18, bx=-2375.3, by=910.2},

    {shop="LV Binco", x=161.54, y=-83.25, z=1001.8, dim=7, int=18, bx=1657.0, by=1733.3},

    {shop="LV2 Binco", x=161.54, y=-83.25, z=1001.8, dim=8, int=18, bx=2102.6, by=2257.4},

    {shop="LV2 Binco", x=161.54, y=-83.25, z=1001.8, dim=9, int=18, bx=2102.6, by=2257.4},

    {shop="LV2 Binco", x=161.54, y=-83.25, z=1001.8, dim=10, int=18, bx=2102.6, by=2257.4},

    {shop="LV2 Binco", x=161.54, y=-83.25, z=1001.8, dim=11, int=18, bx=2102.6, by=2257.4},

    {shop="LV2 Binco", x=161.54, y=-83.25, z=1001.8, dim=12, int=18, bx=2102.6, by=2257.4},

    {shop="LV2 Binco", x=161.54, y=-83.25, z=1001.8, dim=13, int=18, bx=2102.6, by=2257.4},

    {shop="LV2 Binco", x=161.54, y=-83.25, z=1001.8, dim=14, int=18, bx=2102.6, by=2257.4},

    {shop="LV2 Binco", x=161.54, y=-83.25, z=1001.8, dim=15, int=18, bx=2102.6, by=2257.4},

    {shop="LV2 Binco", x=161.54, y=-83.25, z=1001.8, dim=16, int=18, bx=2102.6, by=2257.4},

    {shop="LV2 Binco", x=161.54, y=-83.25, z=1001.8, dim=17, int=18, bx=2102.6, by=2257.4},

    {shop="LV2 Binco", x=161.54, y=-83.25, z=1001.8, dim=18, int=18, bx=2102.6, by=2257.4},

    {shop="LV2 Binco", x=161.54, y=-83.25, z=1001.8, dim=19, int=18, bx=2102.6, by=2257.4},

}

function fireUpClothingStores()

    for ind, ent in pairs(clothingShops) do

        local marker = createMarker(ent.x, ent.y, ent.z-1, "cylinder", 2, 72, 255, 0, 150)

        for ind2, ent2 in pairs(SkinLocs) do

               local sx, sy, sz = unpack ( ent2.outPos )

               local blip = createBlip( sx, sy, sz, 45)

               setBlipVisibleDistance(blip,500)

        end

        ----

        setElementDimension(marker, ent.dim)

        setElementInterior(marker, ent.int)

        addEventHandler("onMarkerHit", marker, playerHitsClothingStore)

    end

end

addEventHandler("onResourceStart", resourceRoot, fireUpClothingStores)

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   1 member

×
×
  • Create New...