Jump to content

Levelsytem export


BrianDUTCH

Recommended Posts

Hello, I need help with a export to get Exp by getting a cashbox.. 

Levelsystem serverside code:

function setExp(playerS,name,amount)
local player = getPlayerFromName(name)
local account = getPlayerAccount(playerS)
local accName = getAccountName(account)
if isObjectInACLGroup("user."..accName,aclGetGroup("Admin")) then
if getElementType(player) == "player" and tonumber(amount) then
setElementData(player,"kill.level",getElementData(player,"kill.level") + amount)
outputChatBox("Your Experience level was increased by "..getPlayerName(playerS).." ("..amount.."%)",player,0,255,0)
outputChatBox(getPlayerName(player).."'s Experience level was increased.",playerS,0,255,0)
else
outputChatBox("Failed to give because the player/amount was wrong.",playerS,255,255,0)
end
end
end
addCommandHandler("setExp",setExp,false,false)

cashbox code after take CB:

addEventHandler("onPickupHit", root, function(player)
    if source == bag then
        if getElementType(player) == "player" then
            if isPedInVehicle(player) then return end
                destroyElement(bag)
                randomCash = math.random(10000, 100000)
                randomArmour = math.random(5, 50)
                exports.levelsystem:setExp (getPlayerName(playerS), getPlayerFromName, math.random (8) )
                outputChatBox("You have found $"..tostring(randomCash)..", "..tostring(randomArmour).."% Armour", player, 0, 255, 0)
                givePlayerMoney(player, randomCash)
                setPedArmor(player, getPedArmor(player) + randomArmour)
            
                destroyElement(bagBlip)
                setTimer(createMysteryBag, 1000, 1)
        end
    end
end )

 

error:

cashbox\mbag_s.lua:40: call: failed to call 'levelsystem:setExp' ][string"?"]

I'm using this level system: https://community.multitheftauto.com/index.php?p=resources&s=details&id=11050

Cashbox : https://community.multitheftauto.com/index.php?p=resources&s=details&id=11612

Link to comment
On 2017. 08. 10. at 21:42, BrianDUTCH said:

Hello, I need help with a export to get Exp by getting a cashbox.. 

Levelsystem serverside code:

 


function setExp(playerS,name,amount)
local player = getPlayerFromName(name)
local account = getPlayerAccount(playerS)
local accName = getAccountName(account)
if isObjectInACLGroup("user."..accName,aclGetGroup("Admin")) then
if getElementType(player) == "player" and tonumber(amount) then
setElementData(player,"kill.level",getElementData(player,"kill.level") + amount)
outputChatBox("Your Experience level was increased by "..getPlayerName(playerS).." ("..amount.."%)",player,0,255,0)
outputChatBox(getPlayerName(player).."'s Experience level was increased.",playerS,0,255,0)
else
outputChatBox("Failed to give because the player/amount was wrong.",playerS,255,255,0)
end
end
end
addCommandHandler("setExp",setExp,false,false)

 

cashbox code after take CB:

 


addEventHandler("onPickupHit", root, function(player)
    if source == bag then
        if getElementType(player) == "player" then
            if isPedInVehicle(player) then return end
                destroyElement(bag)
                randomCash = math.random(10000, 100000)
                randomArmour = math.random(5, 50)
                exports.levelsystem:setExp (getPlayerName(playerS), getPlayerFromName, math.random (8) )
                outputChatBox("You have found $"..tostring(randomCash)..", "..tostring(randomArmour).."% Armour", player, 0, 255, 0)
                givePlayerMoney(player, randomCash)
                setPedArmor(player, getPedArmor(player) + randomArmour)
            
                destroyElement(bagBlip)
                setTimer(createMysteryBag, 1000, 1)
        end
    end
end )

 

 

error:

 


cashbox\mbag_s.lua:40: call: failed to call 'levelsystem:setExp' ][string"?"]

 

I'm using this level system: https://community.multitheftauto.com/index.php?p=resources&s=details&id=11050

Cashbox : https://community.multitheftauto.com/index.php?p=resources&s=details&id=11612

This means that your meta doesn't contain the export. You may also try exports['levelsystem']:setExp()

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