Jump to content

-.Paradox.-

Members
  • Posts

    1,239
  • Joined

  • Last visited

Posts posted by -.Paradox.-

  1. Maybe you should first test it.
    exports.scoreboard:scoreboardAddColumn("Level") 
      
    local levels = { 
        {100,1}, 
        {200,2}, 
        {300,3}, 
        {400,4}, 
        {500,5}, 
        {1000,6}, 
        {2500,7}, 
        {5000,8}, 
        {7000,9}, 
        {10000,10}, 
        {15000,11}, 
        {20000,12}, 
        {30000,13}, 
        {55000,14}, 
        {65000,15} 
    } 
      
    local getLevel = function (xp,level) 
        for i=level,#levels do 
            local position = levels[i] 
            if xp => position[1] then 
                return position[2] 
            end 
        end 
    end 
      
    function win(ammo, killer, weapon, bodypart) 
        if (killer and killer ~= source) then 
            local H = getElementData(killer, "ExP")  or 0 
            local S = getElementData(killer, "Level") or 0 
            local killer1 = getPlayerName(killer) 
            local noob = getPlayerName(source) 
            setElementData(killer, "ExP", tonumber(H)+math.random ( 10, 80 ) ) 
            local newLevel = getLevel(H,S+1) 
            if newLevel and newLevel ~= S then 
                setElementData(killer, "Level", "Lvl ".. tostring(newLevel) .." ! ") 
                triggerClientEvent ( killer, "playSound", killer ) 
            end 
        end 
        local H = getElementData ( source, "ExP" ) or 0 
        setElementData ( source, "ExP", tonumber ( H ) - math.random ( 5, 50 ) ) 
    end 
    addEventHandler( "onPlayerWasted", getRootElement(), win) 
      
    function onLogin (_,account) 
        setElementData(source, "Level", getAccountData(account, "lvl") or "0") 
        setElementData(source, "ExP", getAccountData(account, "exp") or "0") 
    end 
    addEventHandler ("onPlayerLogin", root, onLogin) 
      
    function saveData(thePlayer, theAccount) 
        if (theAccount and not isGuestAccount(theAccount)) then 
            setAccountData (theAccount, "lvl", getElementData(thePlayer, "Level")) 
            setAccountData (theAccount, "exp", getElementData(thePlayer, "ExP")) 
        end 
    end 
      
    addEventHandler ("onPlayerQuit", root, function () saveData(source, getPlayerAccount(source)) end) 
    addEventHandler ("onPlayerLogout", root, function (prev) saveData(source, prev) end) 
    

    ok i will test ...and thanks dude.

  2. I have another trouble if player like example have in experience 112 he don't move to level 1.

    P.S : It was working fine.

    here's the lua

    exports.scoreboard:scoreboardAddColumn("Level") 
    local levels = {[100] = 1, [200] = 2, [300] = 3, [400] = 4, [500] = 5, [1000] = 6, [2500] = 7, [5000] = 8, [7000] = 9, [10000] = 10, [15000] = 11, [20000] = 12, [30000] = 13, [55000] = 14, [65000] = 15} 
    function win(ammo, killer, weapon, bodypart) 
        if (killer and killer ~= source) then 
            local H = getElementData(killer, "ExP") 
            local S = getElementData(killer, "Level") 
            local killer1 = getPlayerName(killer) 
            local noob = getPlayerName(source) 
            setElementData(killer, "ExP", tonumber(H)+math.random ( 10, 80 ) ) 
            if levels[tonumber(H)] then 
                setElementData(killer, "Level", "Lvl ".. tostring(levels[tonumber(H)]) .." ! ") 
                triggerClientEvent ( killer, "playSound", killer ) 
            end 
        end 
        local H = getElementData ( source, "ExP" ) or 0 
        setElementData ( source, "ExP", tonumber ( H ) - math.random ( 5, 50 ) ) 
    end 
    addEventHandler( "onPlayerWasted", getRootElement(), win) 
      
    function onLogin (_,account) 
        setElementData(source, "Level", getAccountData(account, "lvl") or "0") 
        setElementData(source, "ExP", getAccountData(account, "exp") or "0") 
    end 
    addEventHandler ("onPlayerLogin", root, onLogin) 
      
    function saveData(thePlayer, theAccount) 
        if (theAccount and not isGuestAccount(theAccount)) then 
            setAccountData (theAccount, "lvl", getElementData(thePlayer, "Level")) 
            setAccountData (theAccount, "exp", getElementData(thePlayer, "ExP")) 
        end 
    end 
      
    addEventHandler ("onPlayerQuit", root, function () saveData(source, getPlayerAccount(source)) end) 
    addEventHandler ("onPlayerLogout", root, function (prev) saveData(source, prev) end) 
    

  3. I have another trouble if player like example have in experience 112 he don't move to level 1.

    P.S : It was working fine.

    here's the lua

    exports.scoreboard:scoreboardAddColumn("Level") 
    local levels = {[100] = 1, [200] = 2, [300] = 3, [400] = 4, [500] = 5, [1000] = 6, [2500] = 7, [5000] = 8, [7000] = 9, [10000] = 10, [15000] = 11, [20000] = 12, [30000] = 13, [55000] = 14, [65000] = 15}  
    function win(ammo, killer, weapon, bodypart) 
        if (killer and killer ~= source) then 
            local H = getElementData(killer, "ExP") 
            local S = getElementData(killer, "Level") 
            local killer1 = getPlayerName(killer) 
            local noob = getPlayerName(source) 
            setElementData(killer, "ExP", tonumber(H)+math.random ( 10, 80 ) ) 
            if levels[tonumber(H)] then 
                setElementData(killer, "Level", "Lvl ".. tostring(levels[tonumber(H)]) .." ! ") 
                triggerClientEvent ( killer, "playSound", killer ) 
            end 
        end 
        local H = getElementData ( source, "ExP" ) or 0 
        setElementData ( source, "ExP", tonumber ( H ) - math.random ( 5, 50 ) ) 
    end 
    addEventHandler( "onPlayerWasted", getRootElement(), win) 
      
    function onLogin (_,account) 
        setElementData(source, "Level", getAccountData(account, "lvl") or "0") 
        setElementData(source, "ExP", getAccountData(account, "exp") or "0") 
    end 
    addEventHandler ("onPlayerLogin", root, onLogin) 
      
    function saveData(thePlayer, theAccount) 
        if (theAccount and not isGuestAccount(theAccount)) then 
            setAccountData (theAccount, "lvl", getElementData(thePlayer, "Level")) 
            setAccountData (theAccount, "exp", getElementData(thePlayer, "ExP")) 
        end 
    end 
      
    addEventHandler ("onPlayerQuit", root, function () saveData(source, getPlayerAccount(source)) end) 
    addEventHandler ("onPlayerLogout", root, function (prev) saveData(source, prev) end) 
    

  4. Hello all i want set this code to onPlayerWasted i tried it but dont want to work here is the lua

    exports.scoreboard:addScoreboardColumn("WepPoints",getRootElement(),6,60) 
      
    function PlayerKill ( killer, weapon, bodypart) 
    local slot = getPedWeapon(killer) 
      
    for _,player in ipairs(getElementsByType("player")) do 
    bindKey(player,"next_weapon",PlayerKill) 
    bindKey(player,"previous_weapon",PlayerKill) 
      
      
      
    if (killer and killer ~= source) then 
    if ( bodypart == 9) then 
    setPedStat(killer, stat, getPedStat(killer, stat)+5) 
    setElementData(killer,"WepPoints",tonumber(getPedStat(killer,stat))) 
      
    elseif (killer and killer ~= source) then 
    if ( bodypart == -- s8) --> then 
    setPedStat(killer, stat, getPedStat(killer, stat)+1) 
    setElementData(killer,"WepPoints",tonumber(getPedStat(killer,stat))) 
      
    elseif (killer and killer ~= source) then 
    if ( bodypart == 7) then 
    setPedStat(killer, stat, getPedStat(killer, stat)+1) 
    setElementData(killer,"WepPoints",tonumber(getPedStat(killer,stat))) 
      
    elseif (killer and killer ~= source) then 
    if ( bodypart == 6) then 
    setPedStat(killer, stat, getPedStat(killer, stat)+1) 
    setElementData(killer,"WepPoints",tonumber(getPedStat(killer,stat))) 
      
    elseif (killer and killer ~= source) then 
    if ( bodypart == 5) then 
    setPedStat(killer, stat, getPedStat(killer, stat)+1) 
    setElementData(killer,"WepPoints",tonumber(getPedStat(killer,stat))) 
      
    elseif (killer and killer ~= source) then 
    if ( bodypart == 4) then 
    setPedStat(killer, stat, getPedStat(killer, stat)+1) 
    setElementData(killer,"WepPoints",tonumber(getPedStat(killer,stat))) 
      
    elseif (killer and killer ~= source) then 
    if ( bodypart == 3) then 
    setPedStat(killer, stat, getPedStat(killer, stat)+1) 
    setElementData(killer,"WepPoints",tonumber(getPedStat(killer,stat))) 
                                        end 
                                    end 
                                end 
                            end 
                        end 
                    end 
                end 
            end 
        end 
    end 
      
    addEventHandler("onPlayerWasted",getRootElement(),PlayerKill) 
    

    and ramdan kareem to all musulmans :D

  5. addCommandHandler ( "setlvl", 
        function ( thePlayer, _, who, theLevel ) 
            local theLevel = tonumber ( theLevel ) or 0 
            local playerWho = getPlayerFromName ( who ) 
            if ( playerWho ) then 
                exports.exp_system:setPlayerLevel ( playerWho, theLevel ) 
            end 
        end 
    ) 
    

  6. try this

    addCommandHandler ( "setexp", 
        function ( thePlayer, _, who, theExP ) 
            local theExP = tonumber ( theExP ) or 0 
            local playerWho = getPlayerFromName ( who ) 
            if ( playerWho ) then 
                exports.exp_system:setPlayerEXP ( playerWho, theExP ) 
            end 
        end 
    ) 
    

  7. function playLockingSound(vehicle) 
        if vehicle then 
        source = vehicle 
        end 
    local x,y,z = getElementPosition(source) 
    local lockSound = playSound3D("files/lock.mp3", x, y, z) 
    setSoundMaxDistance(lockSound, 50) 
    attachElements(lockSound, source) 
    beep(source) 
    end 
    addEvent("onClientVehicleLock", true) 
    addEventHandler("onClientVehicleLock", root, playLockingSound) 
      
    function playUnlockingSound() 
    stopVehicleAlarm(source) 
    local x,y,z = getElementPosition(source) 
    local unlockSound = playSound3D("files/unlock.mp3", x, y, z) 
    setSoundMaxDistance(unlockSound, 50) 
    attachElements(unlockSound, source) 
    beep(source) 
    setTimer(beep, 200, 1, source) 
    end 
    addEvent("onClientVehicleUnlock", true) 
    addEventHandler("onClientVehicleUnlock", root, playUnlockingSound) 
      
    function beep(vehicle) 
        if getVehicleOverrideLights(vehicle) ~= 2 then 
        setVehicleOverrideLights(vehicle, 2) 
        setTimer(setVehicleOverrideLights, 100, 1, vehicle, 1) 
        else 
        setVehicleOverrideLights(vehicle, 1) 
        setTimer(setVehicleOverrideLights, 100, 1, vehicle, 2) 
        end 
    end 
      
    

  8. addEventHandler("onClientVehicleStartEnter", root, 
    function(thePlayer, seat) 
    if seat == 0 then 
    if isVehicleLocked ( source ) then 
    local x,y,z = getElementPosition(source) 
    audio = playSound3D("lock.mp3", x,y,z,true) 
    end 
    end 
    end 
    ) 
      
    function stopMySound() 
    stopSound(audio) 
    end 
    addCommandHandler ( "stopalarm", stopMySound ) 
    

  9. Hello guys,

    i'm looking for a vehicle alarm system if player locked vehicle it will play sound lock.mp3

    if vehicle unlocked play unlock.mp3

    and if player hit you're it play alarm.mp3

  10.     function="getPlayerLevel" type="server" /> 
        function="setPlayerLevel" type="server" /> 
        function="getPlayerExP" type="server" /> 
        function="setPlayerExP" type="server" /> 
        function="getLevelData" type="server" /> 
    

    like that ?

×
×
  • Create New...