Jump to content

تصحيح كود ذذ


Recommended Posts

السلام عليكم و رحمه الله و بركاته شباب

الكود ذا ما يحفظ الالمنت ليش !

لو تقدرو تساعجوني لا تقصرو لاهنت ذذ

function playerLogin (thePreviousAccount, theCurrentAccount, autoLogin) 
    if  not (isGuestAccount (getPlayerAccount (source))) then 
        local accountData = getAccountData (theCurrentAccount, "funmodev2-money") 
        if (accountData) then 
            local playerMoney = getAccountData (theCurrentAccount, "funmodev2-money") 
            local playerSkin = getAccountData (theCurrentAccount, "funmodev2-skin") 
            local playerHealth = getAccountData (theCurrentAccount, "funmodev2-health") 
            local playerArmor = getAccountData (theCurrentAccount, "funmodev2-armor") 
            local playerX = getAccountData (theCurrentAccount, "funmodev2-x") 
            local playerY = getAccountData (theCurrentAccount, "funmodev2-y") 
            local playerZ = getAccountData (theCurrentAccount, "funmodev2-z") 
            local playerInt = getAccountData (theCurrentAccount, "funmodev2-int") 
            local playerDim = getAccountData (theCurrentAccount, "funmodev2-dim") 
            local playerWanted = getAccountData (theCurrentAccount, "funmodev2-wantedlevel") 
            local playerTeam = getAccountData (theCurrentAccount, "funmodev2-Team") 
            local playerJob = getAccountData (theCurrentAccount, "gms-job") 
            local playerOccupation = getAccountData (theCurrentAccount, "gms-occupation") 
            spawnPlayer (source, tonumber(playerX), tonumber(playerY), tonumber(playerZ) +1, 0, tonumber(playerSkin), tonumber(playerInt), tonumber(playerDim)) 
            setPlayerMoney (source, tonumber(playerMoney)) 
             
            setPlayerTeam(source, getTeamFromName(playerTeam)) 
            setElementData(source, "Job", tostring(playerJob)) 
            setElementData(source, "Occupation17", tostring(playerOccupation)) 
            setTimer (setElementHealth, 500, 1, source, tonumber(playerHealth)) 
            setTimer (setPedArmor, 500, 1, source, tonumber(playerArmor)) 
            setTimer (setPlayerWantedLevel, 500, 1, source, tonumber(playerWanted)) 
            setCameraTarget (source, source) 
            fadeCamera(source, true, 2.0) 
        else 
            spawnPlayer (source, 1481.0855712891, -1771.2996826172, 18.795753479004, 0, 20, 0, 0) 
            setPlayerMoney (source, 40000) 
            setCameraTarget (source, source) 
            fadeCamera(source, true, 2.0) 
            setPlayerTeam( source, getTeamFromName('Gms Team') ) 
            setElementData( source, 'Occupation17', 'Gms Team' ) 
            setElementData( source, 'Job', 'Gms Team' ) 
        end    
    end 
end 
addEventHandler ("onPlayerLogin", getRootElement(), playerLogin) 
  
function onQuit (quitType, reason, responsibleElement) 
    local account = getPlayerAccount (source) 
    if not (isGuestAccount (account)) then 
        local x,y,z = getElementPosition (source) 
        setAccountData (account, "funmodev2-money", tostring (getPlayerMoney (source))) 
        setAccountData (account, "funmodev2-skin", tostring (getPedSkin (source))) 
        setAccountData (account, "funmodev2-health", tostring (getElementHealth (source))) 
        setAccountData (account, "funmodev2-armor", tostring (getPedArmor (source))) 
        setAccountData (account, "funmodev2-x", x) 
        setAccountData (account, "funmodev2-y", y) 
        setAccountData (account, "funmodev2-z", z) 
        setAccountData (account, "funmodev2-int", tostring(getElementInterior (source))) 
        setAccountData (account, "funmodev2-dim", tostring(getElementDimension (source))) 
        setAccountData (account, "funmodev2-wantedlevel", tostring(getPlayerWantedLevel (source))) 
        setAccountData (account, "funmodev2-Team", getTeamName(getPlayerTeam(source))) 
        setAccountData (account, "gms-job", getElementData(source,"Job")) 
        setAccountData (account, "gms-occupation", getElementData(source,"Occupation17")) 
         
        if ( isPedDead(source) ) then return end 
        savePlayerWeapons ( source ) 
    end 
end 
addEventHandler ("onPlayerQuit", getRootElement(), onQuit) 
  
function onWasted(totalAmmo, killer, killerWeapon, bodypart, stealth) 
    savePlayerWeapons ( source ) 
end 
addEventHandler ("onPlayerWasted", getRootElement(), onWasted) 
  
function savePlayerWeapons ( player ) 
    if not( isElement(player) ) then return end 
    local account = getPlayerAccount (player) 
    if (isGuestAccount (account)) then return end 
     
    for i=0,12 do 
        local weapon = getPedWeapon (player, i) or 0 
        local ammo = getPedTotalAmmo (player, i) or 0 
        setAccountData (account, "funmodev2-weaponID"..tostring(i), tostring(weapon)) 
        setAccountData (account, "funmodev2-weaponAmmo"..tostring(i), tostring(ammo)) 
    end 
end 
  
function onPlayerSpawn( ) 
    local account = getPlayerAccount(source) 
    if (account) and not (isGuestAccount(account)) then 
        for i=0,12 do 
            local weapon = getAccountData (account, "funmodev2-weaponID"..tostring(i)) or 0 
            local ammo = getAccountData (account, "funmodev2-weaponAmmo"..tostring(i)) or 0 
            giveWeapon(source, tonumber(weapon), tonumber(ammo)) 
        end 
    end  
end 
addEventHandler("onPlayerSpawn", root, onPlayerSpawn ) 

:D

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