Outlaw
-
Posts
35 -
Joined
-
Last visited
Posts posted by Outlaw
-
-
local s = p:getSerial()
3 hours ago, Sha67 said:غير معرًف s أيضاً
3 hours ago, Sha67 said:لايوجد قواعد بيانات بالأسماء التالية :
accountUsername و serialUsername.
-
executeSQLQuery("CREATE TABLE IF NOT EXISTS party (party TEXT,leader TEXT)") executeSQLQuery("CREATE TABLE IF NOT EXISTS party_members (party TEXT,serial TEXT,r NUMERIC,g NUMERIC,b NUMERIC)") -- local q = executeSQLQuery("SELECT * FROM serialUsername") -- local q = executeSQLQuery("SELECT username FROM accountUsername WHERE serial=?",s) -- local q = executeSQLQuery("SELECT username FROM accountUsername WHERE serial=?",s) -- executeSQLQuery("INSERT INTO party (party,leader) VALUES(?,?)",v,l) executeSQLQuery("INSERT INTO party_members (party,serial,r,g,b) VALUES(?,?,?,?,?)",v,i,r,g,b) -- local q1 = executeSQLQuery("SELECT * FROM party") -- local q2 = executeSQLQuery("SELECT * FROM party_members WHERE party=?",p) -- executeSQLQuery("DELETE FROM party") executeSQLQuery("DELETE FROM party_members")
Debug errors:
ERROR: Database query failed no such column: serial
ERROR: attempt to index field '?' (a nil value)
Lines:
local n = q[1].username local q = executeSQLQuery("SELECT username FROM accountUsername WHERE serial=?",s)
-
On 09/09/2019 at 01:11, PaiN^ said:
allowedwps = { [1] = true, [2] = true, [3] = true, [5] = true, [6] = true, [7] = true, [8] = true, } addEventHandler( "onClientPlayerWeaponSwitch", root, function(previous_weapon, next_weapon) if getElementData(localPlayer, "nodm") == true then local current_weapon = getPedWeapon(localPlayer, next_weapon) for i, weapon in ipairs(allowedwps) do if current_weapon ~= weapon then cancelEvent() break end end end end )
كودك مو شغال و بدون اخطاء ديبق
-
16 hours ago, N3xT said:
مالها دخل, ولصاحب الموضوع اكوادك ملخبطة وغير واضحة وفكرتك غير واضحة ايضاً
allowedwps = { [1] = true, [2] = true, [3] = true, [5] = true, [6] = true, [7] = true, [8] = true, }
function disablenodm (p) if getPedWeapon(localPlayer, #allowedwps) then return end if getElementData(localPlayer,"nodm",true) then toggleControl("next_weapon",false) toggleControl("previous_weapon",false) else toggleControl("next_weapon",true) toggleControl("previous_weapon",true) end end
بدي اخلي اللاعب يستطيع أن يغير السلاح عندما يكون معه سلاح من الأسلحة الموجودة بالجدول
-
شباب بدي أخلي البيد لما يكون عليه داتا nodm
يقدر يغير الأسلحة بس الموجودة بالتيبل
allowedwps = { [1] = true, [2] = true, [3] = true, [5] = true, [6] = true, [7] = true, [8] = true, }
function disablenodm (p) if getPedWeapon(localPlayer, #allowedwps) then return end if getElementData(localPlayer,"nodm",true) then toggleControl("next_weapon",false) toggleControl("previous_weapon",false) else toggleControl("next_weapon",true) toggleControl("previous_weapon",true) end end addEventHandler("onClientRender",root,disablenodm) function changeNodmCheck(bool) guiCheckBoxSetSelected(getControl(wndMain, 'No deathmatch'), bool) end
-
مشكور جربتهم و اشتغلو و فكرة وصلت
و لما بدي أحطهم الإثنين مع بعض في الشات بوكس
جربت كذا:
outputChatBox(myTable[1][1][2],source,255,0,0)
ما اشتغلت
و كمان سؤال
داخل التيبل أسوي الرموز ذي {}
بس لما يكون في أكثر من أرقمنت؟ مثال:
myTable = { [1] = {"Hello", "1154"} }
يعني ما ينفع
myTable = { [1] = "Hello", "1154" }
-
On 15/08/2019 at 14:48, HassoN said:
العفو ،
i = index
v = value
في كل جدول دائماً فيه الفهرس والقيمة
الفهرس هو ال index
من خلاله تقدر تجيب القيمة
والقيمة هي ال value
مثال
myTable = { [1] = "Hello", }
بالمثال الي فوق
index = 1
value = "Hello"
ولو مثلا سويت
myTable[1]
راح ترجع لك "Hello"
عشانها تشتغل زي شغل الفهرس فـ الكتب بالضبط
ملاحظة: الفهرس مو لازم يكون رقم ، ممكن تحط اي قيمة في بالك
وطبعاً الحين راح تسال طيب ليش فيه بعض الجداول مافيها فهرس مثل
myTable = {"Hello"}
الجواب هو فيه فهرس لكنه غير مكتوب ، ، ولو سويت نفس الخطوة الي فوق
myTable[1]
راح ترجع لك برضو "Hello"
وبالنسبة لسؤالك السابق عن
_, v
البعض يحب يحط _ بدل اي حرف ثاني ، عادي مالها اهمية
اتمنى وصلت الفكرة
مشكور بس سويت كثير محاولات عشان أضيف اكثر أشياء للتيبل و لكن فشلت مثل:
myTable = { [1] = {"Hello", "1154"} } function text () outputChatBox(myTable[1],source,255,0,0) end addCommandHandler("aa",text)
myTable = { [1] = "Hello", "1154", } function text () outputChatBox(myTable[1],source,255,0,0) end addCommandHandler("aa",text)
و جربت myTable[1], myTable[2]
وما اشتغلت كمان
-
السلام عليكم
شباب مش فاهم وين الخطأ؟ ما في شي بالديبق
function powers(c,pw) local val = isValidPower(pw) if val then local ws = not isWorldSpecialPropertyEnabled(val) setWorldSpecialPropertyEnabled(val,ws) local mt = getToggle(ws) outputChatBox("#006400•#ffffff "..val.." #006400has been "..mt.."!",255,255,255,true) else outputChatBox("• Power not found",255,0,0) end end addCommandHandler("pw",PW.Toggle) addEvent("tstaffpowers",true) addEventHandler("tstaffpowers",root,PW.Toggle)
function checkstaff(thePlayer) local accName = getAccountName ( getPlayerAccount ( thePlayer ) ) if isObjectInACLGroup ("user."..accName, aclGetGroup ( "VIP" ) ) then triggerClientEvent (root, "tstaffpowers", thePlayer) else outputChatBox("لا تستطيع",thePlayer,255,0,0) end end
-
18 hours ago, Bassam*Syria said:
عليكم السلام
في كثيير استخدامات للجداول
تقدر تضيف احداثيات ومعلومات لجدول
local markers = { {758.51599121094,753.36242675781,-4.0033869743347,"cylinder",1}, {470.33850, 810.26843, -9.91448,"arrow",2} }
بعدين نسوي امؤ يصنع كل الماركرات ذي ب اسم واحد !
for _,v in pairs (markers) do MarkerName = createMarker(v[1],v[2],v[3],v[4],v[5],255,255,255,255) end --v[1] والقيم الانيه ياخذها من الجدول والخ كلها نفس العمليه
الحين في سؤال بيطرح نفسه
وش الفرق ؟ ليش م اسوي
createMarker
وخلاص؟
ليش اسوي جدول و الحوسه ذي لماركرات ؟
الفائده انه تقدر تخفي كل الماركراتت ب كزد زاحد
destroyElement(MarkerName) -- يشيل كل الماركرات الي تصنعت من الجدول..
ذا مثال تقدر تطبقه عكل شي !
وفي امثله كثير مثلا تسوي جدول فاضي و تضيف ناس عليه و تشيلهم والخ
ذا موضوع تاني
لو تحب اشرحه لك خبرني
اتتمنا تعليقي يفيدك
#بسام_سوريا
مشكور والله ما قصرت
16 hours ago, HassoN said:العفو
طريقة اسهل من انك تجيب كل ماركرات السيرفر وتوجع راسك
local markers = { {758.51599121094,753.36242675781,-4.0033869743347,"cylinder",1}, {470.33850, 810.26843, -9.91448,"arrow",2}, } local myTable = {} for i, v in ipairs (markers) do myTable[i] = createMarker(v[1], v[2], v[3], v[4], v[5], 255, 255, 255, 255) end -- ولما تجي تمسحهم for _, v in ipairs(myTable) do destroyElement(v) end
بالنسبة لصاحب الموضوع ، الهدف الاساسي من الجداول هو حفظ المعلومات بكمية كبيرة وبترتيب معين عشان تستفاد منها حسب استعمالك
مشكور بس معي سؤال
في إستعمال اللوب ماهو ال 'v' و ماهو ال 'i'
iو ليش أحيانا يكون بمكان ال
i, v = _, v
-
-
1 hour ago, majqq said:
It's up to you how you will call them.
weapon
is parameter declared in function arguments.
And
weapons -- or bodypartss
are global tables which could be accessed from every scope of file and other script files declared on same side.
Dude please focus with me i know that i can change the name of the parametres im talking about #weapons
How did my server knew that #weapons is the parametre(weapon) ? (also there is difference between the words, the parametre is weapon) and my table is weapons (The 's')
-
11 minutes ago, majqq said:
What you try to achieve?
#weapons -- will return `weapons` table size
If you want to do something when body part is headshot and weapon is in table, then you would need to change a bit a table structure (and condition too), to not loop necessary.
weapons = { [22] = true, [23] = true, [24] = true, [26] = true, [27] = true, [28] = true, [29] = true, [30] = true, [31] = true, [32] = true, }
And condition from:
elseif bodypart == 9 and #weapons then
to:
elseif bodypart == 9 and weapons[weapon] then
So, this way you check if weapon id exists in table, and it's not false and not nil.
If you would change true -> false for a weapon, then this weapon wouldn't count as the one which fulfills the condition - because it would be false.
I will try your code it seems much better but my question is:
The word to check the weapon is "weapon",( example: if weapon == 31) but i'm a bit confused how the" #weapons" considered as "weapon" the 2 words dont look the same
in case instead of weapons table i didn't put the weapons ids, i put bodyparts ex:
bodypartss {3, 4, 5, 6, 7, 8, 9,} elseif weapon == 31 and #bodypartss then
How the server will read them?
I'm still new in scripting
-
Guys i've made this code and its working very well
weapons = {22, 23, 24, 26, 27, 28, 29, 30, 31, 32, } function sendHeadshot ( attacker, weapon, bodypart, loss ) local hp = getElementHealth(source) end if attacker == getLocalPlayer() then if bodypart == 9 and weapon == 34 or weapon == 33 or weapon == 24 or weapon == 25 then triggerServerEvent( "onServerHeadshot", getRootElement(), source, attacker, weapon, loss ) setElementHealth ( source, 0 ) setPedHeadless( source, true ) end elseif bodypart == 9 and #weapons then setElementHealth ( source, hp-50 ) end end addEventHandler ( "onClientPedDamage", getRootElement(), sendHeadshot ) addEventHandler ( "onClientPlayerDamage", getRootElement(), sendHeadshot )
The question is:
If i want to check if the weapon is M4 so i write:
if weapon == 31 then
And after using the table, when i wrote #weapons it worked fine but i wonder how did the server knew that #weapons = weapon ?
PS: first time i use tables
-
local Ranks = { "Owner", "Developer", "Admin", "Community Manager", "SuperModerator", "Moderator", "Warden", "Quality Assurance", "Hero", "VIP", } addEvent("IF:GetStaffs",true) addEventHandler("IF:GetStaffs",root, function() local a = {} local tabs = 0 for k,group in ipairs(Ranks) do for k,v in ipairs(aclGroupListObjects(aclGetGroup(group))) do if v:find("user.") then local main = getAccount(v:gsub("user.",""),nil) if main then local playeracc = getAccountName(getAccount(v:gsub("user.",""),nil)) local nickacc = executeSQLQuery("SELECT username FROM accountUsername WHERE account=?", playeracc) local accn = getAccount(playeracc) if accn then if #nickacc > 0 then local player = nickacc[1].username local pac = getAccountPlayer (accn) if pac then
debug: bad argument #1 to 'ipairs' (table expected, got boolean)
-
20 hours ago, NX_CI said:
الأرقمنتات تكون مرتبه في الأساس داخل الكود المصدر
مثل :
function printText(text) -- text = الأرقمنت print(text) end printText("test")
Events أما برامترز الـ
فتكون مرتبه بطريقة محدده داخل الوظيفه اللي يشغلها الحدث
مثلا :
addEventHandler("onClientGUIClick",root, function(button,state) -- button = "left" أو "right" -- state = "up" أو "down" end ) addEventHandler("onClientGUIClick",root, function(test1,test2) -- test1 = "left" أو "right" -- test2 = "up" أو "down" end ) addEventHandler("onClientGUIClick",root, function(more1,more2) -- more1 = "left" أو "right" -- more2 = "up" أو "down" end )
طيب في حالة إستعملت وظيفتين أو 2 أحداث في نفس الفنكشن كيف يكون الترتيب؟
-
15 hours ago, NX_CI said:
triggerEvent
??
-
2 hours ago, NX_CI said:
إذا انت تبي ترسل الرساله لكل اللاعبين ليش حاطها بالكلينت
SERVER :
addEventHandler("onPlayerQuit", root, function (typ,reason,element) if (typ == "Kicked") then local this = source; outputChatBox(getPlayerName(this):gsub("#%x%x%x%x%x%x","").." has left the game ["..typ.." by "..getPlayerName(element):gsub("#%x%x%x%x%x%x","").."]",root); end end )
مشكور بس ممكن إستفسار بسيط؟
طول بالك معي شوي ضض
الأرقمنتات تبع الفنشكن مرتبين من البارامتر تبع الإيفينت
في صورة بدي أضيف أرقمنت آخر وين احطه؟ لنو والله دايما تخرب معي
و في صورة ما ضفت إيفينت آخر أو فنكشن كيف أضيف ارقمنتاتهم بدون ما اخرب الترتيب
-
-
1 hour ago, KillerX said:
addEventHandler( "onClientPlayerQuit" , root , function( Reason ) if( Reason == "Kicked" ) then local Name = getPlayerName( source ):gsub( "#%x%x%x%x%x%x" , "" ); outputChatBox( ". #ffffff" .. Name .. " #22a9ed has left the game " , 0 , 100 , 0 , true ); end end )
أنا بدي أحط إسم الشخص الى صك مو الشخص المصكوك ض
مثال: KillerX has left the game [Kicked by Outlaw]
-
ممكن تصليح للكود؟
addEventHandler("onClientPlayerQuit", root, function (reason,player,target) local targetplayer = getPlayerName(target) if not (targetplayer == player) then if reason == "Kicked" then outputChatBox("• #FFFFFF"..getPlayerName(source):gsub("#%x%x%x%x%x%x","").."#22a9ed has left the game [#ffffffKicked by: "..name.."#22a9ed]", 0, 100, 0, true) end end end)
الoutputchatbox ما يشتغل
-
-
14 minutes ago, NX_CI said:
اتمنى فهمت
مشكور بس مافي شي يضحك
-
1 hour ago, NX_CI said:
انت حاط عنصر من اللوحه في الترايقر وهذا ماينفع
تختلف من شخص لشخص GUI لأن حاط الميمو في الترايقر , وعناصر
ليه حاط الميمو في الترايقر ؟
سويتله ترايقر لسيرفر عشان يطلع لكل الناس و بعدين رجعته للكينت
أنا مازلت مبتدأ ممكن تصليح للكود؟
-
5 minutes ago, HassoN said:
؟؟ aSuport ما اشوف الايفنت الي اسمه
أسف وضعت الديبق الخطأ
هذا الي جاني:
client.Lua:203: clientside element 'gui-memo' at argument 3@ 'triggerServerEvent'
مساعدة
in البرمجة
Posted
ممكن تصليح للكود بليز
ما اشتغل.. نفس المشكل