S3Nn4oXx Posted December 11, 2015 Share Posted December 11, 2015 When I reach 1m It doesn't show a message + no debug message color = 255,0,0 function RichmanAch(thePlayer) local account = getPlayerAccount(thePlayer) if not isGuestAccount( account ) then if getAccountData(account,"RichMan:Achievement") ~= "done" then if (getPlayerMoney(thePlayer)) >= 1000000 then outputChatBox(getPlayerName(thePlayer).."Has Reached 'RichMan' Achievement, Congratulations!", getRootElement(), color, true) setAccountData(account, "RichMan:Achievement", "done") end end end end addEventHandler("onClientRender", getRootElement(), RichmanAch) Link to comment
Rockyz Posted December 11, 2015 Share Posted December 11, 2015 function RichmanAch(thePlayer) local account = getPlayerAccount(thePlayer) if not isGuestAccount( account ) then if getAccountData(account,"RichMan:Achievement") ~= "done" then if (getPlayerMoney(thePlayer)) >= 1000000 then outputChatBox(getPlayerName(thePlayer).."Has Reached 'RichMan' Achievement, Congratulations!", getRootElement(), 255, 0, 0, true) setAccountData(account, "RichMan:Achievement", "done") end end end end addEventHandler("onClientRender", getRootElement(), RichmanAch) Link to comment
S3Nn4oXx Posted December 11, 2015 Author Share Posted December 11, 2015 function RichmanAch(thePlayer) local account = getPlayerAccount(thePlayer) if not isGuestAccount( account ) then if getAccountData(account,"RichMan:Achievement") ~= "done" then if (getPlayerMoney(thePlayer)) >= 1000000 then outputChatBox(getPlayerName(thePlayer).."Has Reached 'RichMan' Achievement, Congratulations!", getRootElement(), 255, 0, 0, true) setAccountData(account, "RichMan:Achievement", "done") end end end end addEventHandler("onClientRender", getRootElement(), RichmanAch) same, Not working Link to comment
#RooTs Posted December 11, 2015 Share Posted December 11, 2015 "onClientRender" is client side and "setAccountData" "isGuestAccount" "getAccountData" is server side Link to comment
S3Nn4oXx Posted December 11, 2015 Author Share Posted December 11, 2015 When I trigger the event from server side, It doesn't work too Should I remove onClientRender event? Link to comment
#RooTs Posted December 11, 2015 Share Posted December 11, 2015 When I trigger the event from server side, It doesn't work too Should I remove onClientRender event? Yes, maybe add the event "onResourceStart" addEventHandler("onResourceStart", getRootElement(), RichmanAch) Link to comment
S3Nn4oXx Posted December 12, 2015 Author Share Posted December 12, 2015 I don't get it look here I reiterated the account already at line 2 "local PlrAccount = getPlayerAccount(thePlayer)" [15:15:40] WARNING: Ach\script.lua:2: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got resource-data] [15:15:40] WARNING: Ach\script.lua:3: Bad argument @ 'isGuestAccount' [Expected account at argument 1, got boolean] [15:15:40] WARNING: Ach\script.lua:4: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean] [15:15:40] WARNING: Ach\script.lua:5: Bad argument @ 'getPlayerMoney' [Expected player at argument 1, got resource-data] [15:15:40] ERROR: Ach\script.lua:5: attempt to compare number with boolean function RichmanAch(thePlayer) local PlrAccount = getPlayerAccount(thePlayer) if not isGuestAccount( PlrAccount ) then if getAccountData(PlrAccount,"RichMan:Achievement") ~= "done" then if (getPlayerMoney(thePlayer)) >= 1000000 then outputChatBox(getPlayerName(thePlayer).."Has Reached 'RichMan' Achievement, Congratulations!", getRootElement(), 255, 0, 0, true) setAccountData(PlrAccount, "RichMan:Achievement", "done") end end end end addEventHandler("onResourceStart", getRootElement(), RichmanAch) Link to comment
iPrestege Posted December 12, 2015 Share Posted December 12, 2015 function RichmanAch ( ) for _,thePlayer in ipairs getElementsByType ( "player" ) do local PlrAccount = getPlayerAccount(thePlayer) if not isGuestAccount( PlrAccount ) then if getAccountData(PlrAccount,"RichMan:Achievement") ~= "done" then if (getPlayerMoney(thePlayer)) >= 1000000 then outputChatBox(getPlayerName(thePlayer).."Has Reached 'RichMan' Achievement, Congratulations!", getRootElement(), 255, 0, 0, true) setAccountData(PlrAccount, "RichMan:Achievement", "done") end end end end end addEventHandler("onResourceStart", getRootElement(), RichmanAch) SERVER SIDE ! Link to comment
#RooTs Posted December 12, 2015 Share Posted December 12, 2015 Give-me the your meta.xml set in meta type="server" <script src="source.lua" type="server" /> Link to comment
iPrestege Posted December 12, 2015 Share Posted December 12, 2015 Give-me the your meta.xml set in meta type="server" <script src="source.lua" type="server" /> Actually the problem could not be from the meta only thePlayer is not defined in his code. Link to comment
S3Nn4oXx Posted December 12, 2015 Author Share Posted December 12, 2015 Give-me the your meta.xml set in meta type="server" <script src="source.lua" type="server" /> <meta> <script src="script.lua" type="server" /> </meta> I am not that stupid sir ;D == Mr.Pres[T]ege It's still not working function RichmanAch ( thePlayer ) local plr = getElementsByType( "player" ) for i,thePlayer in ipairs(plr) do local PlrAccount = getPlayerAccount(thePlayer) if not isGuestAccount( PlrAccount ) then if getAccountData(PlrAccount,"RichMan:Achievement") ~= "done" then if (getPlayerMoney(thePlayer)) >= 1000000 then outputChatBox(getPlayerName(thePlayer).."Has Reached 'RichMan' Achievement, Congratulations!", getRootElement(), 255, 0, 0, true) setAccountData(PlrAccount, "RichMan:Achievement", "done") end end end end end addEventHandler("onResourceStart", getRootElement(), RichmanAch) Link to comment
iPrestege Posted December 12, 2015 Share Posted December 12, 2015 Any errors? /debugscript3? Link to comment
S3Nn4oXx Posted December 12, 2015 Author Share Posted December 12, 2015 Any errors? /debugscript3? it was it was ERROR: Loading script failed: Ach\script.lua:2: 'do' expected near 'getElementsByType' when I changed it, it doesn't show up Link to comment
#RooTs Posted December 12, 2015 Share Posted December 12, 2015 try this function RichmanAch ( thePlayer ) local plr = getElementsByType( "player" ) for k, v in ipairs(getElementsByType("player")) do local PlrAccount = getPlayerAccount(thePlayer) if not isGuestAccount( PlrAccount ) then if getAccountData(v,"RichMan:Achievement") ~= "done" then if (getPlayerMoney(thePlayer)) >= 1000000 then outputChatBox(getPlayerName(thePlayer).."Has Reached 'RichMan' Achievement, Congratulations!", getRootElement(), 255, 0, 0, true) setAccountData(v, "RichMan:Achievement", "done") end end end end end addEventHandler("onResourceStart", getRootElement(), RichmanAch) EDIT: my code edited Link to comment
iPrestege Posted December 12, 2015 Share Posted December 12, 2015 (edited) function RichmanAch ( ) for k, v in ipairs(getElementsByType("player")) do local PlrAccount = getPlayerAccount(v) if not isGuestAccount( PlrAccount ) then if getAccountData(PlrAccount,"RichMan:Achievement") ~= "done" then if (getPlayerMoney(v)) >= 1000000 then outputChatBox(getPlayerName(v).."Has Reached 'RichMan' Achievement, Congratulations!", getRootElement(), 255, 0, 0, true) setAccountData(PlrAccount, "RichMan:Achievement", "done") end end end end end addEventHandler("onResourceStart", getRootElement(), RichmanAch) Note : Code edited Edited December 12, 2015 by Guest Link to comment
S3Nn4oXx Posted December 12, 2015 Author Share Posted December 12, 2015 [21:25:56] WARNING: Ach\script.lua:4: Bad argument @ 'getPlayerAccount' [Expected element at argument 1, got resource-data] [21:25:56] WARNING: Ach\script.lua:5: Bad argument @ 'isGuestAccount' [Expected account at argument 1, got boolean] [21:25:56] WARNING: Ach\script.lua:6: Bad argument @ 'getAccountData' [Expected account at argument 1, got player] [21:25:56] WARNING: Ach\script.lua:7: Bad argument @ 'getPlayerMoney' [Expected player at argument 1, got resource-data] [21:25:56] ERROR: Ach\script.lua:7: attempt to compare number with boolean Link to comment
#RooTs Posted December 12, 2015 Share Posted December 12, 2015 function RichmanAch ( ) for k, v in ipairs(getElementsByType("player")) do local PlrAccount = getPlayerAccount(v) if not isGuestAccount( plrAccount ) then if getAccountData(plrAccount,"RichMan:Achievement") ~= "done" then if (getPlayerMoney(v)) >= 1000000 then outputChatBox(getPlayerName(v).."Has Reached 'RichMan' Achievement, Congratulations!", getRootElement(), 255, 0, 0, true) setAccountData(v, "RichMan:Achievement", "done") end end end end end addEventHandler("onResourceStart", getRootElement(), RichmanAch) test the code of Mr.Pres[T]ege, please Link to comment
iPrestege Posted December 12, 2015 Share Posted December 12, 2015 Sorry fixed some errors : function RichmanAch ( ) for k, v in ipairs(getElementsByType("player")) do local PlrAccount = getPlayerAccount(v) if not isGuestAccount( PlrAccount ) then if getAccountData(PlrAccount,"RichMan:Achievement") ~= "done" then if (getPlayerMoney(v)) >= 1000000 then outputChatBox(getPlayerName(v).."Has Reached 'RichMan' Achievement, Congratulations!", getRootElement(), 255, 0, 0, true) setAccountData(PlrAccount, "RichMan:Achievement", "done") end end end end end addEventHandler("onResourceStart", getRootElement(), RichmanAch) 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