[TUT] Obicni Anti-Money Hack

Započeo hudiga, April 23, 2012, 18:42:06 POSLE PODNE

prethodna tema - sledeća tema

0 članova i 3 gostiju pregledaju ovu temu.

Pozdrav,ovo je moj prvi tutorijal i u njemu cu vam pokazati kako da napravite obicni Anti Money Hack.Pa da pocnemo





1.Moramo definisati 2 variable!
Udjite u vas mod i nadjite gdje su vam definisani  new i dodajte sledece:
new OldMoney[MAX_PLAYERS];
new NewMoney[MAX_PLAYERS];



2.Sada moramo napraviti funkciju kada igracu dadnete novac da ga ne banuje:
Odite na kraj vaseg moda i dodajte:
forward GivePlayerMoneyEx(playerid,ammount);//Forward - this is how you call a new public
public GivePlayerMoneyEx(playerid,ammount)
{
      //First the gonna have to set the OldMoney of the player , just in case .
      OldMoney[playerid] = GetPlayerMoney(playerid)//Get the money ( GetPlayerMoney ) they put it in the OldMoney var...
      //Now we gotta define the new ammount of money the player holds , we gotta do it before we give him the money , so he wont get banned / kicked .
      NewMoney[playerid] = ammount;//Putting the ammount in the NewMoney var
      //Now we gotta give the player some sweet cash
      GivePlayerMoney(playerid,ammount);//default function : )
     
      return 1;
}



3:Provjera novca
Moramo napraviti timer koji ce svakih 2 sekunde provjeravati.Ispod ovog sto ste zadnje dodali,dodajte i ovo:
forward CheckMoney();
public CheckMoney()
{
      for(new i = 0; i < MAX_PLAYERS; I++)//This loop will check all players at one time
      {
               if(IsPlayerConnected(i))//Player is gotta be connected right ?
               {
                        if(GetPlayerMoney(i) > NewMoney[i])//Getting player's money , checking if its more then his NewMoney(means he is hacking)
                        {
                                  ResetPlayerMoney(i);//We gonna reset his money
                                  GivePlayerMoney(i,OldMoney[i]);//Give him his old money , as a punishment !
                                  Ban(i);//Kick/Ban the poor kid         
                        }
               }
      }
      return 1;
}



4:Namjestanje timera.
Pod OnGameModeInIt dodajte:
SetTimer("CheckMoney",2000,true);


5:Zadji korak je podesavanje NewMoney kada se igrac konektuje na server.
OnPlayerConnect(playerid)
{
     NewMoney[playerid] = GetPlayerMoney(playerid);
     return 1;
}






Ako sam nesto pogresno uradio molim vas da me obavsjetite jer sam ono na brzinu uradio.
Orginalna tema: http://forum.sa-mp.com/showthread.php?t=292898

TakoÄ'er si trebao naglasit da ovo neradi sa sprunk machines, pay&spray, ammunation i sl.
.. ali pohvala za trud(prevod).

for(new i = 0; i < MAX_PLAYERS; I++)ovdje imaš grešku

if(IsPlayerConnected(i))//Player is gotta be connected right ? i ovo ti netreba..

I nevidim svrhu varijable 'OldMoney' jer se igrač banuje zar ne?



Ako koristite ovo u modu gdje postoji spremanje računa(novca) onda ovo pod onplayerconnect zamijenite sa '0' (NewMoney[playerid] = 0;) - nema neki značaj ali može spriječit ban zbog timera..

A postoje ovakva 2 tutorijala tu na forumu tako da ovo i nije baš korisno.
Poslednja Izmena: April 23, 2012, 19:21:21 POSLE PODNE od K4[Я]!K3™

A da umesto ovog


NewMoney[playerid] = ammount;


ne treba


NewMoney[playerid] += ammount;


jer svaki put kad igracu das novac on postavlja newmoney na taj novac primer:

GivePlayerMoneyEx(playerid, 1000);

stavice NewMoney na 1000, a onda kada

GivePlayerMoneyEx(playerid, 1);

stavice NewMoney na 1, a igrac ce imati 1001 dolar i banace ga ?

Mozda gresim al mislim da sam upravu :D

Al sve u svemu pohvala na trudu :)
Poslednja Izmena: April 24, 2012, 12:30:09 POSLE PODNE od dock


Super  ;)
Balkan Underground Ex. Head Administrator
Balkan Underground Ex. Elite Moderator


© Stefan_Misurovic, 2010. - 2014.


Bravo dobar tut!

Napoli-Best team in the world.


Napoli-Best fans in the world.


hvala hvala...posluzit ce :D
Forum: http://www.gu-gaming.com/
Server IP: 78.46.21.212:7752