Jump to content

Rockyz

Members
  • Posts

    1,862
  • Joined

  • Days Won

    8

Everything posted by Rockyz

  1. local what = { ['race'] = {ip = 'ip', port = 'port', password = ''}, ['shooter'] = {ip = 'ip', port = 'port', password = ''}, ['RL'] = {ip = 'ip', port = 'port', password = ''} } addEventHandler('onPlayerCommand', root, function(cmd) if what[cmd] and tostring(what[cmd].ip) and tonumber(what[cmd].port) and tostring(what[cmd].password) then redirectPlayer(source, tostring(what[cmd].ip), tonumber(what[cmd].port), tostring(what[cmd].password)) end end)
  2. function getTop(num, dataname) local plrs = getElementsByType('player') table.sort(plrs, function(a, b) if not dataname then return getPlayerMoney(a)>getPlayerMoney(b) else return tonumber((getElementData(a, dataname) or 0))>tonumber((getElementData(b, dataname) or 0)) end end) local ta={} for k = 1, num do table.insert(ta, plrs[k] or '-') end return ta end
  3. local k = { {1, 3, 4}, {9, 59, 1, 4, 6}, {0, 1, 0, 4, 3}, {{2, 4}, {1, 2, 3, 4}}, {}, 'HI', } print(#k) -- 6 print(#k[1]) -- 3 print(#k[2]) -- 5 print(#k[3]) -- 5 print(#k[4]) -- 2 print(#k[4][1]) -- 2 print(#k[4][2]) -- 4 print(#k[5]) -- 0 print(#k[6]) -- 2
  4. MissionsName = { [1] = "value1", [2] = "value2", [3] = "value3", } aValue = 1 -- Number function outputNewValue( ) aValue = MissionsName [ aValue ] -- String outputChatBox ( aValue ) if ( aValue > #MissionsName ) then -- String - Number aValue = 1 else aValue = aValue +1 end end setTimer( outputNewValue , 5000 , 0 )
  5. ولكن انت ايضا راجع كودك
  6. يب فهمت قبل ماترد بس من زمان ماكتبت كود الكود يصير كذا : MissionsName = { [1] = 'value1', [2] = 'value2', [3] = 'value3', } aValue=1 function outputNewValue() if aValue>#MissionsName then aValue=1 end outputChatBox(MissionsName[aValue]) aValue = aValue+1 end setTimer(outputNewValue, 5000, 0)
  7. MissionsName = { [1] = 'value1', [2] = 'value2', [3] = 'value3', } aValue=1 function outputNewValue() outputChatBox(MissionsName[aValue]) aValue=(aValue+1)%#MissionsName end setTimer(outputNewValue, 5000, 0)
  8. مافي خطأ ركز !
  9. اطرح الاكواد كامل و RegisterPanel
  10. القسم غلط, اطرح موضوعك هنا
  11. انا ماقلت انه صح او غلط .. انا فقط اختصرت الموضوع اذا يبي يضيف احداثيات اكثر + ليش اجرب كودك اصلا ؟
  12. يفضل انك تحط تحقق من ان الألمنت (gui) مثلا: getElementType(element):find('gui-')
  13. toggleControl -- radar
  14. اطرح اكوادك في المكان الي استخدمت فيه هذا الفنكشن + عدل الفنكشن الى كذا ومابيجيك اخطاء: function convertNumber(number) local formatted = (number and type(number)=='number')and number or 0 while true do formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') if (k==0) then break end end return formatted end
  15. الغلط في كودك هو في setPlayerMoney لازم تحط بس ارقمنت الفلوس في الكلنت جرب: وتأكد انه في جهة السيرفر ! local dataName = 'Money'; -- Data name addEventHandler('onElementDataChange', root, function(theName) if(source and getElementType(source)=='player')and(theName == dataName)then local data = getElementData(source, dataName) if data and(type(data)=='number' or tonumber(data))then local data = tonumber(data) setPlayerMoney(source, data); end end end);
  16. addEventHandler('onResourceStart', root, function() local createdTable = executeSQLQuery('CREATE TABLE IF NOT EXISTS `restoreWeapons` (playerAccount, weaponsTable)'); end) function onPlayerQuit() local playerAccount = getPlayerAccount(source) if playerAccount and not isGuestAccount(playerAccount) then local accountName = getAccountName(playerAccount) local checkData = executeSQLQuery('SELECT * FROM `restoreWeapons` WHERE playerAccount = ?', accountName) local weps = getPedWeapons(source); if weps and type(weps) == 'table' then local weapons = toJSON(weps) if type(checkData) == 'table' then if #checkData == 0 then executeSQLQuery('INSERT INTO `restoreWeapons` (playerAccount, weaponsTable) VALUES(?, ?)', accountName, weapons) else executeSQLQuery('UPDATE `restoreWeapons` SET weaponsTable = ? WHERE playerAccount = ?', weapons, accountName) end end end end end addEventHandler('onPlayerQuit', root, onPlayerQuit) function onPlayerLogin(_, acc) local accountName = getAccountName(acc) local checkData = executeSQLQuery('SELECT * FROM `restoreWeapons` WHERE playerAccount = ?', accountName) if type(checkData) == 'table' and #checkData > 0 then local weapons = fromJSON(checkData[1].weaponsTable) if weapons and type(weapons) == 'table' then for _, weaponz in ipairs(weapons) do if weaponz.weapon and weaponz.ammo then giveWeapon(source, weaponz.weapon, weaponz.ammo); end end end end end addEventHandler('onPlayerLogin', root, onPlayerLogin) function getPedWeapons(ped) local playerWeapons = {} if ped and isElement(ped) and getElementType(ped) == 'ped' or getElementType(ped) == 'player' then for i=2,9 do local wep = getPedWeapon(ped,i) if wep and wep ~= 0 then table.insert(playerWeapons, {weapon = wep, ammo = getPedTotalAmmo(ped, i)}) end end else return false end return playerWeapons end
  17. Rockyz

    طلب

    جرب : local currentDimension = 7000; addCommandHandler('warptodim', function(p, cmd) currentDimension = currentDimension +1 if currentDimension > 8000 then currentDimension = 7000; end setElementDimension(p, currentDimension); outputChatBox(tostring(currentDimension), p, 0, 255, 0, true); end);
  18. 1- اطرح اكوادك كامل 2- لازم تقول وين الخطأ بالضبط و أي سطر
  19. الخطأ هو انك ماحطيت فنكشنات الدي اكس في رندر والخطأ الثاني انك حطيت التايمر فاضي يعني بأختصار مابيسوي شي ! جرب تعدل الكود الى : addEvent('outbut1', true) addEventHandler('outbut1', root, function() if not isEventHandlerAdded('onClientRender', root, showError) and not isTimer(errorTimer) then addEventHandler('onClientRender', root, showError); errorTimer = setTimer(function(), if isEventHandlerAdded('onClientRender', root, showError) then removeEventHandler('onClientRender', root, showError); end end, 5000, 1) end end ); function showError() dxDrawText('!! لديك الشخصية بالفعل', 367 - 1, 22 - 1, 1042 - 1, 84 - 1, tocolor(0, 0, 0, 255), 3.00, 'default-bold', 'center', 'center', true, true, false, true, false) dxDrawText('!! لديك الشخصية بالفعل', 367 + 1, 22 - 1, 1042 + 1, 84 - 1, tocolor(0, 0, 0, 255), 3.00, 'default-bold', 'center', 'center', true, true, false, true, false) dxDrawText('!! لديك الشخصية بالفعل', 367 - 1, 22 + 1, 1042 - 1, 84 + 1, tocolor(0, 0, 0, 255), 3.00, 'default-bold', 'center', 'center', true, true, false, true, false) dxDrawText('!! لديك الشخصية بالفعل', 367 + 1, 22 + 1, 1042 + 1, 84 + 1, tocolor(0, 0, 0, 255), 3.00, 'default-bold', 'center', 'center', true, true, false, true, false) dxDrawText('!! لديك الشخصية بالفعل', 367, 22, 1042, 84, tocolor(75, 178, 75, 255), 3.00, 'default-bold', 'center', 'center', true, true, false, true, false) end function isEventHandlerAdded( sEventName, pElementAttachedTo, func ) if type( sEventName ) == 'string' and isElement( pElementAttachedTo ) and type( func ) == 'function' then local aAttachedFunctions = getEventHandlers( sEventName, pElementAttachedTo ) if type( aAttachedFunctions ) == 'table' and #aAttachedFunctions > 0 then for i, v in ipairs( aAttachedFunctions ) do if v == func then return true end end end end return false end
×
×
  • Create New...