Jump to content

Achievement


S3Nn4oXx

Recommended Posts

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

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

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

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
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
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

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
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 by Guest
Link to comment
  
[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
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 :roll:

Link to comment

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...