Jump to content

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


Booo

Recommended Posts

  • 3 weeks later...

سلام عليكمم !

كيفكم اخباركم علومكم

ان شاء الله طيبين : )

جبتلكم وظيفة من صنعي ندخل في صلب الموضوع

اولاً : اسم الوظيفة

  
BindAnimation 
  

ثانياً : فائدة الوظيفة

تتيح لك عمل زر للوحة +

وضعه بشكل تدريجي

اي

انه بيضهر شوي شوي

+

وعندك خيارين

سريع

بطيء

ثالثاً : Syntax الوظيفة

  
bool BindAnimation ( string Key, element Window, string Status ) 
  

رابعاً : كود الوظيفة

  
BindAnimation = function (Key, Window, Status) 
if tostring(Status) and tostring(Key) then           
if Window and getElementType ( Window ) == 'gui' then 
if (Status == "Fast") then 
bindKey(Key,"down",function () 
if guiGetVisible(Window) == false then 
guiSetVisible(Window,true) 
guiSetAlpha(Window,0.00) 
TimerFalse = setTimer(function() 
local Alpha = guiGetAlpha(Window) + 0.10 
guiSetAlpha(Window,Alpha) 
if Alpha == 0.80 and isTimer(TimerFalse) then 
killTimer(TimerFalse) 
showCursor ( true ) 
guiSetInputEnabled ( true ) 
end 
end 
end,200,1) 
else 
guiSetAlpha(Window,0.80) 
TimerTrue = setTimer(function() 
local Alph = guiGetAlpha(Window) - 0.10 
guiSetAlpha(Window,Alph) 
if Alph == 0.00 and isTimer(TimerTrue) then 
killTimer(TimerTrue) 
showCursor ( false ) 
guiSetInputEnabled ( false ) 
end 
end 
end,200,1) 
) 
end 
if (Status == "Slow") then 
bindKey(Key,"down",function () 
if guiGetVisible(Window) == false then 
guiSetVisible(Window,true) 
guiSetAlpha(Window,0.00) 
TimerFalse = setTimer(function() 
local Alpha = guiGetAlpha(Window) + 0.10 
guiSetAlpha(Window,Alpha) 
if Alpha == 0.80 and isTimer(TimerFalse) then 
killTimer(TimerFalse) 
showCursor ( true ) 
guiSetInputEnabled ( true ) 
end 
end 
end,600,1) 
else 
guiSetAlpha(Window,0.80) 
TimerTrue = setTimer(function() 
local Alph = guiGetAlpha(Window) - 0.10 
guiSetAlpha(Window,Alph) 
if Alph == 0.00 and isTimer(TimerTrue) then 
killTimer(TimerTrue) 
showCursor ( false ) 
guiSetInputEnabled ( false ) 
end 
end 
end,600,1) 
) 
else 
error("Bad Argmuent @3 Is Not (Fast Or Slow)") 
end 
else 
error("Bad Argmuent @3 Is Not (Fast Or Slow)") 
end 
else 
error("Bad Argmuent @2 Is Not (gui-)") 
end 
else 
error("Bad Argmuent @1 Is Not 'string' ") 
end 
  

ادري انه طويل بس معليه

خامساً : مثال الوظيفة

  
BindAnimation = function (Key, Window, Status) 
if tostring(Status) and tostring(Key) then           
if Window and getElementType ( Window ) == 'gui-' then 
if (Status == "Fast") then 
bindKey(Key,"down",function () 
if guiGetVisible(Window) == false then 
guiSetVisible(Window,true) 
guiSetAlpha(Window,0.00) 
TimerFalse = setTimer(function() 
local Alpha = guiGetAlpha(Window) + 0.10 
guiSetAlpha(Window,Alpha) 
if Alpha == 0.80 and isTimer(TimerFalse) then 
killTimer(TimerFalse) 
showCursor ( true ) 
guiSetInputEnabled ( true ) 
end 
end 
end,200,1) 
else 
guiSetAlpha(Window,0.80) 
TimerTrue = setTimer(function() 
local Alph = guiGetAlpha(Window) - 0.10 
guiSetAlpha(Window,Alph) 
if Alph == 0.00 and isTimer(TimerTrue) then 
killTimer(TimerTrue) 
showCursor ( false ) 
guiSetInputEnabled ( false ) 
end 
end 
end,200,1) 
) 
end 
if (Status == "Slow") then 
bindKey(Key,"down",function () 
if guiGetVisible(Window) == false then 
guiSetVisible(Window,true) 
guiSetAlpha(Window,0.00) 
TimerFalse = setTimer(function() 
local Alpha = guiGetAlpha(Window) + 0.10 
guiSetAlpha(Window,Alpha) 
if Alpha == 0.80 and isTimer(TimerFalse) then 
killTimer(TimerFalse) 
showCursor ( true ) 
guiSetInputEnabled ( true ) 
end 
end 
end,600,1) 
else 
guiSetAlpha(Window,0.80) 
TimerTrue = setTimer(function() 
local Alph = guiGetAlpha(Window) - 0.10 
guiSetAlpha(Window,Alph) 
if Alph == 0.00 and isTimer(TimerTrue) then 
killTimer(TimerTrue) 
showCursor ( false ) 
guiSetInputEnabled ( false ) 
end 
end 
end,600,1) 
) 
else 
error("Bad Argmuent @3 Is Not (Fast Or Slow)") 
end 
else 
error("Bad Argmuent @3 Is Not (Fast Or Slow)") 
end 
else 
error("Bad Argmuent @2 Is Not (gui-)") 
end 
else 
error("Bad Argmuent @1 Is Not 'string' ") 
end 
  
wnd = guiCreateWindow(11,22,33,44,"Test",false) 
BindAnimation("F1",wnd,"Slow") 
  

ملحوظة :

مولازم نافذة بس يكون اي شيء بس بصيغة

gui-

اذا واجهتك مشكلة تعال سكايب :

mohmmad15551

وسلام خير الختام

Edited by Guest
Link to comment

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

setPlayerColorToTeamColor

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

الوظيفة سيرفر فقط

Syntax -نروح للساينتاكس

bool setPlayerColorToTeamColor ( player Player ) 
  

الارقيومنت المطلوبة-Required Arguments:

Player = الاعب الي تبي تغير لون اسمه للون فريقه

الوظيفة

function setPlayerColorToTeamColor ( Player ) 
    if getElementType (Player) == "player" then  
        local playerTeam = getPlayerTeam ( player ) 
        if ( playerTeam ) then 
            local playername = getPlayerName( Player )  
            if playername:find("#%x%x%x%x%x%x") then 
                local playername = playername:gsub("#%x%x%x%x%x%x","") 
                if playername:len() > 0 then 
                    if ( setPlayerName(Player, playername)) then 
                        local r, g, b = getTeamColor( playerTeam ) 
                        setPlayerNametagColor(Player , r, g, b) 
                    end 
                else 
                    setPlayerName(Player, "NoName"..tostring(math.random(1,10000)))  
                end 
            else 
                local r, g, b = getTeamColor( playerTeam ) 
                setPlayerNametagColor(Player, r, g, b) 
            end 
        else 
            outputDebugString( "bad arguments 2 :"..getPlayerName ( Player ) .. " isn't on a team",  1 ) 
        end 
    else 
        outputDebugString("Bad arguments 1 :the source is not a player", 1 ) 
    end 
end  

واخير اشكر نصور لأنه صلح الأخطاء بالكود*

Link to comment
  • 1 month later...

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

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

ذي رح تكون اول فنكشن لي

OnGUIClicked

[DONE]* : شكر خاص

شرح للفنشكن

! هو عبارة عند الظغط على الوحة يصير حدث

Parameters

  
string mouseButton, string buttonState, player playerGUIClicked 
  

mouseButton: A string representing the mousebutton that was clicked. This might be left, middle or right

buttonState: A string representing what state the button clicked is in. This might be up or down

playerGuiClicked: The Player That Clicked On The GUI

Source

The Source Of This Event Is The Gui That Got clicked By The Player

Example

This Example Is When You Press The Panel Disappear

  
addEventHandler('onGUIClicked', Cursor, 
    function ( ) 
if source == اسم اللوحه then 
        guiSetVisible ( Win , false ) 
        showCursor ( false ) 
    end 
end 
) 
  
  

وهذا هو الفنكشن

يمكنك الإستفادة منه بطرق عديدة !

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

Edited by Guest
Link to comment

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

addEventHandler 

هذا يجيبلك افنت من اللعبة المفروض تحط

addEvent 

وثانيا انت قلت اذا ضغط على زر يسوي حدث لاكن انت الي حددت الحدث انه يفتح اللوحة وجايب اسم من عندك

Link to comment
  • 2 weeks later...

getMonthAndDayName *اصلاح للفانشكن القديم*

فائدة الفانشكن //

يقوم بإرجاع اليوم باللغة الانجليزية Su-Sa

والشهر كذالك

مثال:

Friday, January

الفانشكن //

  
  
function getMonthAndDayName () 
    local time = getRealTime() 
    if (time.month == 1) then 
        m = "January" 
    elseif (time.month == 2) then 
        m = "February" 
    elseif (time.month == 3) then 
        m = "Mars" 
    elseif (time.month == 4) then 
        m = "April" 
    elseif (time.month == 5) then 
        m = "May" 
    elseif (time.month == 6) then 
        m = "June" 
    elseif (time.month == 7) then 
        m = "July" 
    elseif (time.month == 8 ) then 
        m = "Aug" 
    elseif (time.month == 9) then 
        m = "Sep" 
    elseif (time.month == 10) then 
        m = "Oct" 
    elseif (time.month == 11) then 
        m = "November" 
    elseif (time.month == 12) then 
        m = "December" 
    end 
    if (time.weekday == 0) then 
        d = "Sunday" 
    elseif (time.weekday == 1) then 
        d = "Monday" 
    elseif (time.weekday == 2) then 
        d = "Tuesday" 
    elseif (time.weekday == 3) then 
        d = "Wednesday" 
    elseif (time.weekday == 4) then 
        d = "Thursday" 
    elseif (time.weekday == 5) then 
        d = "Friday" 
    elseif (time.weekday == 6) then 
        d = "Saturday" 
    end 
    return m,d 
end 
  

مثال //

  
  
addEventHandler("onClientRender",root,function() 
    local month, day = getMonthAndDayName() 
    dxDrawText(""..day..", "..month.."",0,0,500,500) 
end 
) 
  

//

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