Nasa47 Posted August 1, 2014 Share Posted August 1, 2014 السلام عليكم بالله شوفولي وش قصصة ذا الكود, مو جاي يحفظ الداتا local Stats = { [22] = { 69 }; [23] = { 70 }; [24] = { 71 }; [25] = { 72 }; [26] = { 73 }; [27] = { 74 }; [28] = { 75 }; [29] = { 76 }; [30] = { 77 }; [31] = { 78 }; [34] = { 79 }; }; function stats ( ammo, attacker, weapon, bodypart ) if ( attacker ) then if ( getElementType ( attacker ) == "player") then wepID = getWeaponNameFromID ( weapon ) gStat = getPedStat ( attacker, Stats[tonumber(weapon)][1] ) setPedStat ( attacker, Stats[tonumber(weapon)][1],gStat + 100 ) end end end addEventHandler ( "onPlayerWasted", getRootElement(), stats) addEventHandler('onPlayerQuit',root, function() local vAcc = getPlayerAccount(source) if not vAcc or isGuestAccount(vAcc) then return end setAccountData(vAcc,'w69', getPedStat (source, 69)) setAccountData(vAcc,'w71', getPedStat (source, 71)) setAccountData(vAcc,'w72', getPedStat (source, 72)) setAccountData(vAcc,'w73', getPedStat (source, 73)) setAccountData(vAcc,'w74', getPedStat (source, 74)) setAccountData(vAcc,'w75', getPedStat (source, 75)) setAccountData(vAcc,'w76', getPedStat (source, 76)) setAccountData(vAcc,'w77', getPedStat (source, 77)) setAccountData(vAcc,'w78', getPedStat (source, 78)) setAccountData(vAcc,'w79', getPedStat (source, 79)) end ) addEventHandler('onPlayerLogin',root, function(_,acc) local d69 = getAccountData(acc,'w69') local d71 = getAccountData(acc,'w71') local d72 = getAccountData(acc,'w72') local d73 = getAccountData(acc,'w73') local d74 = getAccountData(acc,'w74') local d75 = getAccountData(acc,'w75') local d76 = getAccountData(acc,'w76') local d77 = getAccountData(acc,'w77') local d78 = getAccountData(acc,'w78') local d79 = getAccountData(acc,'w79') if ( d69 ) then setPedStat(source, 69, tonumber(d69)) setPedStat(source, 71, tonumber(d71)) setPedStat(source, 72, tonumber(d72)) setPedStat(source, 73, tonumber(d73)) setPedStat(source, 74, tonumber(d74)) setPedStat(source, 75, tonumber(d75)) setPedStat(source, 76, tonumber(d76)) setPedStat(source, 77, tonumber(d77)) setPedStat(source, 78, tonumber(d78)) setPedStat(source, 79, tonumber(d79)) end end ) Link to comment
nxFairlywell Posted August 1, 2014 Share Posted August 1, 2014 ودي اصلح بس ماني في البيت وواضح الكود فيه اخطاء واجد Link to comment
TAPL Posted August 1, 2014 Share Posted August 1, 2014 /debugscript 3 Edit: الفاصلة الي حاطها في التيبل ما اعتقد تضبط , حط الفاصلة العادية Link to comment
Nasa47 Posted August 1, 2014 Author Share Posted August 1, 2014 /debugscript 3Edit: الفاصلة الي حاطها في التيبل ما اعتقد تضبط , حط الفاصلة العادية الا تضبط, انا مجربها كثير Link to comment
TAPL Posted August 1, 2014 Share Posted August 1, 2014 طيب شوف الدي بق إذا فيه اي خطأ و تأكد انك حاطه سيرفر بالميتا و يفضل تعدل سطر 17 if ( getElementType ( attacker ) == "player") then و تسويه كذا عشان الي يقتل نفسه ما يزيد if ( getElementType ( attacker ) == "player" and attacker ~= source ) then Link to comment
Nasa47 Posted August 1, 2014 Author Share Posted August 1, 2014 اصلاً هو مايقدر يقتل نفسه, كيف يقتل نفسه بـ ام4 او سباس؟ Link to comment
Max+ Posted August 1, 2014 Share Posted August 1, 2014 اصلاً هو مايقدر يقتل نفسه, كيف يقتل نفسه بـ ام4 او سباس؟ ياذكي لو يكتب مثلا kill او يموت بقنبلته Link to comment
TAPL Posted August 1, 2014 Share Posted August 1, 2014 سطر 18 ما اشوف له فائدة بالكود Link to comment
Nasa47 Posted August 1, 2014 Author Share Posted August 1, 2014 gStat = getPedStat ( attacker, Stats[tonumber(weapon)][1] ) --ياخذ الستاتس setPedStat ( attacker, Stats[tonumber(weapon)][1],gStat + 100 ) --يجيب الستاتس ويزيد عليها 100 Link to comment
Max+ Posted August 1, 2014 Share Posted August 1, 2014 شوف السكربت ذا , function saveWeaponStats(player) if (not player or not isElement(player)) then return end local account = getPlayerAccount(player) if (account and not isGuestAccount(account)) then local stats = "" for stat=69, 81 do local value = getPedStat(player, stat) stats = stats ..",".. stat ..";".. value end setAccountData(account, "weaponStats", stats) end end function loadWeaponStats(player) if (not player or not isElement(player)) then return end local account = getPlayerAccount(player) if (account and not isGuestAccount(account)) then local statsData = getAccountData(account,"weaponStats") local stats = split(statsData, ",") for k, v in ipairs(stats) do local stat = split(v, ";") setPedStat(player, tonumber(stat[1]), tonumber(stat[2])) end end end addEventHandler("onPlayerQuit",root,function () saveWeaponStats(source) end) addEventHandler("onPlayerLogin",root,function () loadWeaponStats(source) end) Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now