☠ RaZeR ☠ Posted October 8, 2014 Share Posted October 8, 2014 هلا شباب # ابي فنكشات # غرفة شات جديده مثلا : حرف س # والشات مايظهر الا لتيم معين #يعني لو ضغطت على حرف س ووكتبت مايظهر الكلام الا اللي موجو في تيم معين Link to comment
☠ RaZeR ☠ Posted October 9, 2014 Author Share Posted October 9, 2014 30 مشاهدة ولا رد @@@@@@@@ Link to comment
nxFairlywell Posted October 9, 2014 Share Posted October 9, 2014 -- source code ( isPlayerInTeam ) -- function isPlayerInTeam(player, team) assert(isElement(player) and getElementType(player) == "player", "Bad argument 1 @ isPlayerInTeam [player expected, got " .. tostring(player) .. "]") assert((not team) or type(team) == "string" or (isElement(team) and getElementType(team) == "team"), "Bad argument 2 @ isPlayerInTeam [nil/string/team expected, got " .. tostring(team) .. "]") return getPlayerTeam(player) == (type(team) == "string" and getTeamFromName(team) or (type(team) == "userdata" and team or (getPlayerTeam(player) or true))) end -------------------- bindKey(source,"s", 'down', "chatbox", saya) addCommandHandler("saya", function( plr, cmd,... ) if isPlayerInTeam(plr,"اسم_التيم") then for _, v in ipairs ( getPlayersInTeam( "اسم_التيم" ) ); local table = {...} text = table.concat(table," ") outputChatBox(getPlayerName(plr).." : "..text, v[1],255,255,255,true) end end end) -- SERVER SIDE -- الكود سيرفر جربه ورجع لي خبـر Link to comment
jafar Posted October 9, 2014 Share Posted October 9, 2014 -- source code ( isPlayerInTeam ) -- function isPlayerInTeam(player, team) assert(isElement(player) and getElementType(player) == "player", "Bad argument 1 @ isPlayerInTeam [player expected, got " .. tostring(player) .. "]") assert((not team) or type(team) == "string" or (isElement(team) and getElementType(team) == "team"), "Bad argument 2 @ isPlayerInTeam [nil/string/team expected, got " .. tostring(team) .. "]") return getPlayerTeam(player) == (type(team) == "string" and getTeamFromName(team) or (type(team) == "userdata" and team or (getPlayerTeam(player) or true))) end -------------------- bindKey(source,"s", 'down', "chatbox", saya) addCommandHandler("saya", function( plr, cmd,... ) if isPlayerInTeam(plr,"اسم_التيم") then for _, v in ipairs ( getPlayersInTeam( "اسم_التيم" ) ); local table = {...} text = table.concat(table," ") outputChatBox(getPlayerName(plr).." : "..text, v[1],255,255,255,true) end end end) -- SERVER SIDE -- الكود سيرفر جربه ورجع لي خبـر X --------- جرب, local teamName = "" -- إسم التيم local key = "" -- المفتاح addCommandHandler ( "teamChat", function ( player, _, ... ) local msg = table.concat ( { ... }, " " ); local playerName = getPlayerName ( player ); local playerTeam = getPlayerTeam ( player ); if playerTeam and teamName then local r, g, b = getTeamColor ( playerTeam ); for _, players in ipairs ( getElementsByType ( "player" ) ) do if playerTeam == teamName then outputChatBox ( "(" .. teamName .. ") " .. playerName .. ": #FFFFFF" .. msg, players, r, g, b, true ); end end end end ); addEventHandler ( "onResourceStart", resourceRoot, function ( ) for _, players in ipairs ( getElementsByType ( "player" ) ) do bindKey ( players, key, "down", "chatBox", "teamChat" ); end end ); addEventHandler ( "onPlayerJoin", root, function ( ) bindKey ( source, key, "down", "chatBox", "teamChat" ); end ); Link to comment
TAPL Posted October 9, 2014 Share Posted October 9, 2014 local teamName = "" -- إسم التيم local key = "" -- الزر addCommandHandler("TeamChat", function (player, _, ...) local msg = table.concat({...}, " ") local pName = getPlayerName(player) local team = getPlayerTeam(player) if team and getTeamName(team) == teamName then local r, g, b = getTeamColor(team) for _, p in ipairs (getPlayersInTeam(team)) do outputChatBox("("..teamName..") "..pName..": #FFFFFF"..msg, p, r, g, b, true) end else if isKeyBound(player, key, "down", nothing) then unbindKey(player, key, "down", "chatbox", "TeamChat") unbindKey(player, key, "down", nothing) end end end) addEventHandler("onResourceStart", resourceRoot, function() for i, player in ipairs (getElementsByType("player")) do local team = getPlayerTeam(player) if team and getTeamName(team) == teamName then bindKey(player, key, "down", "chatbox", "TeamChat") bindKey(player, key, "down", nothing) end end end) addEventHandler("onPlayerSpawn", root, function() local team = getPlayerTeam(source) if team and getTeamName(team) == teamName then if not isKeyBound(source, key, "down", nothing) then bindKey(source, key, "down", "chatbox", "TeamChat") bindKey(source, key, "down", nothing) end else if isKeyBound(source, key, "down", nothing) then unbindKey(source, key, "down", "chatbox", "TeamChat") unbindKey(source, key, "down", nothing) end end end) function nothing() end Link to comment
☠ RaZeR ☠ Posted October 10, 2014 Author Share Posted October 10, 2014 تابل للاسف كود مااشتغل ## ولا حتى كود جعفر Link to comment
#DRAGON!FIRE Posted October 10, 2014 Share Posted October 10, 2014 وش اللي ما اشتغل بالضبط اشوف الكود صحيح ! Link to comment
TAPL Posted October 10, 2014 Share Posted October 10, 2014 تأكد انك حاطه سيرفر سايد و وريني تعديلك على الكود Link to comment
☠ RaZeR ☠ Posted October 10, 2014 Author Share Posted October 10, 2014 تأكد انك حاطه سيرفر سايدو وريني تعديلك على الكود Server Side : !!! local teamName = "Gan" local key = "m" addCommandHandler("TeamChat", function (player, _, ...) local msg = table.concat({...}, " ") local pName = getPlayerName(player) local team = getPlayerTeam(player) if team and getTeamName(team) == teamName then local r, g, b = getTeamColor(team) for _, p in ipairs (getPlayersInTeam(team)) do outputChatBox("("..teamName..") "..pName..": #FFFFFF"..msg, p, r, g, b, true) end else if isKeyBound(player, key, "down", nothing) then unbindKey(player, key, "down", "chatbox", "TeamChat") unbindKey(player, key, "down", nothing) end end end) addEventHandler("onResourceStart", resourceRoot, function() for i, player in ipairs (getElementsByType("player")) do local team = getPlayerTeam(player) if team and getTeamName(team) == teamName then bindKey(player, key, "down", "chatbox", "TeamChat") bindKey(player, key, "down", nothing) end end end) addEventHandler("onPlayerSpawn", root, function() local team = getPlayerTeam(source) if team and getTeamName(team) == teamName then if not isKeyBound(source, key, "down", nothing) then bindKey(source, key, "down", "chatbox", "TeamChat") bindKey(source, key, "down", nothing) end else if isKeyBound(source, key, "down", nothing) then unbindKey(source, key, "down", "chatbox", "TeamChat") unbindKey(source, key, "down", nothing) end end end) function nothing() end Link to comment
☠ RaZeR ☠ Posted October 10, 2014 Author Share Posted October 10, 2014 تأكد انك حاطه سيرفر سايدو وريني تعديلك على الكود Server Side : !!! local teamName = "Gan" local key = "m" addCommandHandler("TeamChat", function (player, _, ...) local msg = table.concat({...}, " ") local pName = getPlayerName(player) local team = getPlayerTeam(player) if team and getTeamName(team) == teamName then local r, g, b = getTeamColor(team) for _, p in ipairs (getPlayersInTeam(team)) do outputChatBox("("..teamName..") "..pName..": #FFFFFF"..msg, p, r, g, b, true) end else if isKeyBound(player, key, "down", nothing) then unbindKey(player, key, "down", "chatbox", "TeamChat") unbindKey(player, key, "down", nothing) end end end) addEventHandler("onResourceStart", resourceRoot, function() for i, player in ipairs (getElementsByType("player")) do local team = getPlayerTeam(player) if team and getTeamName(team) == teamName then bindKey(player, key, "down", "chatbox", "TeamChat") bindKey(player, key, "down", nothing) end end end) addEventHandler("onPlayerSpawn", root, function() local team = getPlayerTeam(source) if team and getTeamName(team) == teamName then if not isKeyBound(source, key, "down", nothing) then bindKey(source, key, "down", "chatbox", "TeamChat") bindKey(source, key, "down", nothing) end else if isKeyBound(source, key, "down", nothing) then unbindKey(source, key, "down", "chatbox", "TeamChat") unbindKey(source, key, "down", nothing) end end end) function nothing() end Link to comment
☠ RaZeR ☠ Posted October 10, 2014 Author Share Posted October 10, 2014 وش اللي ما اشتغل بالضبط اشوف الكود صحيح ! لما اكتب مايظهر شي رغم اني في التيم Link to comment
TAPL Posted October 10, 2014 Share Posted October 10, 2014 ايش القيم مود الي تستخدمه انت او كيف اللاعب يغير تيمه Link to comment
☠ RaZeR ☠ Posted October 10, 2014 Author Share Posted October 10, 2014 Gameode : play عادي # تيم عادي @ @ مافهمت الثانيه Link to comment
TAPL Posted October 10, 2014 Share Posted October 10, 2014 بعد ما تحط نفسك بالتيم /kill اكتب Link to comment
☠ RaZeR ☠ Posted October 10, 2014 Author Share Posted October 10, 2014 بعد ما تحط نفسك بالتيم /kill اكتب[/quoteلازم كل شوي انتحار عشان يشتغل Link to comment
TAPL Posted October 10, 2014 Share Posted October 10, 2014 onPlayerSpawn تشوف الكود الي داخل افنت استبدل الأفنت بالي تحسه مناسب لك مع تعديل ما يلزم بالكود بحسب الأفنت او التايمر ان كنت بتستخدم تايمر Link to comment
☠ RaZeR ☠ Posted October 10, 2014 Author Share Posted October 10, 2014 onPlayerSpawn تشوف الكود الي داخل افنت استبدل الأفنت بالي تحسه مناسب لك مع تعديل ما يلزم بالكود بحسب الأفنت او التايمر ان كنت بتستخدم تايمر لقيت كل هذا : اعرفهم كلهم # لاكن ابي واحد منهم يجيب الامر على طوول يعني مب لازم اموت او اسجل دخولي عشان يشتغل onPlayerBan onPlayerChat onPlayerPrivateMessage onPlayerConnect onPlayerChangeNick onPlayerLogin onPlayerLogout onPlayerDamage onPlayerJoin onPlayerQuit onPlayerSpawn onPlayerWasted onPlayerTarget onPlayerVehicleEnter onPlayerVehicleExit onPlayerWeaponSwitch onPlayerMarkerHit onPlayerMarkerLeave onPlayerPickupHit onPlayerPickupUse onPlayerClick onPlayerContact onPlayerStealthKill onPlayerMute onPlayerUnmute onPlayerCommand onPlayerModInfo onPlayerVoiceStart onPlayerVoiceStop onPlayerScreenShot Link to comment
☠ RaZeR ☠ Posted October 10, 2014 Author Share Posted October 10, 2014 انا جربت @ onResourceStart لكن ماا اشتغلت ً# Link to comment
☠ RaZeR ☠ Posted October 10, 2014 Author Share Posted October 10, 2014 استخدمها : لاكن المشكلة لازم اكتب في الشات عششان تظهرلي وتشتغل # انا ابيها على طول تشتغل بدون onPlayer Link to comment
shwaeki Posted October 10, 2014 Share Posted October 10, 2014 سوي تايمر و جيب كل الاعبين و اذا كان في التيم يسوي بند و اذا ما كان يشيل البند Link to comment
☠ RaZeR ☠ Posted October 10, 2014 Author Share Posted October 10, 2014 (edited) سوي تايمر و جيب كل الاعبين و اذا كان في التيم يسوي بند و اذا ما كان يشيل البند setTimer ( function() local team = getPlayerTeam(source) if team and getTeamName(team) == teamName then if not isKeyBound(source, key, "down", nothing) then bindKey(source, key, "down", "chatbox", "Chat") bindKey(source, key, "down", nothing) end, 5000, 1 ) else if isKeyBound(source, key, "down", nothing) then unbindKey(source, key, "down", "chatbox", "Chat") unbindKey(source, key, "down", nothing) end end end) function nothing() end Edited October 11, 2014 by Guest Link to comment
ALw7sH Posted October 11, 2014 Share Posted October 11, 2014 setTimer( function() for k,v in ipairs(getElementsByType ( "player" )) do local team = getPlayerTeam(v) if team and getTeamName(team) == teamName then if not isKeyBound(v, key, "down", nothing) then bindKey(v, key, "down", "chatbox", "TeamChat") bindKey(v, key, "down", nothing) end else if isKeyBound(v, key, "down", nothing) then unbindKey(v, key, "down", "chatbox", "TeamChat") unbindKey(v, key, "down", nothing) end end end end,100,0) Link to comment
ALw7sH Posted October 11, 2014 Share Posted October 11, 2014 setTimer( function() for k,v in ipairs(getElementsByType ( "player" )) do local team = getPlayerTeam(v) if team and getTeamName(team) == teamName then if not isKeyBound(v, key, "down", nothing) then bindKey(v, key, "down", "chatbox", "TeamChat") bindKey(v, key, "down", nothing) end else if isKeyBound(v, key, "down", nothing) then unbindKey(v, key, "down", "chatbox", "TeamChat") unbindKey(v, key, "down", nothing) end end end end,100,0) 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