Jump to content

كود لآهنتم


Recommended Posts

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

:oops:8)

, ي شباب انا مسوي لوحة شراء رتب بـس بالساعات :)

, وكل شيء تمام والقريد لست تمام :lol::arrowleft:

, لكن فيه كود ناقصني الي هو إذا كانت ساعات اللاعب مثلا : 10 ساعات للشرطي , مايقدر ياخذ رتبه ساعاتها اكثر , < مثلا ادمن ساعاتها 90 :cry:

, الي عنده الكود يرفسه لي :lol::lol:

& Thank's

Link to comment

مشكور ي ماكس

بس ونا خوك ابيك تحدد لي الاخطاء الي في ملف السيرفر والكلنت إذا م عليك امر

---------------- 
--Settings 
---------------- 
local Key = "F4" 
  
local Admin = { 
{"كنق الهجولة","KNG2","1"}, 
{"كنق النصب","KNG1","2"}, 
{"مراقب2","SuperModerator2","50"}, 
{"مـراقب","SuperModerator1","35"}, 
{"مـشـرف2","Moderator2","25"}, 
{"مـشـرف","Moderator1","10"}, 
{"شرطي","Police1","5"}, من السطر ذا .,< 
{"شرطي","Police1","5"}, 
{"شرطي","Police1","5"}, 
{"شرطي","Police1","5"}, 
{"شرطي","Police1","5"}, 
{"شرطي","Police1","5"}, 
{"شرطي","Police1","5"}, 
{"شرطي","Police1","5"}, 
{"شرطي","Police1","5"}, 
{"شرطي","Police1","5"}, إلى ذا م عليك منه بعدلها سهله 
} 
  
---------------- 
-- Rank Window 
---------------- 
  
GUIEditor = { 
    button = {}, 
    label = {} 
} 
addEventHandler("onClientResourceStart", resourceRoot, 
    function() 
        w = guiCreateWindow(292, 151, 189, 381, "نظام شراء الرتب | Server Doran", false) 
        guiWindowSetSizable(w, false) 
        guiSetVisible ( w, false ) 
        guiSetAlpha(w, 1.00) 
        guiSetProperty(w, "CaptionColour", "FFEEBB0C") 
  
        grd = guiCreateGridList(9, 25, 171, 262, false, w) 
        guiGridListAddColumn(grd, "ألرتب", 0.5) 
        guiGridListAddColumn(grd, "الساعات", 0.5) 
        for k,v in ipairs ( Admin ) do 
        row = guiGridListAddRow(grd) 
        guiGridListSetItemText(grd, 0, 1, "كنق الهجولة", false, false) 
        guiGridListSetItemText(grd, 0, 2, "- 1 [ H ]", false, false) 
        guiGridListSetItemText(grd, 1, 1, "كنق النصب", false, false) 
        guiGridListSetItemText(grd, 1, 2, "- 2 [ H ]", false, false) 
        guiGridListSetItemText(grd, 2, 1, "مرشح شرطي", false, false) 
        guiGridListSetItemColor(grd, 2, 1, 36, 141, 214, 255) 
        guiGridListSetItemText(grd, 2, 2, "- 5 [ H ]", false, false) 
        guiGridListSetItemText(grd, 3, 1, "شرطي 1", false, false) 
        guiGridListSetItemColor(grd, 3, 1, 31, 26, 223, 255) 
        guiGridListSetItemText(grd, 3, 2, "- 15 [ H ]", false, false) 
        guiGridListSetItemText(grd, 4, 1, "شرطي 2", false, false) 
        guiGridListSetItemColor(grd, 4, 1, 4, 0, 185, 255) 
        guiGridListSetItemText(grd, 4, 2, "- 20 [ H ]", false, false) 
        guiGridListSetItemText(grd, 5, 1, "مرشح لمشرف", false, false) 
        guiGridListSetItemColor(grd, 5, 1, 38, 200, 206, 255) 
        guiGridListSetItemText(grd, 5, 2, "- 30 [ H ]", false, false) 
        guiGridListSetItemText(grd, 6, 1, "مشرف 1", false, false) 
        guiGridListSetItemColor(grd, 6, 1, 3, 240, 237, 255) 
        guiGridListSetItemText(grd, 6, 2, "- 40 [ H ]", false, false) 
        guiGridListSetItemText(grd, 7, 1, "مشرف 2", false, false) 
        guiGridListSetItemColor(grd, 7, 1, 2, 171, 169, 255) 
        guiGridListSetItemText(grd, 7, 2, "- 50 [ H ]", false, false) 
        guiGridListSetItemText(grd, 8, 1, "مراقب 1", false, false) 
        guiGridListSetItemColor(grd, 8, 1, 36, 254, 13, 255) 
        guiGridListSetItemText(grd, 8, 2, "- 60 [ H ]", false, false) 
        guiGridListSetItemText(grd, 9, 1, "مراقب 2", false, false) 
        guiGridListSetItemColor(grd, 9, 1, 18, 188, 0, 255) 
        guiGridListSetItemText(grd, 9, 2, "- 70 [ H ]", false, false) 
        guiGridListSetItemText(grd, 10, 1, "أدمـن 1", false, false) 
        guiGridListSetItemColor(grd, 10, 1, 254, 33, 33, 255) 
        guiGridListSetItemText(grd, 10, 2, "- 90 [ H ]", false, false) 
        guiGridListSetItemText(grd, 11, 1, "أدمـن 2", false, false) 
        guiGridListSetItemColor(grd, 11, 1, 190, 0, 0, 255) 
        guiGridListSetItemText(grd, 11, 2, "- 110 [ H ]", false, false) 
        guiGridListSetItemText(grd, 12, 1, "سوبر أدمــن", false, false) 
        guiGridListSetItemColor(grd, 12, 1, 244, 207, 4, 255) 
        guiGridListSetItemText(grd, 12, 2, "- 125 [ H ]", false, false) 
        guiGridListSetItemText(grd, 13, 1, "سبشل أدمن", false, false) 
        guiGridListSetItemColor(grd, 13, 1, 239, 95, 8, 255) 
        guiGridListSetItemText(grd, 13, 2, "- 150 [ H ]", false, false) 
        guiGridListSetItemText(grd, 14, 1, "أدمـن برو", false, false) 
        guiGridListSetItemColor(grd, 14, 1, 7, 108, 186, 255) 
        guiGridListSetItemText(grd, 14, 2, "- 200 [ H ]", false, false) 
        GUIEditor.label[1] = guiCreateLabel(99, 360, 98, 17, "Mod By General10", false, w) 
        guiSetFont(GUIEditor.label[1], "default-small") 
        guiLabelSetColor(GUIEditor.label[1], 250, 84, 2) 
        btn = guiCreateButton(31, 309, 128, 31, "* تـرقية -!", false, w) 
        guiSetProperty(btn, "NormalTextColour", "FFF3E506") 
        end 
    end 
) 
  
function centerWindow(center_window) 
    local screenW,screenH=guiGetScreenSize() 
    local windowW,windowH=guiGetSize(center_window,false) 
    local x,y = (screenW-windowW)/2,(screenH-windowH)/2 
    guiSetPosition(center_window,x,y,false) 
end 
  
بس ذي فيها اخطاء م ادري ايش هي بالضبط 
General10 = function ( ) 
 local row, col = guiGridListGetSelectedItem ( grd )  
local grp = tostring ( guiGridListGetItemText(grd,row, 0, 1 )); 
local Sa3at = tostring ( guiGridListGetItemText(grd,row,4 )) 
local Esm = tostring ( guiGridListGetItemText(grd,row,2 )) 
   if ( row and col and row ~= -1 and col ~= -1 ) then 
triggerServerEvent("Accept:the:request",localPlayer,grp,Sa3at,Esm) 
  else 
  outputChatBox("* Please Select Rank",255,0,0,true) 
  end 
end 
addEventHandler("onClientGUIClick",btn,General10,false) 
-------------- 
-- Bind Key 
-------------- 
General = function () 
    guiSetVisible(w,not guiGetVisible(w)) 
    showCursor(guiGetVisible(w)) 
end 
bindKey(Key,"down",General) 

server ----

  
group_add = function ( grp,Sa3at,Esm ) 
    local account = getAccountName(getPlayerAccount(source)); 
    if isGuestAccount(getPlayerAccount(source)) then return outputChatBox(" You not registre",source,255,0,0,true); end 
    if isObjectInACLGroup("user."..account, aclGetGroup(tostring(grp))) then return outputChatBox("You have been this Rank  ! ",source,255,0,0,true); end 
    local sValue = getElementData( source,'PlayTime' ) 
    if not sValue then sValue = '0:0:0' end 
    local data = split(sValue,':') 
    local hour = tonumber( data[1] )   
    if hour == nil or not tonumber(hour) then hour = 0 end 
    if ( hour >= tonumber(Sa3at))  then 
        aclGroupAddObject (aclGetGroup( tostring(grp)),"user."..account); 
        outputChatBox("You Rank Have been Succesfully | "..Name,source,0,255,0,true); 
    else 
        outputChatBox("You not have hours",source,255,0,0,true); 
    end 
end 
addEvent("Accept:the:request",true) 
addEventHandler("Accept:the:request",root,group_add) 

قسم بالله يومين لاحس مخي المود ذا

هو شغال بس لما اسوي اختيار مايجي اي شيء :/

الديبق يقول حوله لصيغة يو تي اف 8

حولته وخلاص وخر الديبق

جت مشكله ثانيه الي هي لما اختار الرتبه م يجي حسابي بالقروب :cry::cry::cry:

Link to comment
ايش الاخطاء اللي تطلع لك في الديبق ؟

+ ايش اللي ماضبط بالكود ؟

الديبق مافيه اخطاء بس م كان يشتغل المود وعرفت ليه

الكلنت صيغته

ANSI

حولتها إلى

UTF-8

واشتغل

بس المشكله إني م اقدر اختار رتبه

يعني اضغط على ترقية او اختيار رتبه

م كأني سويت شيء

يعني ما كأنه فيه اكواد تعطي ادمنيه :/

++++++++++++++

اعتقد الخطأ هنا

Client :

General10 = function ( ) 
 local row, col = guiGridListGetSelectedItem ( grd )  
local grp = tostring ( guiGridListGetItemText(grd,row, 0, 1 )); 
local Sa3at = tostring ( guiGridListGetItemText(grd,row,4 )); 
local Esm = tostring ( guiGridListGetItemText(grd,row,2 )); 
   if ( row and col and row ~= -1 and col ~= -1 ) then 
triggerServerEvent("Accept:the:request",localPlayer,grp,Sa3at,Esm); 
  else 
  outputChatBox("* Please Select Rank",255,0,0,true); 
  end 
end 
addEventHandler("onClientGUIClick",btn,General10,false); 

__

Server :

  
group_add = function ( grp,Sa3at,Esm ) 
    local account = getAccountName(getPlayerAccount(source)); 
    if isGuestAccount(getPlayerAccount(source)) then return outputChatBox(" * You not register",source,255,0,0,true); end 
    if isObjectInACLGroup("user."..account, aclGetGroup(tostring(grp))) then return outputChatBox("** You have this Rank  ! ",source,255,0,0,true); end 
    local sValue = getElementData( source,'PlayTime' ) 
    if not sValue then sValue = '0:0:0' end 
    local data = split(sValue,':') 
    local hour = tonumber( data[1] )   
    if hour == nil or not tonumber(hour) then hour = 0 end 
    if ( hour >= tonumber(Sa3at))  then 
        aclGroupAddObject (aclGetGroup( tostring(grp)),"user."..account); 
        outputChatBox("** You Have Been Succesfully | "..Esm,source,0,255,0,true); 
    else 
        outputChatBox("**You not have hours",source,255,0,0,true); 
    end 
end 
addEvent("Accept:the:request",true) 
addEventHandler("Accept:the:request",root,group_add) 

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

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

Function Name: cheekTime

Syntax :

cheekTime( time to cheek, Group in acl ) 

Ptime = Player Time to cheek

Group = to add player in Group

function cheekTime( 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( ) 
    cheekTime( 100, "admin" ) 
end ) 

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

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

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