SA-MP Forums Archive
[Tutorial] Anti Fake-Kill Script in 4 pasi usori - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Română/Romanian (https://sampforum.blast.hk/forumdisplay.php?fid=40)
+----- Forum: Salonul Scripturilor (https://sampforum.blast.hk/forumdisplay.php?fid=77)
+----- Thread: [Tutorial] Anti Fake-Kill Script in 4 pasi usori (/showthread.php?tid=449119)



Anti Fake-Kill Script in 4 pasi usori - [Ro]DuReX - 07.07.2013

Salut! Am vazut ca mai multi s-au plans ca unii fac flood cu kill-uri false si le strica si server-ul.
Aici va voi arata cum sa previi acest lucru: folosind variabile.
Tutorialul este simplu, facut pentru incepatori.
Un Fake-Kill arata asa, in server_log:
Code:
[04/07/2013 21:24:26] [kill] Nevinovat1 killed [RNG]DuReX Dildo
[04/07/2013 21:24:26] [kill] Nevinovat2 killed [RNG]DuReX Dildo
[04/07/2013 21:24:26] [kill] Nevinovat3 killed [RNG]DuReX Dildo
[04/07/2013 21:24:26] [kill] Nevinovat4 killed [RNG]DuReX Dildo
[04/07/2013 21:24:26] [kill] Nevinovat5 killed [RNG]DuReX Dildo
[04/07/2013 21:24:26] [kill] Nevinovat6 killed [RNG]DuReX Dildo
[04/07/2013 21:24:27] [kill] Nevinovat7 killed [RNG]DuReX Dildo
[04/07/2013 21:24:27] [kill] Nevinovat8 killed [RNG]DuReX Dildo
etc.
Sa incepem

Pasul 1: Resetarea variabilei jucatorului cand acesta este spawnat
Adaugam SetPVarInt(playerid,"KilledFlood",0); sub callback-ul OnPlayerSpawn:
pawn Code:
public OnPlayerSpawn(playerid)
{
    SetPVarInt(playerid,"KilledFlood",0);
    return 1;
}
Am facut asta deoarece flooderii nu se spawneaza dupa ce sunt omorati. Daca nu facem primul pas, toti jucatorii care omoara de doua ori (nu conteaza cand si cum) vor fi banati.
Poti pune si alta denumire a variabilei, nu esti obligat sa pui cum am pus eu, si anume "Killed Flood".

Pasul 2: Setarea variabilei jucatorului cand acesta este ucis
Adaugam SetPVarInt(playerid,"KilledFlood", GetPVarInt(playerid,"KilledFlood") + 1); sub callback-ul OnPlayerDeath:
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
    SetPVarInt(playerid,"KilledFlood", GetPVarInt(playerid,"KilledFlood") + 1);
    return 1;
}
Iar variabila se va reseta cand jucatorul se va spawna. Flooderii nu se spawneaza si vor avea o variabila mai mare. Mai multe vedem la pasul al treilea.

Pasul 3: Banarea jucatorului (flooder), daca acesta are variabila 2 sau mai mare
Adaugam if(GetPVarInt(playerid,"KilledFlood") > 1) return BanEx(playerid, "(Fake Kill Flood)"); sub callback-ul OnPlayerDeath:
pawn Code:
public OnPlayerDeath(playerid, killerid, reason)
{
    SetPVarInt(playerid,"KilledFlood", GetPVarInt(playerid,"KilledFlood") + 1);
    if(GetPVarInt(playerid,"KilledFlood") > 1) return BanEx(playerid, "(Fake-Kill Flood)");
    return 1;
}
Se poate folosi si functia "Kick", dar flooderii se pot reconecta si e mai bine sa ii banam, ca sa scapam de ei

Pasul 4: Resetarea variabilei jucatorului cand acesta se deconecteaza
Adaugam SetPVarInt(playerid,"KilledFlood",0); sub callback-ul OnPlayerDisconnect:
pawn Code:
public OnPlayerDisconnect(playerid, reason)
{
    SetPVarInt(playerid,"KilledFlood",0);
    return 1;
}
GATA TOT!

Acum hai sa revedem scriptul pe care l-am facut:
pawn Code:
public OnPlayerSpawn(playerid)
{
    SetPVarInt(playerid,"KilledFlood",0);
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    SetPVarInt(playerid,"KilledFlood", GetPVarInt(playerid,"KilledFlood") + 1);
    if(GetPVarInt(playerid,"KilledFlood") > 1) return BanEx(playerid, "(Fake-Kill Flood)");
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    SetPVarInt(playerid,"KilledFlood",0);
    return 1;
}
Daca ai nelamuriri, posteaza aici sau trimite-mi un PM.


Re: Anti Fake-Kill Script in 4 pasi usori - ElectroX - 31.08.2013

M-a ajutat, multumesc mult!


Re: Anti Fake-Kill Script in 4 pasi usori - IonuVRS - 17.06.2014

Mda... Merge, am facut si am compilat.

BUG:Am intrat pe server, si am testat niste comenzi din nou, cand dau /kill, ma omoara asa, cum trebuie si mi-i se termina comanda, dar "Server Closed The Connection"

si dupa aceea, am scos FS-ul (ca l-am facut FS) si am dat /kill, si a mers, prima data credeam ca comanda /kill are ceva, asa ca am schimbat-o in /die, tot o poveste, si am scos Anti-Flood-ul (Server pe localhost, este asa de tutoriale )