Avir14 Posted August 17, 2022 Share Posted August 17, 2022 -- ابيه يجيب ايدي اللاعب -- Client function mid ( commandName ) local idd = exports.ids:getPlayerID(player) outputChatBox("Your ID IS"..idd, source, 0, 154, 255) end addCommandHandler ( "myid", escapeMe ) -- مود الايدي الي اسوي منه export local optimize = true -- Should the script be optimized? (if optimized, cannot be used client-side) local ids = {} function assignID() for i=1,getMaxPlayers() do if not ids[i] then ids[i] = source setElementData(source,"id",i,not optimize) break end end end addEventHandler("onPlayerJoin",root,assignID) function startup() for k, v in ipairs(getElementsByType("player")) do local id = getElementData(v,"id") if id then ids[id] = v end end end addEventHandler("onResourceStart",resourceRoot,startup) function getPlayerID(player) for k, v in ipairs(ids) do if v == player then return k end end end function freeID() local id = getElementData(source,"id") if not id then return end ids[id] = nil end addEventHandler("onPlayerQuit",root,freeID) function getPlayerByID(id) local player = ids[id] return player or false end -- debugscript الدي بق ERROR: script\c.lua:2: call: failed to call 'ids:getPlayerID' [string "?"] ERROR: script\c.lua:3: attempt to concatenate local 'idd (a boolean value) حل جزاكم الله خيرا Link to comment
#\_oskar_/# Posted August 17, 2022 Share Posted August 17, 2022 (edited) -- مود الايدي الي اسوي منه export local optimize = true -- Should the script be optimized? (if optimized, cannot be used client-side) local ids = {} function assignID() for i=1,getMaxPlayers() do if not ids[i] then ids[i] = source setElementData(source,"id",i,not optimize) break end end end addEventHandler("onPlayerJoin",root,assignID) function startup() for k, v in ipairs(getElementsByType("player")) do local id = getElementData(v,"id") if id then ids[id] = v end end end addEventHandler("onResourceStart",resourceRoot,startup) function getPlayerID(player) for k, v in ipairs(ids) do if v == player then return k end end end function freeID() local id = getElementData(source,"id") if not id then return end ids[id] = nil end addEventHandler("onPlayerQuit",root,freeID) function getPlayerByID(id) local player = ids[id] return player or false end -- ابيه يجيب ايدي اللاعب -- Client function mid ( player, commandName ) outputChatBox("Your ID IS"..getPlayerID(player), player, 0, 154, 255) end addCommandHandler ( "myid", mid ) Edited August 17, 2022 by #\_oskar_/# Link to comment
Avir14 Posted August 17, 2022 Author Share Posted August 17, 2022 12 hours ago, #\_oskar_/# said: -- مود الايدي الي اسوي منه export local optimize = true -- Should the script be optimized? (if optimized, cannot be used client-side) local ids = {} function assignID() for i=1,getMaxPlayers() do if not ids[i] then ids[i] = source setElementData(source,"id",i,not optimize) break end end end addEventHandler("onPlayerJoin",root,assignID) function startup() for k, v in ipairs(getElementsByType("player")) do local id = getElementData(v,"id") if id then ids[id] = v end end end addEventHandler("onResourceStart",resourceRoot,startup) function getPlayerID(player) for k, v in ipairs(ids) do if v == player then return k end end end function freeID() local id = getElementData(source,"id") if not id then return end ids[id] = nil end addEventHandler("onPlayerQuit",root,freeID) function getPlayerByID(id) local player = ids[id] return player or false end -- ابيه يجيب ايدي اللاعب -- Client function mid ( player, commandName ) outputChatBox("Your ID IS"..getPlayerID(player), player, 0, 154, 255) end addCommandHandler ( "myid", mid ) ما اشتغل للاسف كذا كاتبلي بالدي بق ERROR: script\ c.lua:44: attempt to concatenate a nil value outputChatBox("Your ID IS"..getPlayerID(player), player, 0, 154, 255) Link to comment
+Source|> Posted August 18, 2022 Share Posted August 18, 2022 14 hours ago, Avir14 said: ما اشتغل للاسف كذا كاتبلي بالدي بق ERROR: script\ c.lua:44: attempt to concatenate a nil value outputChatBox("Your ID IS"..getPlayerID(player), player, 0, 154, 255) local optimize = true -- Should the script be optimized? (if optimized, cannot be used client-side) local ids = {} function assignID() for i=1,getMaxPlayers() do if not ids[i] then ids[i] = source setElementData(source,"id",i,not optimize) break end end end addEventHandler("onPlayerJoin",root,assignID) function startup() for k, v in ipairs(getElementsByType("player")) do local id = getElementData(v,"id") if id then ids[id] = v end end end addEventHandler("onResourceStart",resourceRoot,startup) function getPlayerID(player) for k, v in ipairs(ids) do if v == player then return k end end end function freeID() local id = getElementData(source,"id") if not id then return end ids[id] = nil end addEventHandler("onPlayerQuit",root,freeID) function getPlayerByID(id) local player = ids[id] return player or false end -- ابيه يجيب ايدي اللاعب -- Client function mid ( player, commandName ) outputChatBox("Your ID IS"..getPlayerID(player), player, 0, 154, 255, true) end addCommandHandler ( "myid", mid ) Link to comment
Avir14 Posted August 18, 2022 Author Share Posted August 18, 2022 5 hours ago, +Source|> said: local optimize = true -- Should the script be optimized? (if optimized, cannot be used client-side) local ids = {} function assignID() for i=1,getMaxPlayers() do if not ids[i] then ids[i] = source setElementData(source,"id",i,not optimize) break end end end addEventHandler("onPlayerJoin",root,assignID) function startup() for k, v in ipairs(getElementsByType("player")) do local id = getElementData(v,"id") if id then ids[id] = v end end end addEventHandler("onResourceStart",resourceRoot,startup) function getPlayerID(player) for k, v in ipairs(ids) do if v == player then return k end end end function freeID() local id = getElementData(source,"id") if not id then return end ids[id] = nil end addEventHandler("onPlayerQuit",root,freeID) function getPlayerByID(id) local player = ids[id] return player or false end -- ابيه يجيب ايدي اللاعب -- Client function mid ( player, commandName ) outputChatBox("Your ID IS"..getPlayerID(player), player, 0, 154, 255, true) end addCommandHandler ( "myid", mid ) للاسف ماشتغل لسا نفس المشكلة ERROR: script\ c.lua:44: attempt to concatenate a nil value Link to comment
+Source|> Posted August 18, 2022 Share Posted August 18, 2022 3 hours ago, Avir14 said: للاسف ماشتغل لسا نفس المشكلة ERROR: script\ c.lua:44: attempt to concatenate a nil value مارح يشتغل لانك شغلت المود وجربته ونسيت ان فيه onPlayerJoin شغل المود وسوي ريكونكت...... Link to comment
Avir14 Posted August 18, 2022 Author Share Posted August 18, 2022 9 hours ago, +Source|> said: local optimize = true -- Should the script be optimized? (if optimized, cannot be used client-side) local ids = {} function assignID() for i=1,getMaxPlayers() do if not ids[i] then ids[i] = source setElementData(source,"id",i,not optimize) break end end end addEventHandler("onPlayerJoin",root,assignID) function startup() for k, v in ipairs(getElementsByType("player")) do local id = getElementData(v,"id") if id then ids[id] = v end end end addEventHandler("onResourceStart",resourceRoot,startup) function getPlayerID(player) for k, v in ipairs(ids) do if v == player then return k end end end function freeID() local id = getElementData(source,"id") if not id then return end ids[id] = nil end addEventHandler("onPlayerQuit",root,freeID) function getPlayerByID(id) local player = ids[id] return player or false end -- ابيه يجيب ايدي اللاعب -- Client function mid ( player, commandName ) outputChatBox("Your ID IS"..getPlayerID(player), player, 0, 154, 255, true) end addCommandHandler ( "myid", mid ) يعطيك العافية المشكلة كان لها سببين السبب الاول اني كنت حاط الاكواد بملف كلاينت والمفترض احطها بملف سيرفر والسبب الثاني اني ماكنت اسوي اشغل المود بعدين اطلع واخش من السيرفر 1 Link to comment
+Source|> Posted August 18, 2022 Share Posted August 18, 2022 (edited) 25 minutes ago, Avir14 said: يعطيك العافية المشكلة كان لها سببين السبب الاول اني كنت حاط الاكواد بملف كلاينت والمفترض احطها بملف سيرفر والسبب الثاني اني ماكنت اسوي اشغل المود بعدين اطلع واخش من السيرفر بالتوفيق ::) Edited August 18, 2022 by +Source|> 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now