
MR.S3D
Members-
Posts
732 -
Joined
-
Last visited
Everything posted by MR.S3D
-
function createclan() local xml = xmlLoadFile ("clans.xml") local clan = getElementData ( source, "clan" ) if not isGuestAccount ( getPlayerAccount(source) ) then setAccountData ( getPlayerAccount(source), "Clan", getElementData ( source, "clan" ) ) end local clanroot if (not xml) then xmlFile = xmlCreateFile(xml, "settings") clanroot = xmlCreateChild(xml, "clans") xmlNodeSetAttribute (clanroot,"clan", clan) else clanroot = xmlFindChild (xml,"clans",0) if clanroot then xmlNodeSetAttribute (clanroot,"clan", clan) else clanroot = xmlCreateChild(xml, "clans") xmlNodeSetAttribute (clanroot,"clan", clan) end end xmlSaveFile( xml ) xmlUnloadFile ( xml ) end addEvent ( "createclan", true ) addEventHandler ( "createclan", root, createclan )
-
https://wiki.multitheftauto.com/wiki/OnPlayerLogin خش الويكا وشوف Parameters اللي يجي داخل حدث الدخول Parameters == المتغيرات او المعايير اللي تجيك داخل قوس الوظيفة function (Parameters... ) account thePreviousAccount, account theCurrentAccount, bool autoLogin thePreviousAccount: االحساب السابق للاعب theCurrentAccount: الحساب الجديد اللي سجل دخوله به الأن autoLogin: حالة الدخول source --هو اللاعب نفسه اللي داخل الحدث فلو لاحظت في الويكا Source The source of this event is the player element that just logged in. يقولك ان الللاعب في هذا الحدث هو معرف ب source فلو جينا نستخدم هالحدث "onPlayerLogin" فلازم نسوي تعريف للحساب اللي توك سجلت فيه داخل وظيفة الحدث والحساب السابق مانبي نستخدمه فحطيته _ فصار function( _, newAcc) لازم بالترتيب مثل ماهو مرتب واسم المتغير اي اسم من راسك مايفرق واي شي ماتبي تسخدمته وتبي تتخطاه تحط _ بالنسبة لذي Lol = {} -- في البداية سوينا جدول فاضي Lol[source] = createBlipAttachedTo ( source, 56 ) -- اضفنا عنصر البيلب داخل جدول اللاعب if Lol[source] --- هذا يتأكد انه مضاف للجدول isElement -- وهذا عشان يتأكد انه عنصر ولا لا destroyElement ( Lol[source] ) --- وهذا عشان يحذف العنصر Lol[source] = nil --- ثم اخرجنا العنصر من الجدول واذا فيه شي مو واضح أسألني
-
اللكود صح وانا مجربه + شوف كود اسامه اضاف عليه حدث الخروج من الحساب
-
كنت ناسي () وعدلها The Best
-
Server Lol = {} addEventHandler( 'onPlayerLogin', root, function( _, acc ) local accName = getAccountName( acc ) if isObjectInACLGroup('user.'..accName, aclGetGroup('Console')) and not Lol[source] then Lol[source] = createBlipAttachedTo ( source, 56 ) end end) addEventHandler('onPlayerQuit', root,function ) if Lol[source] and isElement(Lol[source]) then destroyElement(Lol[source]) Lol[source] = nil end end)
-
مشكور على تقديمك لشروحات شرح رائع ومتعوب عليه وحبيت اسئلك وش فايدتها في lua وفي ايش ممكن استخدمها؟ وياليت تعطينا مثال وتحياتي
-
Great answer
-
Is the handler gone from the previous element? yes you should remove this handler then destroy element to prevent any errors
-
local confirmButton = guiCreateButton(5, 5, 90, 70, "SPAWN!", false, spawnConfirmWindow) addEventHandler("onClientGUIClick", confirmButton, spawnClientPlayer) --- if you need destroy removeEventHandler("onClientGUIClick", confirmButton, spawnClientPlayer) -- to remove this event destroyElement(confirmButton) -- then destroy element
-
-- Server function stopSoundOnLogin() triggerClientEvent(source,"stop",source) end addEventHandler("onPlayerLogin", root, stopSoundOnLogin) - Client local sound addEventHandler( "onClientResourceStart", resourceRoot, function () sound = playSound("scary.mp3") setSoundVolume(sound, 1) end ) function stopSoundOnLogin() if isElement(sound) then stopSound(sound) end end addEvent("stop", true) addEventHandler("stop", root, stopSoundOnLogin)
-
العفو ياغالي حياك في أي وقت
-
ضيف المود الى قروب أدمن resource.name غير name = اسم مود الguiedtior
-
لا ياعسل لحاله اي شي فيه امر اف8 تقدر تستخدم معه executeCommandHandler + ادخل الويكا اقرأ عنها اكثر وتفهم
-
اذا اسم الزر hedit تمام عليك صح ----- بالنسبة لسوجن ذي عشان تفتح نافذة اللي فيها اوامر اف8 مثلا مود الوزنيات لما تكتب في اف8 hedit تفك لك اللوحة
-
لفتح لوحة الوزنيات b استخدم ذا الكود لفتح النافذة executeCommandHandler("hedit")
-
addEventHandler("onClientMarkerHit",firstMissionMarker, function (plr) if ( plr == localPlayer ) then addEventHandler("onClientRender",root,Draw); end; end ); addEventHandler("onClientMarkerLeave",firstMissionMarker, function ( plr ) if ( plr == localPlayer ) then removeEventHandler("onClientRender",root,Draw); end; end );
-
Client GUIEditor = { checkbox = {}, edit = {}, button = {}, window = {}, label = {} } addEventHandler("onClientResourceStart", resourceRoot, function() GUIEditor.window[1] = guiCreateWindow(201, 188, 490, 255, "مود تسجيل الدخول + التسجيل من قبل العم ابو شنب", false) guiSetVisible (GUIEditor.window[1], false) guiWindowSetSizable(GUIEditor.window[1],false) guiWindowSetMovable(GUIEditor.window[1],true) guiSetProperty(GUIEditor.window[1], "CaptionColour", "FF1B7EE3") GUIEditor.button[1] = guiCreateButton(10, 22, 22, 21, "Ar", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FF1B7EE3") GUIEditor.button[2] = guiCreateButton(36, 22, 22, 21, "En", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FF1B7EE3") GUIEditor.button[3] = guiCreateButton(456, 21, 24, 27, "X", false, GUIEditor.window[1]) guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FFFF0000") GUIEditor.label[1] = guiCreateLabel(185, 43, 127, 25, "اسم الحساب", false, GUIEditor.window[1]) guiLabelSetColor(GUIEditor.label[1], 236, 141, 17) GUIEditor.edit[1] = guiCreateEdit(91, 78, 310, 31, "", false, GUIEditor.window[1]) GUIEditor.label[2] = guiCreateLabel(185, 121, 127, 25, "كلمة المرور", false, GUIEditor.window[1]) guiLabelSetColor(GUIEditor.label[2], 236, 141, 17) GUIEditor.edit[2] = guiCreateEdit(90, 156, 310, 31, "", false, GUIEditor.window[1]) GUIEditor.checkbox[1] = guiCreateCheckBox(421, 230, 59, 16, "حفظ ؟", false, false, GUIEditor.window[1]) GUIEditor.button[4] = guiCreateButton(10, 194, 114, 36, "تسجيل", false, GUIEditor.window[1]) GUIEditor.button[5] = guiCreateButton(178, 194, 114, 36, "تسجيل الدخول", false, GUIEditor.window[1]) GUIEditor.button[6] = guiCreateButton(338, 194, 114, 36, "زائر", false, GUIEditor.window[1]) end ) ---------- -- bindKey ---------- bindKey ( "F7" , "down" , function() if ( guiGetVisible ( GUIEditor.window[1] ) == true ) then guiSetVisible ( GUIEditor.window[1] ,false ) showCursor (false ) guiSetInputEnabled(false) elseif ( guiGetVisible ( GUIEditor.window[1] ) == false ) then guiSetVisible ( GUIEditor.window[1] ,true ) showCursor (false ) guiSetInputEnabled(true) playSound("xAboShanab.mp3") end end ) -------------------- -- Login and register -------------------- function clickLoginRegister() if (source == GUIEditor.button[5]) then triggerServerEvent ( "onLogin", getRootElement(), getLocalPlayer(), guiGetText(GUIEditor.edit[1]), guiGetText(GUIEditor.edit[2]) ) elseif (source == GUIEditor.button[4]) then triggerServerEvent ( "onReg", getRootElement(), getLocalPlayer(), guiGetText(GUIEditor.edit[1]), guiGetText(GUIEditor.edit[2]) ) end end addEventHandler ("onClientGUIClick", getRootElement(), clickLoginRegister) -------------------- -- Languages -------------------- addEventHandler("onClientGUIClick",getRootElement(), function () if ( source == GUIEditor.button[1] ) then guiSetText(GUIEditor.window[1],"مود التسجيل + تسجيل الدخول من قبل ابو شنب") guiSetText(GUIEditor.label[1],"اسم الحساب") guiSetText(GUIEditor.label[2],"كلمة المرور") guiSetText(GUIEditor.checkbox[1],"حفظ ؟") guiSetText(GUIEditor.button[4],"تسجيل") guiSetText(GUIEditor.button[5],"تسجيل الدخول") guiSetText(GUIEditor.button[6],"زائر") elseif ( source == GUIEditor.button[2] ) then guiSetText(GUIEditor.window[1],"Script register / login By AboShanab") guiSetText(GUIEditor.label[1],"Name Account") guiSetText(GUIEditor.label[2],"Password") guiSetText(GUIEditor.checkbox[1],"Save ?") guiSetText(GUIEditor.button[4],"register") guiSetText(GUIEditor.button[5],"login") guiSetText(GUIEditor.button[5],"Guest") end end ) -------------------- -- Exit Window -------------------- addEventHandler("onClientGUIClick",getRootElement(), function () if ( source == GUIEditor.button[3] ) then guiSetVisible ( GUIEditor.window[1] ,false ) showCursor (false) guiSetInputEnabled(false) end end ) -------------------- -- Hide Window Function -------------------- addEvent("HideWindow", true) addEventHandler("HideWindow",root, function() guiSetVisible (GUIEditor.window[1], false) xmlFile(guiCheckBoxGetSelected(GUIEditor.checkbox[1])) end ) ----------------------- --get user name and passward & add ------------------------ addEventHandler( 'onClientResourceStart', getResourceRootElement(getThisResource()), function( ) showLoginWindow() end ) addEvent("addUserNameAndPassword", true) addEventHandler("addUserNameAndPassword",root, function(user,pass) guiSetText(GUIEditor.edit[1],tostring(user)) guiSetText(GUIEditor.edit[2],tostring(pass)) end ) function showLoginWindow() xmlFileName = "login.xml" local xmlFile = xmlLoadFile(xmlFileName) if xmlFile then status = xmlNodeGetAttribute(xmlFile, "savecheckbox") end if status == "true" then local username = tostring(xmlNodeGetAttribute(xmlFile, "username")) if username ~= "" then guiCheckBoxSetSelected(GUIEditor.checkbox[1],true) triggerServerEvent ( "getUserNameAndPassword", getLocalPlayer(),username) end end end function xmlFile(find) if find == true then setElementData(localPlayer, "checkbox", true) else setElementData(localPlayer, "checkbox", false) end xmlFileName = "login.xml" local xmlFile = xmlLoadFile(xmlFileName) if not xmlFile then xmlFile = xmlCreateFile(xmlFileName, "checkbox") xmlNodeSetAttribute(xmlFile, "savecheckbox", tostring(getElementData(localPlayer, "checkbox"))) end xmlNodeSetAttribute(xmlFile, "savecheckbox", tostring(getElementData(localPlayer, "checkbox"))) xmlNodeSetAttribute(xmlFile, "username", tostring(guiGetText(GUIEditor.edit[1]))) xmlSaveFile(xmlFile) xmlUnloadFile(xmlFile) end Server السيرفر كامل مع sql addEventHandler ( "onResourceStart", resourceRoot, function ( ) executeSQLQuery ( "CREATE TABLE IF NOT EXISTS SaveSystemByAboShanab (NameAccount,Password)" ) end ) addEvent ( "getUserNameAndPassword", true ) addEventHandler ( "getUserNameAndPassword", root, function ( user ) local res = executeSQLQuery( "SELECT * FROM SaveSystemByAboShanab WHERE NameAccount = ?", tostring( user )) if ( type ( res ) == "table" and #res == 0 ) or not res then return end triggerClientEvent (source, "addUserNameAndPassword", source,res[1]["NameAccount"],res[1]["Password"]) end ) addEvent("onLogin", true) addEventHandler("onLogin",root, function (player, user, pass, NameAccount, Password) local account = getAccount ( user, pass ) if ( account ~= true ) then if (logIn ( player, account, pass ) == true) then outputChatBox ( "You Logged in Sucessfuly!", player, 255, 255, 0 , true ) triggerClientEvent (source, "HideWindow", source) else outputChatBox ( "Login Error!", player, 255, 0, 0 ) end else outputChatBox ( "Wrong username or password!", player, 255, 0, 0 ) end end ) addEvent("onReg", true) addEventHandler("onReg",root, function ( player, user, pass, NameAccount, Password ) local account = getAccount ( user, pass ) if ( account ~= false ) then if (logIn ( player, account, pass ) == true) then outputChatBox ( "You Registerd and Logged in Sucessfuly!", player, 255, 255, 0 ) triggerClientEvent (source, "HideWindow", source) else outputChatBox ( "You Are Already Logged in !", player, 255, 255, 0 ) triggerClientEvent (source, "HideWindow", source) end else account = addAccount ( user, pass ) if (logIn ( player, account, pass ) == true) then outputChatBox ( "You Registerd and Logged in Sucessfuly!", player, 255, 255, 0 ) local res = executeSQLQuery( "SELECT * FROM SaveSystemByAboShanab WHERE NameAccount = ?", tostring( user )) if ( type ( res ) == "table" and #res == 0 ) or not res then executeSQLQuery ( "INSERT INTO SaveSystemByAboShanab ( NameAccount, Password ) VALUES ( ?, ? )", user, pass ) end triggerClientEvent (source, "HideWindow", source) else outputChatBox ( "Register Error !", player, 255, 0, 0 ) end end end )
-
أهنيك عالسكربت الحلو وبداية موفقة وإذا بدايتك كذا من الحين أقولك راح تصير مبدع وأبدع من المبدع ض1 تحياتي
-
تقدر تلعب بعد ماتسجل دخول يصير لك spawn واذا تبيه يطلع شاشه ويكون في لعب عادي قبل التسجيل كلمني ايه ابغاه لعب عادي لاني اشوف الشاشة السودة تطير الاعبين خش على ملف main تلاقي ملف سيرفر server.lua خشه حط الكود ذا اخر سطر function join(player) spawnPlayer ( player, x, y, z) repeat until setElementModel(player,46) fadeCamera(player, true) setCameraTarget(player, player) showChat(player, true) end addEventHandler("onPlayerJoin", root, function() join(source) end ) ولاتنسى تحط احداثياتك هنا احداثيات البداية x, y, z
-
تقدر تلعب بعد ماتسجل دخول يصير لك spawn واذا تبيه يطلع شاشه ويكون في لعب عادي قبل التسجيل كلمني
-
what problem with my code? its work with me
-
How to put an image when a player has for example 10 of heal
MR.S3D replied to GamerDeMTA's topic in Scripting
black screen use [url=https://wiki.multitheftauto.com/wiki/FadeCamera]https://wiki.multitheftauto.com/wiki/FadeCamera[/url] to create image use [url=https://wiki.multitheftauto.com/wiki/DxDrawImage]https://wiki.multitheftauto.com/wiki/DxDrawImage[/url] or [url=https://wiki.multitheftauto.com/wiki/GuiCreateStaticImage]https://wiki.multitheftauto.com/wiki/Gu ... taticImage[/url] use this event on client side [url=https://wiki.multitheftauto.com/wiki/OnClientPlayerDamage]https://wiki.multitheftauto.com/wiki/On ... ayerDamage[/url] to get health [url=https://wiki.multitheftauto.com/wiki/GetElementHealth]https://wiki.multitheftauto.com/wiki/GetElementHealth[/url] -
toggleAllControls ( client, state, true, false ) server side function freeze() toggleAllControls ( client, false, true, false ) end addEvent ( "freeze", true ) addEventHandler ( "freeze", root, freeze )