Jump to content
  • 0

Help


Nekac

Question

Can someone help me how to do that vip has free skils as guns and vehicles

addEvent ("viewGUI", true)

function showGui (hitPlayer, matchingDimension)

triggerClientEvent ("viewGUI", hitPlayer)

end

addCommandHandler("shop",showGui)

addEvent ("weapBuy", true)

addEventHandler ("weapBuy", getRootElement(),

function(id, cost, name, ammo)

local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name

if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then

giveWeapon(source, tonumber(id),1000)

else

if (getPlayerMoney (source) >= tonumber(cost)) then

outputChatBox ("You Bought a " .. name, source, 255, 0, 0, false)

outputChatBox ("ID: " .. id, source, 255, 0, 0, false)

outputChatBox ("Cost: " .. cost, source, 255, 0, 0, false)

takePlayerMoney (source, tonumber (cost))

giveWeapon(source, tonumber(id),1000)

else

outputChatBox ("You are too poor!", source, 255, 0, 0, false)

end

end

end

)

addEvent ("carBuy", true)

addEventHandler ("carBuy", getRootElement(),

function(id2, cost2, name2,x, y, z, sRz)

local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name

if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then

local x,y,z = getElementPosition (source)

local vehicle = createVehicle (id2, x, y, z, 0, 0, sRz )

warpPedIntoVehicle(source, vehicle)

else

if (getPlayerMoney (source) >= tonumber(cost2)) then

outputChatBox ("Bought a " .. name2, source, 255, 0, 0, false)

outputChatBox ("ID: " .. id2, source, 255, 0, 0, false)

outputChatBox ("Cost: " .. cost2, source, 255, 0, 0, false)

takePlayerMoney (source, tonumber (cost2))

local x,y,z = getElementPosition (source)

local vehicle = createVehicle (id2, x, y, z, 0, 0, sRz )

warpPedIntoVehicle(source, vehicle)

else

outputChatBox ("You are too poor!", source, 255, 0, 0, false)

end

end

end

)

function vExplode ()

toggleVehicleRespawn ( source, false )

setTimer(destroyElement, 5000, 1, source)

end

addEventHandler ( "onVehicleExplode", getResourceRootElement(getThisResource()), vExplode )

function skillButton (id, cost)

if (id == "0") then

skillBuyPlayer (1000000,source,69)

elseif (id == "1") then

skillBuyPlayer (1000000,source,70)

elseif (id == "2") then

skillBuyPlayer (1000000,source,71)

elseif (id == "3") then

skillBuyPlayer (1000000,source,72)

elseif (id == "4") then

skillBuyPlayer (1000000,source,73)

elseif (id == "5") then

skillBuyPlayer (1000000,source,74)

elseif (id == "6") then

skillBuyPlayer (1000000,source,75)

elseif (id == "7") then

skillBuyPlayer (1000000,source,76)

elseif (id == "8") then

skillBuyPlayer (1000000,source,77)

elseif (id == "9") then

skillBuyPlayer (1000000,source,78)

elseif (id == "10") then

skillBuyPlayer (1000000,source,79)

elseif (id == "11") then

skillBuyPlayer (1000000,source,24)

elseif (id == "12") then

skillBuyPlayer (50000,source,23)

elseif (id == "13") then

skillBuyPlayer (25000,source,21)

end

end

addEvent ("skillBuy", true)

addEventHandler ("skillBuy", getRootElement(),skillButton)

function skillBuyPlayer (cash,player,id)

if (getPlayerMoney (player) >= cash) then

takePlayerMoney (player,cash)

setPedStat(player, id, 1000)

else outputChatBox ("You are too poor!", player, 255,0,0)

end

end

Link to comment

2 answers to this question

Recommended Posts

  • 0

Please use the [/lua][/lua] bbcode tags and indent your code.

*Take away the first /.

Try this:

addEvent ("viewGUI", true) 
  
function showGui (player) 
    triggerClientEvent ("viewGUI", player) 
end 
addCommandHandler("shop",showGui) 
  
addEvent ("weapBuy", true) 
addEventHandler ("weapBuy", getRootElement(), 
    function(id, cost, name, ammo) 
        local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name 
        if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then 
            giveWeapon(source, tonumber(id),1000) 
        else 
            if (getPlayerMoney (source) >= tonumber(cost)) then 
                outputChatBox ("You Bought a " .. name, source, 255, 0, 0, false) 
                outputChatBox ("ID: " .. id, source, 255, 0, 0, false) 
                outputChatBox ("Cost: " .. cost, source, 255, 0, 0, false) 
                takePlayerMoney (source, tonumber (cost)) 
                giveWeapon(source, tonumber(id),1000) 
            else 
                outputChatBox ("You are too poor!", source, 255, 0, 0, false) 
            end 
        end 
    end 
) 
  
addEvent ("carBuy", true) 
addEventHandler ("carBuy", getRootElement(), 
    function(id2, cost2, name2,x, y, z, sRz) 
        local accName = getAccountName ( getPlayerAccount ( source ) ) -- get his account name 
        if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then 
            local x,y,z = getElementPosition (source) 
            local vehicle = createVehicle (id2, x, y, z, 0, 0, sRz ) 
            warpPedIntoVehicle(source, vehicle) 
        else 
            if (getPlayerMoney (source) >= tonumber(cost2)) then 
                outputChatBox ("Bought a " .. name2, source, 255, 0, 0, false) 
                outputChatBox ("ID: " .. id2, source, 255, 0, 0, false) 
                outputChatBox ("Cost: " .. cost2, source, 255, 0, 0, false) 
                takePlayerMoney (source, tonumber (cost2)) 
                local x,y,z = getElementPosition (source) 
                local vehicle = createVehicle (id2, x, y, z, 0, 0, sRz ) 
                warpPedIntoVehicle(source, vehicle) 
            else 
                outputChatBox ("You are too poor!", source, 255, 0, 0, false) 
            end 
        end 
    end 
) 
  
function vExplode () 
    toggleVehicleRespawn ( source, false ) 
    setTimer(destroyElement, 5000, 1, source) 
end 
addEventHandler ( "onVehicleExplode", getResourceRootElement(getThisResource()), vExplode ) 
  
--Thanks to TapAz for the code {Found at MTA Wiki} 
function switch(arg) 
    if(type(arg)~="table")then return switch end 
    local switching, default, done; --Default is nil 
    if(tostring(arg[1]):len()<=2)and(tostring(arg[2]):len()<=2)then switching=arg[1] end 
    table.remove(arg, 1); 
    for i=1, #arg do 
        if(tostring(arg[i]):len()<=3)and(arg[i]==switching)then 
            if(type(arg[i+1])=="function")then 
                pcall(arg[i+1]) 
                done=true; 
                break 
            else 
                break 
            end 
        end 
        if(arg[i]==nil)and(arg[i]==switching)and(type(arg[i+1])=="function")then pcall(arg[i+1]) end 
    end 
    if(not done)then print("No action.") end 
end 
  
function skillBuyPlayer (cash,player,id) --Make sure the function is first before trying to call it 
    if (getPlayerMoney (player) >= cash) then 
        takePlayerMoney (player,cash) 
        setPedStat(player, id, 1000) 
    else 
        outputChatBox ("You are too poor!", player, 255,0,0) 
    end 
end 
  
function skillButton (id, cost) 
    switch 
    { 
        tonumber(id); 
        0,skillBuyPlayer(1000000,source,69), 
        1,skillBuyPlayer(1000000,source,70), 
        2,skillBuyPlayer(1000000,source,71), 
        3,skillBuyPlayer(1000000,source,72), 
        4,skillBuyPlayer(1000000,source,73), 
        5,skillBuyPlayer(1000000,source,74), 
        6,skillBuyPlayer(1000000,source,75), 
        7,skillBuyPlayer(1000000,source,76), 
        8,skillBuyPlayer(1000000,source,77), 
        9,skillBuyPlayer(1000000,source,78), 
        10,skillBuyPlayer(1000000,source,79), 
        11,skillBuyPlayer(1000000,source,24), 
        12,skillBuyPlayer(50000,source,23), 
        13,skillBuyPlayer(25000,source,21), 
    } 
end 
addEvent ("skillBuy", true) 
addEventHandler ("skillBuy", getRootElement(),skillButton) 

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