Jump to content

تحت التطوير :كود - Useful Arab functions


Booo

Recommended Posts

وظيفة بسيطة

الوظيفة عبارة عن صنع سيارة وركوبها :D

create Vehicle And Vehicle Entering = Cvave

Syntax

Only Server Side

Cvave(player thePlayer, int model, float x, float y ,float z) 

player thenPlayer = الاعب

int model = الاي دي

float x, float y ,float z = الاحداثيات

الكود

function Cvave(thePlayer, model, x, y, z) 
    if tonumber(model) then 
    if isElement(thePlayer) then 
    local Vehicle = createVehicle(model, x, y, z) 
    warpPedIntoVehicle(thePlayer, Vehicle) 
    end 
  end 
end 

مثال

function Cvave(thePlayer, model, x, y, z) 
    if tonumber(model) then 
    if isElement(thePlayer) then 
    local Vehicle = createVehicle(model, x, y, z) 
    warpPedIntoVehicle(thePlayer, Vehicle) 
    end 
  end 
end 
  
addCommandHandler("tn6el", function (player) 
local x, y, z = getElementPosition(player) 
Cvave(player, 411, x, y, z) 
end 
) 

صفحة الويكي == مااعرف :(

والسلام عليكم اتمنى تعجبكم الوظيفة البسيته :lol:

Link to comment

مع عدم الاهانه لكن اقولك ان الوظيفه مالها فائده

لو تلاحظ مكتوب

useful

هذا في اسم الموضوع = مفيد

اما كودك اعذرني اقولك انه مو مفيد يعني بدون

ما تسوي الي سويته انت

تقدر تسويه ببساطه

اعطيك مثال صغير

addCommandHandler ("test", 
 function (player, cmd, id, x,y,z) 
 if isElement (vehicle) then 
 destroyElement (vehicle) 
 end 
 vehicle = createVehicle (id, x,y,z) 
 warpPedIntoVehicle (player, vehicle) 
 end 
) 

مايحتاج تسوي لها وظيفه خاصه

عشان تحطها في امر في اخر شي

Link to comment

وظيفة مفيدة للتحقق من وقت اللاعب .. :

ادري انه من الممكن اختصارها بـ كم سطر بس القصد منها انها بجانب كلنت عشان تقدر تتحق وما تسوي تريقر لين يكون ع الوقت الصحيح

Function Name: cheekTime

Syntax :

CheckTime( time to Check, Group in acl ) 

Ptime = Player Time to Check

Group = to add player in Group

function CheckTime( Ptime, Group ) 
    if ( tonumber( Ptime ) and Group ) then 
         local sValue = getElementData( localPlayer,'Time' ) 
            if sValue then  
                 local data = split(sValue,':') 
                 local hour = tonumber( data[1] )   
                  if ( hour == nil or not tonumber( hour ) ) then 
                     return false 
              else    
                  if ( hour >= tonumber ( Ptime ) )  then 
                     return triggerServerEvent( 'addPlayer', localPlayer, Group ) 
                else 
                     return outputChatBox( "You Don't Have time requested" ) 
                        end 
                     end 
                else 
                  return false 
               end 
           else 
         return false 
     end 
end 

Ex .. Client Side :

addCommandHandler( "getAdminRank", function( ) 
    CheckTime( 100, "admin" ) 
end ) 

( addPlayer ) ملاحظة : عندما يكون وقت اللاعب صحيح سوف يقوم الكود بارسال تريقر بـ اسم

اي خطأ بـ الفنكشن او بق الرجاء وضع رد #

Edited by Guest
Link to comment

dxDraw3DText

Client : Function

Function Syntax :

dxDraw3DText

element dxDraw3DText( string text, int x, int y, int z , int scale = 2, string font = "default", int r = 255, int g = 255, int b = 255 ) 

Required Arguments

text : A string representing the text you wish to draw .

x, y, z : Three integers representing the world coordinates of where you want the text to be .

scale : An int representing the size of the font .

font : A string representing the font type, This CAN'T be a DX font element, It can ONLY be :

"default": Tahoma

"default-bold": Tahoma Bold

"clear": Verdana

"arial": Arial

"sans": Microsoft Sans Serif

"pricedown": Pricedown (GTA's theme text)

"bankgothic": Bank Gothic Medium

"diploma": Diploma Regular

"beckett": Beckett Regular

r, g, b : Three integers representing the RGB Color codes for the text .

Source Function :

local foont = {  
 [ "default" ], 
 [ "default-bold" ], 
 [ "clear" ], 
 [ "arial" ], 
 [ "sans"], 
 [ "pricedown" ], 
 [ "bankgothic" ], 
 [ "diploma" ], 
 [ "beckett" ] 
} 
  
  
function dxDraw3DText ( text, x, y, z, scale, r, g, b, font ) 
if tostring "text" and tonumber "x" and tonumber "y" and tonumber "z" and tonumber "scale" and tostring "font" and tonumber "r" and tonumber "b" and tonumber "g" and font == #foont then 
  local mX, mY, mZ = getElementPosition ( getLocalPlayer() ) 
    local marker = createMarker ( x, y, z, "cylinder", 1.5, 255, 0, 0, 0 ) 
      local cX, cY, cZ = getElementPosition ( marker ) 
          if getDistanceBetweenPoints3D ( mX, mY, mZ, cX, cY, cZ ) < 40  then 
            local sx, sy = getScreenFromWorldPosition ( x, y, z ) 
                    dxDrawText( ""..text.."", sx, sy, _, _, tocolor( r, g, b ), scale, ""..font.."") 
        end 
    end 
end 
addEventHandler ( "onClientRender", root, dxDraw3DText ) 
  

Exmple | مثال

Client :

addCommandHandler("draw", 
function ( )  
     local x, y, z = getElementPosition ( getLocalPlayer() ) 
        dxDraw3DText( "Welcome ", x, y, z, 2, 255,0,0, "arial") 
    end 
end 
) 

Edited by Guest
Link to comment

dxDraw3DText

Server : Function

Function Syntax :

dxDraw3DText

element dxDraw3DText( string text, int x, int y, int z , int scale = 2, string font = "default", int r = 255, int g = 255, int b = 255 ) 

Required Arguments

text : A string representing the text you wish to draw .

x, y, z : Three integers representing the world coordinates of where you want the text to be .

scale : An int representing the size of the font .

font : A string representing the font type, This CAN'T be a DX font element, It can ONLY be :

"default": Tahoma

"default-bold": Tahoma Bold

"clear": Verdana

"arial": Arial

"sans": Microsoft Sans Serif

"pricedown": Pricedown (GTA's theme text)

"bankgothic": Bank Gothic Medium

"diploma": Diploma Regular

"beckett": Beckett Regular

r, g, b : Three integers representing the RGB Color codes for the text .

Source Function :

local foont = {  
 [ "default" ], 
 [ "default-bold" ], 
 [ "clear" ], 
 [ "arial" ], 
 [ "sans"], 
 [ "pricedown" ], 
 [ "bankgothic" ], 
 [ "diploma" ], 
 [ "beckett" ] 
} 
  
  
function dxDraw3DText ( text, x, y, z, scale, r, g, b, font ) 
if tostring "text" and tonumber "x" and tonumber "y" and tonumber "z" and tonumber "scale" and tostring "font" and tonumber "r" and tonumber "b" and tonumber "g" and font == #foont then 
  local mX, mY, mZ = getElementPosition ( getLocalPlayer() ) 
    local marker = createMarker ( x, y, z, "cylinder", 1.5, 255, 0, 0, 0 ) 
      local cX, cY, cZ = getElementPosition ( marker ) 
          if getDistanceBetweenPoints3D ( mX, mY, mZ, cX, cY, cZ ) < 40  then 
            local sx, sy = getScreenFromWorldPosition ( x, y, z ) 
                    dxDrawText( ""..text.."", sx, sy, _, _, tocolor( r, g, b ), scale, ""..font.."") 
        end 
    end 
end 

Exmple | مثال

Client :

addCommandHandler("draw", 
function ( )  
     local x, y, z = getElementPosition ( getLocalPlayer() ) 
        dxDraw3DText( "Welcome ", x, y, z, 2, 255,0,0, "arial") 
    end 
end 
) 

وظيفة جميلة بالتوفيق

Link to comment

dxDraw3DText

Server : Function

Function Syntax :

dxDraw3DText

element dxDraw3DText( string text, int x, int y, int z , int scale = 2, string font = "default", int r = 255, int g = 255, int b = 255 ) 

Required Arguments

text : A string representing the text you wish to draw .

x, y, z : Three integers representing the world coordinates of where you want the text to be .

scale : An int representing the size of the font .

font : A string representing the font type, This CAN'T be a DX font element, It can ONLY be :

"default": Tahoma

"default-bold": Tahoma Bold

"clear": Verdana

"arial": Arial

"sans": Microsoft Sans Serif

"pricedown": Pricedown (GTA's theme text)

"bankgothic": Bank Gothic Medium

"diploma": Diploma Regular

"beckett": Beckett Regular

r, g, b : Three integers representing the RGB Color codes for the text .

Source Function :

local foont = {  
 [ "default" ], 
 [ "default-bold" ], 
 [ "clear" ], 
 [ "arial" ], 
 [ "sans"], 
 [ "pricedown" ], 
 [ "bankgothic" ], 
 [ "diploma" ], 
 [ "beckett" ] 
} 
  
  
function dxDraw3DText ( text, x, y, z, scale, r, g, b, font ) 
if tostring "text" and tonumber "x" and tonumber "y" and tonumber "z" and tonumber "scale" and tostring "font" and tonumber "r" and tonumber "b" and tonumber "g" and font == #foont then 
  local mX, mY, mZ = getElementPosition ( getLocalPlayer() ) 
    local marker = createMarker ( x, y, z, "cylinder", 1.5, 255, 0, 0, 0 ) 
      local cX, cY, cZ = getElementPosition ( marker ) 
          if getDistanceBetweenPoints3D ( mX, mY, mZ, cX, cY, cZ ) < 40  then 
            local sx, sy = getScreenFromWorldPosition ( x, y, z ) 
                    dxDrawText( ""..text.."", sx, sy, _, _, tocolor( r, g, b ), scale, ""..font.."") 
        end 
    end 
end 

Exmple | مثال

Client :

addCommandHandler("draw", 
function ( )  
     local x, y, z = getElementPosition ( getLocalPlayer() ) 
        dxDraw3DText( "Welcome ", x, y, z, 2, 255,0,0, "arial") 
    end 
end 
) 

وظيفة جميلة بالتوفيق

تسلم حبيبي :mrgreen:

Link to comment

dxDraw3DText

Server : Function

Function Syntax :

dxDraw3DText

element dxDraw3DText( string text, int x, int y, int z , int scale = 2, string font = "default", int r = 255, int g = 255, int b = 255 ) 

Required Arguments

text : A string representing the text you wish to draw .

x, y, z : Three integers representing the world coordinates of where you want the text to be .

scale : An int representing the size of the font .

font : A string representing the font type, This CAN'T be a DX font element, It can ONLY be :

"default": Tahoma

"default-bold": Tahoma Bold

"clear": Verdana

"arial": Arial

"sans": Microsoft Sans Serif

"pricedown": Pricedown (GTA's theme text)

"bankgothic": Bank Gothic Medium

"diploma": Diploma Regular

"beckett": Beckett Regular

r, g, b : Three integers representing the RGB Color codes for the text .

Source Function :

local foont = {  
 [ "default" ], 
 [ "default-bold" ], 
 [ "clear" ], 
 [ "arial" ], 
 [ "sans"], 
 [ "pricedown" ], 
 [ "bankgothic" ], 
 [ "diploma" ], 
 [ "beckett" ] 
} 
  
  
function dxDraw3DText ( text, x, y, z, scale, r, g, b, font ) 
if tostring "text" and tonumber "x" and tonumber "y" and tonumber "z" and tonumber "scale" and tostring "font" and tonumber "r" and tonumber "b" and tonumber "g" and font == #foont then 
  local mX, mY, mZ = getElementPosition ( getLocalPlayer() ) 
    local marker = createMarker ( x, y, z, "cylinder", 1.5, 255, 0, 0, 0 ) 
      local cX, cY, cZ = getElementPosition ( marker ) 
          if getDistanceBetweenPoints3D ( mX, mY, mZ, cX, cY, cZ ) < 40  then 
            local sx, sy = getScreenFromWorldPosition ( x, y, z ) 
                    dxDrawText( ""..text.."", sx, sy, _, _, tocolor( r, g, b ), scale, ""..font.."") 
        end 
    end 
end 

Exmple | مثال

Client :

addCommandHandler("draw", 
function ( )  
     local x, y, z = getElementPosition ( getLocalPlayer() ) 
        dxDraw3DText( "Welcome ", x, y, z, 2, 255,0,0, "arial") 
    end 
end 
) 

ايه صح نسيت لازم تحط معه onClientRender عشان النص مايختفي

Link to comment

dxDraw3DText

Server : Function

أولا الكود كلنت

ثانياً عندك اخطاء راح تسوي مصيبة ف السيرفر

انت مستخدم createMarker مع onClientRender

يعني كل جزء من الثانية راح يصير createMarker :lol:

وعندك أخطاء ف التحققات ..

Link to comment

من الاساس هو موب حاط رندر يعني مستحيل بيشتغل الكود ,لأن الدي اكس يحتاج رندر ,

ولو حط رندر بيكون جاب العيد مع الماركر , مثل ما قالك جعفر فوق ^

من ان بين مسوي مود كذا , فـ اتوقع ما يحتاج ذا الكود .

Link to comment

http://im71.gulfup.com/su3g0G.png

تصرف اقل مايقال عنه ، عمل صبياني

وظيفه تجلس تشتغل عليها ساعه والا ساعتين

ويجيك واحد ببرودة اعصاب يحذفها ويحط وظيفته

بحجة انه مسويها من قبل :mrgreen:

للمعلوميه ياوسام ترا كودك يختلف عن كودي

ولو تلاحظ

كودك يرجع قيمة جدول

function getPlayerAcls(thePlayer) 
    local acls = {} 
    local account = getPlayerAccount(thePlayer) 
    if (account) and not (isGuestAccount(account)) then 
        local accountName = getAccountName(account) 
        acls = {} 
        for i,group in ipairs(aclGroupList()) do 
            if (isObjectInACLGroup( "user." ..accountName, group)) then 
                local groupName = aclGroupGetName(group) 
                table.insert(acls, groupName) 
            end 
        end 
    end 
    return acls 
end 

بينما لو تدقق بالكود الي كاتبها

راح تلاحظ القيمه الي ترجع نصيه

function getPlayerAllGroups(player) 
    local account = getPlayerAccount ( player) 
    if ( isGuestAccount ( account ) ) then 
        return false 
    end 
                  local  AclList = {} 
                                  AclList["Groups"] = {} 
                  AclList["getGroups"] = {} 
        for _, group in ipairs ( aclGroupList() ) do 
                table.insert ( AclList["Groups"],aclGroupGetName ( group ) ) 
        end 
        for k ,v in pairs(AclList.Groups) do 
            if isObjectInACLGroup ( "user."..getAccountName ( account ), aclGetGroup (v) ) then 
                table.insert ( AclList["getGroups"],v) 
            end 
        end 
        return table.concat(AclList.getGroups, ",") 
end 

وايضا يالغالي اذا تبي تحذف كود خذ اذن المشرف قبل ماتسوي شي بالويكي

Link to comment

بسم الله الرحمن الرحيم

changeGridlistToNameVehicle

وظيفه تحول القريد لست الى اسامي السيارات

vehicleIDS = { 602, 545, 496, 517, 401, 410, 518, 600, 527, 436, 589, 580, 419, 439, 533, 549, 526, 491, 474, 445, 467, 604, 426, 507, 547, 585, 
405, 587, 409, 466, 550, 492, 566, 546, 540, 551, 421, 516, 529, 592, 553, 577, 488, 511, 497, 548, 563, 512, 476, 593, 447, 425, 519, 520, 460, 
417, 469, 487, 513, 581, 510, 509, 522, 481, 461, 462, 448, 521, 468, 463, 586, 472, 473, 493, 595, 484, 430, 453, 452, 446, 454, 485, 552, 431, 
438, 437, 574, 420, 525, 408, 416, 596, 433, 597, 427, 599, 490, 432, 528, 601, 407, 428, 544, 523, 470, 598, 499, 588, 609, 403, 498, 514, 524, 
423, 532, 414, 578, 443, 486, 515, 406, 531, 573, 456, 455, 459, 543, 422, 583, 482, 478, 605, 554, 530, 418, 572, 582, 413, 440, 536, 575, 534, 
567, 535, 576, 412, 402, 542, 603, 475, 449, 537, 538, 441, 464, 501, 465, 564, 568, 557, 424, 471, 504, 495, 457, 539, 483, 508, 571, 500, 
444, 556, 429, 411, 541, 559, 415, 561, 480, 560, 562, 506, 565, 451, 434, 558, 494, 555, 502, 477, 503, 579, 400, 404, 489, 505, 479, 442, 458, 
606, 607, 610, 590, 569, 611, 584, 608, 435, 450, 591, 594 } 
  
  
function changeGridlistToNameVehicle(gridlist,col) 
if not col then col = 1 end 
    if gridlist then 
        if getElementType ( GridList ) == "gui-gridlist" then 
        guiGridListClear (gridlist) 
            for k, v in pairs(vehicleIDS) do 
if getVehicleNameFromModel(v) ~= "" or nil then 
       guiGridListSetItemText (gridlist,guiGridListAddRow (gridlist),col,getVehicleNameFromModel(v), false, false ) 
end 
            end 
    end 
    end 
end 

مثآل

vehicleIDS = { 602, 545, 496, 517, 401, 410, 518, 600, 527, 436, 589, 580, 419, 439, 533, 549, 526, 491, 474, 445, 467, 604, 426, 507, 547, 585, 
405, 587, 409, 466, 550, 492, 566, 546, 540, 551, 421, 516, 529, 592, 553, 577, 488, 511, 497, 548, 563, 512, 476, 593, 447, 425, 519, 520, 460, 
417, 469, 487, 513, 581, 510, 509, 522, 481, 461, 462, 448, 521, 468, 463, 586, 472, 473, 493, 595, 484, 430, 453, 452, 446, 454, 485, 552, 431, 
438, 437, 574, 420, 525, 408, 416, 596, 433, 597, 427, 599, 490, 432, 528, 601, 407, 428, 544, 523, 470, 598, 499, 588, 609, 403, 498, 514, 524, 
423, 532, 414, 578, 443, 486, 515, 406, 531, 573, 456, 455, 459, 543, 422, 583, 482, 478, 605, 554, 530, 418, 572, 582, 413, 440, 536, 575, 534, 
567, 535, 576, 412, 402, 542, 603, 475, 449, 537, 538, 441, 464, 501, 465, 564, 568, 557, 424, 471, 504, 495, 457, 539, 483, 508, 571, 500, 
444, 556, 429, 411, 541, 559, 415, 561, 480, 560, 562, 506, 565, 451, 434, 558, 494, 555, 502, 477, 503, 579, 400, 404, 489, 505, 479, 442, 458, 
606, 607, 610, 590, 569, 611, 584, 608, 435, 450, 591, 594 } 
  
  
function changeGridlistToNameVehicle(gridlist,col) 
if not col then col = 1 end 
    if gridlist then 
        if getElementType ( GridList ) == "gui-gridlist" then 
        guiGridListClear (gridlist) 
            for k, v in pairs(vehicleIDS) do 
if getVehicleNameFromModel(v) ~= "" or nil then 
       guiGridListSetItemText (gridlist,guiGridListAddRow (gridlist),col,getVehicleNameFromModel(v), false, false ) 
end 
            end 
    end 
    end 
end 
  
addEventHandler( "onClientResourceStart",resourceRoot, 
    function ( ) 
    local carsList = guiCreateGridList ( 0.80, 0.10, 0.15, 0.60, true ) 
    local column = guiGridListAddColumn(carsList, "cars", 0.85 ) 
changeGridlistToNameVehicle(carsList) 
  
end 
) 
  
  

-

Link to comment

بسم الله الرحمن الرحيم

changeGridlistToNameVehicle

وظيفه تحول القريد لست الى اسامي السيارات

vehicleIDS = { 602, 545, 496, 517, 401, 410, 518, 600, 527, 436, 589, 580, 419, 439, 533, 549, 526, 491, 474, 445, 467, 604, 426, 507, 547, 585, 
405, 587, 409, 466, 550, 492, 566, 546, 540, 551, 421, 516, 529, 592, 553, 577, 488, 511, 497, 548, 563, 512, 476, 593, 447, 425, 519, 520, 460, 
417, 469, 487, 513, 581, 510, 509, 522, 481, 461, 462, 448, 521, 468, 463, 586, 472, 473, 493, 595, 484, 430, 453, 452, 446, 454, 485, 552, 431, 
438, 437, 574, 420, 525, 408, 416, 596, 433, 597, 427, 599, 490, 432, 528, 601, 407, 428, 544, 523, 470, 598, 499, 588, 609, 403, 498, 514, 524, 
423, 532, 414, 578, 443, 486, 515, 406, 531, 573, 456, 455, 459, 543, 422, 583, 482, 478, 605, 554, 530, 418, 572, 582, 413, 440, 536, 575, 534, 
567, 535, 576, 412, 402, 542, 603, 475, 449, 537, 538, 441, 464, 501, 465, 564, 568, 557, 424, 471, 504, 495, 457, 539, 483, 508, 571, 500, 
444, 556, 429, 411, 541, 559, 415, 561, 480, 560, 562, 506, 565, 451, 434, 558, 494, 555, 502, 477, 503, 579, 400, 404, 489, 505, 479, 442, 458, 
606, 607, 610, 590, 569, 611, 584, 608, 435, 450, 591, 594 } 
  
  
function changeGridlistToNameVehicle(gridlist,col) 
if not col then col = 1 end 
    if gridlist then 
        if getElementType ( GridList ) == "gui-gridlist" then 
        guiGridListClear (gridlist) 
            for k, v in pairs(vehicleIDS) do 
if getVehicleNameFromModel(v) ~= "" or nil then 
       guiGridListSetItemText (gridlist,guiGridListAddRow (gridlist),col,getVehicleNameFromModel(v), false, false ) 
end 
            end 
    end 
    end 
end 

مثآل

vehicleIDS = { 602, 545, 496, 517, 401, 410, 518, 600, 527, 436, 589, 580, 419, 439, 533, 549, 526, 491, 474, 445, 467, 604, 426, 507, 547, 585, 
405, 587, 409, 466, 550, 492, 566, 546, 540, 551, 421, 516, 529, 592, 553, 577, 488, 511, 497, 548, 563, 512, 476, 593, 447, 425, 519, 520, 460, 
417, 469, 487, 513, 581, 510, 509, 522, 481, 461, 462, 448, 521, 468, 463, 586, 472, 473, 493, 595, 484, 430, 453, 452, 446, 454, 485, 552, 431, 
438, 437, 574, 420, 525, 408, 416, 596, 433, 597, 427, 599, 490, 432, 528, 601, 407, 428, 544, 523, 470, 598, 499, 588, 609, 403, 498, 514, 524, 
423, 532, 414, 578, 443, 486, 515, 406, 531, 573, 456, 455, 459, 543, 422, 583, 482, 478, 605, 554, 530, 418, 572, 582, 413, 440, 536, 575, 534, 
567, 535, 576, 412, 402, 542, 603, 475, 449, 537, 538, 441, 464, 501, 465, 564, 568, 557, 424, 471, 504, 495, 457, 539, 483, 508, 571, 500, 
444, 556, 429, 411, 541, 559, 415, 561, 480, 560, 562, 506, 565, 451, 434, 558, 494, 555, 502, 477, 503, 579, 400, 404, 489, 505, 479, 442, 458, 
606, 607, 610, 590, 569, 611, 584, 608, 435, 450, 591, 594 } 
  
  
function changeGridlistToNameVehicle(gridlist,col) 
if not col then col = 1 end 
    if gridlist then 
        if getElementType ( GridList ) == "gui-gridlist" then 
        guiGridListClear (gridlist) 
            for k, v in pairs(vehicleIDS) do 
if getVehicleNameFromModel(v) ~= "" or nil then 
       guiGridListSetItemText (gridlist,guiGridListAddRow (gridlist),col,getVehicleNameFromModel(v), false, false ) 
end 
            end 
    end 
    end 
end 
  
addEventHandler( "onClientResourceStart",resourceRoot, 
    function ( ) 
    local carsList = guiCreateGridList ( 0.80, 0.10, 0.15, 0.60, true ) 
    local column = guiGridListAddColumn(carsList, "cars", 0.85 ) 
changeGridlistToNameVehicle(carsList) 
  
end 
) 
  
  

-

اح وش سويت وظيفة رائعه تسلم

:D

بس في خطا بسيط

function changeGridlistToNameVehicle(gridlist,col) 
if not col then col = 1 end 
    if gridlist then 
        if getElementType ( GridList ) == "gui-gridlist" then -- هنا GridList  بالكبير خلها بالصغير 

Link to comment
  • 3 weeks later...

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

اليوم جايب لكم وظيفة جديده

setFlasherLabel(element label, int speed) 

label = الليبل

speed = السرعه ليس ارقمنت مهم

السرعه تكون 1 = ثانية

ماذا تقوم الوظيفة

تقوم بعمل فلشر للليبل

يختفي ويرجع بالتدرج

فنكشن خطير والله

الكود :

function setFlasherLabel(label, speed) 
    if getElementType(label) ~= "gui-label" then return end 
    if not tonumber(speed) then speed = 1 end 
    addEventHandler("onClientRender", root, function( ) 
        local tick = getTickCount()/speed/1000 
        local color = math.abs(math.sin(-tick)) 
        guiSetAlpha(label, color) 
    end ) 
end 

مثال

function setFlasherLabel(label, speed) 
    if getElementType(label) ~= "gui-label" then return end 
    if not tonumber(speed) then speed = 1 end 
    addEventHandler("onClientRender", root, function( ) 
        local tick = getTickCount()/speed/1000 
        local color = math.abs(math.sin(-tick)) 
        guiSetAlpha(label, color) 
    end ) 
end 
  
for k,v in ipairs(getElementsByType("gui-label")) do 
    setFlasherLabel(v) 
end 

mopedsmile:برب مشوار

Link to comment

ذذ طيب شرايك بالطريقة هذي

addEventHandler ( "onClientRender", root,  
    function ( )     
        for i, v in ipairs ( getElementsByType ( "gui-label" ) ) do 
            local id = getElementID ( v ) 
            if id then 
                if string.find(id,"flasher") then 
                    local speed = string.gsub(id,"flasher","") 
                    local tick = getTickCount()/tonumber(speed)/1000 
                    local color = math.abs(math.sin(-tick))              
                    guiSetAlpha(v, color) 
                end 
            end 
        end 
    end  
) 
  
function setFlasherLabel ( label, speed ) 
    if label then 
        if not isElement ( label ) then return end 
        if getElementType(label) ~= "gui-label" then return end 
        if not tonumber(speed) then speed = 1 end 
        setElementID ( label, "flasher"..speed ) 
    end 
end 

for i, v in ipairs( getElementsByType ( "gui-label" ) ) do 
    setFlasherLabel ( v ) 
end 

Link to comment
  • 2 weeks later...

* guiSetPositionAllScreen(guiElement,ScreenHieght,ScreenWidht)

متنآسقه مع جميع الشاشاتguiالوظيفه فايدتها تخلي اي حاجه من

ScreenHight,ScreenWidth = Setting-Videoطول وعرض شاشتك فاللعبه تاخذها من

مايصير تآخذ مود غيركguiطبعآ عشآن تكون متناسق مع جميع الشاشات يعني تكون بنفس المكآن لجميع الشآشآت لازم تكون انت الي مصمم ال

مصممها غيركguiوتستخدم له ذي الوظيفه لأنه ذي الوظيفه تعتمد على حجم شاشتك , يمديك تستخدم مود غيرك يعني

حقته مو حقتكScreenHight,ScreenWidthبس بشرط انك تحط

الوظيفه :

function guiSetPositionAllScreen(guiElement,ScreenH,ScreenW) 
    local LocalScreenH,LocalScreenW = guiGetScreenSize() 
    if ( isElement(guiElement) ) then 
        if ( ScreenH and ScreenW ) then 
            local x,y = guiGetPosition(guiElement,false) 
            guiSetPosition(guiElement,LocalScreenH*(x/ScreenH),LocalScreenW*(y/ScreenW),false) 
        end 
    end 
end 

المثال :

  
button = guiCreateButton(100,100,70,30,"Button",false) 
guiSetPositionAllScreen(button,800,600) 

guiSetPositionAllScreen الي عند اسم منآسب للوظيفه غير ذا

اتمنى يحط ألأسم :)

Link to comment
button = guiCreateButton(100,100,70,30,"Button",false) 
guiSetPositionAllScreen(button,800,600) 

اخوي من وين جبت 800 و 600 و احداثيات الزر 100,100 ؟؟

كود مفيد جدا جدا يعطيك العافيه

  • Like 1
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...