Reflex# Posted March 24, 2012 Posted March 24, 2012 g_Root = getRootElement() addEventHandler('onPlayerJoin',g_Root, function () local country = exports['admin']:getPlayerCountry(source) setElementData(source,'Country',country) outputChatBox('[JOIN] #ffffff' .. getPlayerName(source) .. '#DB8181 joined game!' .. tostring(country) .. ' ', getRootElement(), 219, 129, 129, true) end ) addEventHandler('onPlayerChangeNick', g_Root, function(oldNick, newNick) outputChatBox('[Change-Nick] #ffffff' .. oldNick .. '#DB8181 is now known as #ffffff' .. newNick, getRootElement(), 219, 129, 129, true) end ) addEventHandler('onPlayerQuit', g_Root, function(reason) outputChatBox('[' .. reason .. '] #ffffff' .. getPlayerName(source) .. ' #DB8181disconnected.', getRootElement(), 255, 0, 0, true) end ) I try this..but dont work,i want that country showing from what player join ,write only [JOIN]Player joined game!false Scripting in lua
TAPL Posted March 24, 2012 Posted March 24, 2012 g_Root = getRootElement() addEventHandler('onPlayerJoin',g_Root, function () local country = exports.admin:getPlayerCountry(source) setElementData(source,'Country',country) outputChatBox('[JOIN] #ffffff' .. getPlayerName(source) .. '#DB8181 joined game!' .. tostring(country) .. ' ', getRootElement(), 219, 129, 129, true) end ) addEventHandler('onPlayerChangeNick', g_Root, function(oldNick, newNick) outputChatBox('[Change-Nick] #ffffff' .. oldNick .. '#DB8181 is now known as #ffffff' .. newNick, getRootElement(), 219, 129, 129, true) end ) addEventHandler('onPlayerQuit', g_Root, function(reason) outputChatBox('[' .. reason .. '] #ffffff' .. getPlayerName(source) .. ' #DB8181disconnected.', getRootElement(), 255, 0, 0, true) end )
Kenix Posted March 24, 2012 Posted March 24, 2012 It's some code. getPlayerCountry can return false if player country not found. http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
Reflex# Posted March 24, 2012 Author Posted March 24, 2012 It's some code.getPlayerCountry can return false if player country not found. but in scoreboard write country... Scripting in lua
Reflex# Posted March 25, 2012 Author Posted March 25, 2012 g_Root = getRootElement() addEventHandler('onPlayerJoin',g_Root, function () local country = exports.admin:getPlayerCountry(source) setElementData(source,'Country',country) outputChatBox('[JOIN] #ffffff' .. getPlayerName(source) .. '#DB8181 joined game!' .. tostring(country) .. ' ', getRootElement(), 219, 129, 129, true) end ) addEventHandler('onPlayerChangeNick', g_Root, function(oldNick, newNick) outputChatBox('[Change-Nick] #ffffff' .. oldNick .. '#DB8181 is now known as #ffffff' .. newNick, getRootElement(), 219, 129, 129, true) end ) addEventHandler('onPlayerQuit', g_Root, function(reason) outputChatBox('[' .. reason .. '] #ffffff' .. getPlayerName(source) .. ' #DB8181disconnected.', getRootElement(), 255, 0, 0, true) end ) Dont work..again writing:[JOIN][Name] joined game!false Scripting in lua
myyusuf Posted March 25, 2012 Posted March 25, 2012 local country = exports["admin"]:getPlayerCountry(source) g_Root = getRootElement() addEventHandler('onPlayerJoin',g_Root, function () outputChatBox('[JOIN] #ffffff' .. getPlayerName(source) .. '#DB8181 joined game!' .. country', getRootElement(), 219, 129, 129, true) end ) addEventHandler('onPlayerChangeNick', g_Root, function(oldNick, newNick) outputChatBox('[Change-Nick] #ffffff' .. oldNick .. '#DB8181 is now known as #ffffff' .. newNick, getRootElement(), 219, 129, 129, true) end ) addEventHandler('onPlayerQuit', g_Root, function(reason) outputChatBox('[' .. reason .. '] #ffffff' .. getPlayerName(source) .. ' #DB8181disconnected.', getRootElement(), 255, 0, 0, true) end ) also you need to give admin rights to script.
Reflex# Posted March 25, 2012 Author Posted March 25, 2012 local country = exports["admin"]:getPlayerCountry(source) g_Root = getRootElement() addEventHandler('onPlayerJoin',g_Root, function () outputChatBox('[JOIN] #ffffff' .. getPlayerName(source) .. '#DB8181 joined game!' .. country', getRootElement(), 219, 129, 129, true) end ) addEventHandler('onPlayerChangeNick', g_Root, function(oldNick, newNick) outputChatBox('[Change-Nick] #ffffff' .. oldNick .. '#DB8181 is now known as #ffffff' .. newNick, getRootElement(), 219, 129, 129, true) end ) addEventHandler('onPlayerQuit', g_Root, function(reason) outputChatBox('[' .. reason .. '] #ffffff' .. getPlayerName(source) .. ' #DB8181disconnected.', getRootElement(), 255, 0, 0, true) end ) also you need to give admin rights to script. now write nothing Scripting in lua
Kenix Posted March 25, 2012 Posted March 25, 2012 local country = exports["admin"]:getPlayerCountry(source) g_Root = getRootElement() addEventHandler('onPlayerJoin',g_Root, function () outputChatBox('[JOIN] #ffffff' .. getPlayerName(source) .. '#DB8181 joined game!' .. country', getRootElement(), 219, 129, 129, true) end ) addEventHandler('onPlayerChangeNick', g_Root, function(oldNick, newNick) outputChatBox('[Change-Nick] #ffffff' .. oldNick .. '#DB8181 is now known as #ffffff' .. newNick, getRootElement(), 219, 129, 129, true) end ) addEventHandler('onPlayerQuit', g_Root, function(reason) outputChatBox('[' .. reason .. '] #ffffff' .. getPlayerName(source) .. ' #DB8181disconnected.', getRootElement(), 255, 0, 0, true) end ) Your code is wrong. also you need to give admin rights to script. oO Ok i create test my code now. Edit: I tested code. All working. [JOIN] Kenix joined game!RU http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
Reflex# Posted March 25, 2012 Author Posted March 25, 2012 local country = exports["admin"]:getPlayerCountry(source) g_Root = getRootElement() addEventHandler('onPlayerJoin',g_Root, function () outputChatBox('[JOIN] #ffffff' .. getPlayerName(source) .. '#DB8181 joined game!' .. country', getRootElement(), 219, 129, 129, true) end ) addEventHandler('onPlayerChangeNick', g_Root, function(oldNick, newNick) outputChatBox('[Change-Nick] #ffffff' .. oldNick .. '#DB8181 is now known as #ffffff' .. newNick, getRootElement(), 219, 129, 129, true) end ) addEventHandler('onPlayerQuit', g_Root, function(reason) outputChatBox('[' .. reason .. '] #ffffff' .. getPlayerName(source) .. ' #DB8181disconnected.', getRootElement(), 255, 0, 0, true) end ) Your code is wrong. also you need to give admin rights to script. oO Ok i create test my code now. Edit: I tested code. All working. [JOIN] Kenix joined game!RU What code you test? Scripting in lua
Kenix Posted March 25, 2012 Posted March 25, 2012 g_Root = getRootElement() addEventHandler('onPlayerJoin',g_Root, function () local country = exports['admin']:getPlayerCountry(source) setElementData(source,'Country',country) outputChatBox('[JOIN] #ffffff' .. getPlayerName(source) .. '#DB8181 joined game!' .. tostring(country) .. ' ', getRootElement(), 219, 129, 129, true) end ) addEventHandler('onPlayerChangeNick', g_Root, function(oldNick, newNick) outputChatBox('[Change-Nick] #ffffff' .. oldNick .. '#DB8181 is now known as #ffffff' .. newNick, getRootElement(), 219, 129, 129, true) end ) addEventHandler('onPlayerQuit', g_Root, function(reason) outputChatBox('[' .. reason .. '] #ffffff' .. getPlayerName(source) .. ' #DB8181disconnected.', getRootElement(), 255, 0, 0, true) end ) I try this..but dont work,i want that country showing from what player join ,write only [JOIN]Player joined game!false This. http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
Reflex# Posted March 25, 2012 Author Posted March 25, 2012 g_Root = getRootElement() addEventHandler('onPlayerJoin',g_Root, function () local country = exports['admin']:getPlayerCountry(source) setElementData(source,'Country',country) outputChatBox('[JOIN] #ffffff' .. getPlayerName(source) .. '#DB8181 joined game!' .. tostring(country) .. ' ', getRootElement(), 219, 129, 129, true) end ) addEventHandler('onPlayerChangeNick', g_Root, function(oldNick, newNick) outputChatBox('[Change-Nick] #ffffff' .. oldNick .. '#DB8181 is now known as #ffffff' .. newNick, getRootElement(), 219, 129, 129, true) end ) addEventHandler('onPlayerQuit', g_Root, function(reason) outputChatBox('[' .. reason .. '] #ffffff' .. getPlayerName(source) .. ' #DB8181disconnected.', getRootElement(), 255, 0, 0, true) end ) I try this..but dont work,i want that country showing from what player join ,write only [JOIN]Player joined game!false This. As i know..this is server side? Scripting in lua
drk Posted March 25, 2012 Posted March 25, 2012 Yeah. It's server-side. EPT Team Server Development: 0% Learning C++ | C++ is amazing
CapY Posted March 25, 2012 Posted March 25, 2012 local countryNames = { ["AD"]="Andorra", ["AG"]="Antigua - Barbuda", ["AI"]="Anguilla Arabia", ["AL"]="Albania", ["AM"]="Armenia", ["AR"]="Argentina", ["AT"]="Austria", ["AU"]="Australia", ["AW"]="Aruba", ["BA"]="Bosnia", ["BE"]="Belgium", ["BG"]="Bulgaria", ["BH"]="Bahrain", ["BM"]="Bermuda", ["BN"]="Bronei ", ["BO"]="Bolivia", ["BR"]="Brazil", ["BS"]="Bahamas", ["BW"]="Botswana", ["BY"]="Belarus", ["BZ"]="Belize", ["CA"]="Canada", ["CC"]="Cocos", ["CH"]="Switzerland", ["CI"]="Ivory Coast", ["CL"]="Chile", ["CN"]="China", ["CO"]="Colombia", ["CU"]="Cuba", ["CY"]="Cyprus", ["CZ"]="Czech", ["DE"]="Germany", ["DK"]="Denmark", ["DM"]="Dominica", ["DO"]="Dominican", ["EC"]="Ecuador", ["EE"]="Estonia", ["EG"]="Egypt", ["ES"]="Spain", ["ET"]="Ethiopia", ["FI"]="Finland", ["FR"]="France", ["GB"]="Great-Britain", ["GL"]="Greenland", ["GY"]="Guyana", ["HR"]="Croatia", ["HU"]="Hungary", ["ID"]="Indonesia", ["IE"]="Ireland", ["IR"]="Iran", ["IS"]="Iceland", ["IT"]="Italy", ["IN"]="India", ["JO"]="Jordan", ["JM"]="Jamaica", ["jp"]="Mexico", ["KW"]="Kuwait", ["IT"]="Italy", ["LU"]="Luxembourg", ["LV"]="Latvia", ["MA"]="Morocco", ["MC"]="Monaco", ["MT"]="Malta", ["MX"]="Mexico", ["NG"]="Nigeria", ["NL"]="Netherlands", ["NO"]="Norway", ["PA"]="Panama", ["PE"]="Peru", ["PH"]="Philipines", ["PK"]="Pakistan", ["PL"]="Poland", ["PT"]="Portugal", ["QA"]="Qatar", ["RO"]="Romania", ["RU"]="Russia", ["SA"]="Saudi Arbia", ["SE"]="Sweden", ["SI"]="Slovania", ["TO"]="Tonga", ["TR"]="Turkey", ["UA"]="Ukraine", ["UK"]="United Kingdom", ["US"]="United States", ["UY"]="Uruguay", ["VN"]="Vietnam", ["YE"]="Yemen", ["YU"]="Yugoslavia", ["ZA"]="South Africa" } function onJoin() local country = exports['admin']:getPlayerCountry(source) setElementData(source,'Country', country) outputChatBox( getPlayerName ( source ) .. " has joined the game from " .. countryName[tostring(country)], 255, 100, 100 ) end addEventHandler ( "onPlayerJoin", getRootElement(), onJoin )
Reflex# Posted March 25, 2012 Author Posted March 25, 2012 local countryNames = { ["AD"]="Andorra", ["AG"]="Antigua - Barbuda", ["AI"]="Anguilla Arabia", ["AL"]="Albania", ["AM"]="Armenia", ["AR"]="Argentina", ["AT"]="Austria", ["AU"]="Australia", ["AW"]="Aruba", ["BA"]="Bosnia", ["BE"]="Belgium", ["BG"]="Bulgaria", ["BH"]="Bahrain", ["BM"]="Bermuda", ["BN"]="Bronei ", ["BO"]="Bolivia", ["BR"]="Brazil", ["BS"]="Bahamas", ["BW"]="Botswana", ["BY"]="Belarus", ["BZ"]="Belize", ["CA"]="Canada", ["CC"]="Cocos", ["CH"]="Switzerland", ["CI"]="Ivory Coast", ["CL"]="Chile", ["CN"]="China", ["CO"]="Colombia", ["CU"]="Cuba", ["CY"]="Cyprus", ["CZ"]="Czech", ["DE"]="Germany", ["DK"]="Denmark", ["DM"]="Dominica", ["DO"]="Dominican", ["EC"]="Ecuador", ["EE"]="Estonia", ["EG"]="Egypt", ["ES"]="Spain", ["ET"]="Ethiopia", ["FI"]="Finland", ["FR"]="France", ["GB"]="Great-Britain", ["GL"]="Greenland", ["GY"]="Guyana", ["HR"]="Croatia", ["HU"]="Hungary", ["ID"]="Indonesia", ["IE"]="Ireland", ["IR"]="Iran", ["IS"]="Iceland", ["IT"]="Italy", ["IN"]="India", ["JO"]="Jordan", ["JM"]="Jamaica", ["jp"]="Mexico", ["KW"]="Kuwait", ["IT"]="Italy", ["LU"]="Luxembourg", ["LV"]="Latvia", ["MA"]="Morocco", ["MC"]="Monaco", ["MT"]="Malta", ["MX"]="Mexico", ["NG"]="Nigeria", ["NL"]="Netherlands", ["NO"]="Norway", ["PA"]="Panama", ["PE"]="Peru", ["PH"]="Philipines", ["PK"]="Pakistan", ["PL"]="Poland", ["PT"]="Portugal", ["QA"]="Qatar", ["RO"]="Romania", ["RU"]="Russia", ["SA"]="Saudi Arbia", ["SE"]="Sweden", ["SI"]="Slovania", ["TO"]="Tonga", ["TR"]="Turkey", ["UA"]="Ukraine", ["UK"]="United Kingdom", ["US"]="United States", ["UY"]="Uruguay", ["VN"]="Vietnam", ["YE"]="Yemen", ["YU"]="Yugoslavia", ["ZA"]="South Africa" } function onJoin() local country = exports['admin']:getPlayerCountry(source) setElementData(source,'Country', country) outputChatBox( getPlayerName ( source ) .. " has joined the game from " .. countryName[tostring(country)], 255, 100, 100 ) end addEventHandler ( "onPlayerJoin", getRootElement(), onJoin ) When player join,happend nothing Scripting in lua
CapY Posted March 25, 2012 Posted March 25, 2012 Well, it works for me. Have you put it server-side ?
Reflex# Posted March 25, 2012 Author Posted March 25, 2012 Well, it works for me.Have you put it server-side ? Yes..of course..wait i try again Scripting in lua
Reflex# Posted March 25, 2012 Author Posted March 25, 2012 May be i must add this resource to admin group? Scripting in lua
drk Posted March 25, 2012 Posted March 25, 2012 I think you need, idk. EPT Team Server Development: 0% Learning C++ | C++ is amazing
CapY Posted March 25, 2012 Posted March 25, 2012 May be i must add this resource to admin group? Yes, you do.
Reflex# Posted March 25, 2012 Author Posted March 25, 2012 May be i must add this resource to admin group? Yes, you do. I forget..how to do,remind me: Resources->Manage ACL->Groups->Admin->add object-->resource.joinquit yes? Scripting in lua
Kenix Posted March 25, 2012 Posted March 25, 2012 You not need add resource to admin group in acl. Idk why it not working for you. Can you upload resource? http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
drk Posted March 25, 2012 Posted March 25, 2012 (edited) You need Kenix. You need admin rights to get a player data from admin panel. Edited March 25, 2012 by Guest EPT Team Server Development: 0% Learning C++ | C++ is amazing
Reflex# Posted March 25, 2012 Author Posted March 25, 2012 You not need add resource to admin group in acl.Idk why it not working for you. Can you upload resource? On community? Or another file-sharing? Scripting in lua
Jaysds1 Posted March 25, 2012 Posted March 25, 2012 You not need add resource to admin group in acl.Idk why it not working for you. Can you upload resource? On community? Or another file-sharing? I think he means on a file-share site. My in-game name: Jaysds1 Retired CMG Scripter World Of Tanks GameMode (Open-Source): https://github.com/Jaysds1/mtasa-wot-gamemode Online GUI-Editor (WIP): https://forum.mtasa.com/topic/47678-online-gui-editor/
drk Posted March 25, 2012 Posted March 25, 2012 ReFleX add your script to the acl.xml ( group Admin ). Admin Panel -> Resources Tab -> Manage ACL -> Double click in Admin Group -> Add object -> Type "resource.yourJoinquitResourceName" -> Ok -> Restart resource or maybe not needed Note: Change "yourJoinquitResourceName" to your joinquit resource name, understand? EPT Team Server Development: 0% Learning C++ | C++ is amazing
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