Jump to content

Tips about anti money hack


Lovinglife

Recommended Posts

Hi all i just found this cmd on mta wiki...http://wiki.mtasa.com/wiki/GetPlayerMoney

but i need a function...for istance, smth which told me when someone got >0$ or <0$..Bob got [(-)value]$ and then kick him..indeed i need smth which controls if the ammount of the players' money is =/= 0

function checkMoney(thePlayer, command)
local money = getPlayerMoney(thePlayer)                                -- get the amount of money from the player who entered the command
if (money > 1000) then                                                 -- if money is more than 1000
	outputChatBox("You are rich: " .. tostring(money), thePlayer)  -- output this message together with the money
	else
	outputChatBox("Poor guy...", thePlayer)                        -- and else, output this message
end
end
addCommandHandler("checkMoney", checkMoney)

thanks

Regards

Lovinglife

Link to comment

The best and working 100% money anti cheat, is own created money script, using setElementData, few examples:

_givePlayerMoney=givePlayerMoney
function givePlayerMoney(player,amount)
local oldMoney = getElementData(player,'frMoney')
setElementData(player,'frMoney',oldMoney+tonumber(amount))
end
 
_takePlayerMoney=takePlayerMoney
function takePlayerMoney(player,amount)
local oldMoney = getElementData(player,'frMoney')
setElementData(player,'frMoney',oldMoney-tonumber(amount))
end

Then, if you need to show money player has on screen like GTA does, hide old money using showPlayerHudComponent() and show new one with dxDraw functions.

Link to comment
Money cheats won't work in mta, all those hacks will only change the values on client's side, but server will still have the real value.

lot of scripts uses clientside money checking ;|

hmm i didnt get this...and ppl ty for all ur answers

Btw a friend of mine tried a money hax , and actually the server returns to 0$ (or default money u get onplayerspawned, i dont know exatly), that was tried on mode "freeroam, play" since im not doing any resource atm, with money i mean, i cant give u more infos, but that should be more or less sure.

And is there a way to see player's intention? i mean i press blablakey and i get caught even if server doesnt add my $...i think that should be possibile, if u ppl say that money hax works on clientside but servers blocks it.

Regards

Lovinglife

Link to comment

Just try not to use client-side money, except for display and perhaps a check. As lil_Toady said, server-side money functions are unaffected by money hacks, and therefore players can't hack it if you've thought it through correctly. I really don't recommend doing anything with money, except for getPlayerMoney itself, client-side. If you then want to do something with the money client-side:

  • Check if the player has enough money with getPlayerMoney client-side
  • Trigger a server event
  • Check the money server-side
  • If the player has enough money, do what you want to do
  • If the player does not have enough money, don't do what you wanted to do and display an error message to the player

That's it. The server-side check is important for detecting the hacks, but you shouldn't kick/ban if the client-side money values are wrong. It could be that due to a non-hack related way the money got the way it is right now, for instance perhaps the player pressed a "Buy" button twice, and doesn't know about having less money yet at the second time the player pressed the button. Also, as being said, and I will repeat: Money hacks are harmless if you protect your server correctly. And they also won't work if you don't use money in client-side scripts at all. There is no point of kicking/banning them over a hugely failed hacking attempt. (IMO)

Link to comment
Money cheats won't work in mta, all those hacks will only change the values on client's side, but server will still have the real value.

lot of scripts uses clientside money checking ;|

Then that's the scripter's fault, it's completely avoidable.

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