SA-MP Forums Archive
Im trying ... (anti-wep) .. and I fail >.< - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Im trying ... (anti-wep) .. and I fail >.< (/showthread.php?tid=71207)

Pages: 1 2


Im trying ... (anti-wep) .. and I fail >.< - Divine - 30.03.2009

Hello ...
I want to make this lil anti-cheat .. that kicks player for ellegal wep ..

...
all i got is this
Код:
public OnPlayerUpdate(playerid)
    }
	GetPlayerWeaponData(playerid, slot, &weapons, &ammo);
	if (&weapons = 35 && ammo >=1);
	}
	SendClientMessage(playerid,	0xE60000FF, "HACKER");
	Kick(playerid);
	}
	return 1;
}
....
but since i suck at this .. it dosent work ...
any ideas to help a lil ?
...
im a beginner so dont plz dont give me a hard time ...
Thnx in advice


Re: Im trying ... (anti-wep) .. and I fail >.< - LarzI - 30.03.2009

pawn Код:
public OnPlayerUpdate(playerid)
{
    new weapons, ammo, slot;
    while(slot < 12)
        slot++;
    GetPlayerWeaponData(playerid, slot, weapons, ammo);
    if (weapons = 35 && ammo > 0);
    {
        SendClientMessage(playerid, 0xE60000FF, "HACKER");
        Kick(playerid);
    }
    return 1;
}
Can't guarantee it will work (untested)


Re: Im trying ... (anti-wep) .. and I fail >.< - Divine - 30.03.2009

Quote:
Originally Posted by lrZ^ aka LarzI
pawn Код:
public OnPlayerUpdate(playerid)
{
    new weapons, ammo, slot;
    while(slot < 12)
        slot++;
    GetPlayerWeaponData(playerid, slot, weapons, ammo);
    if (weapons = 35 && ammo > 0);
    {
        SendClientMessage(playerid, 0xE60000FF, "HACKER");
        Kick(playerid);
    }
    return 1;
}
Can't guarantee it will work (untested)

Код:
line (385)  if (weapons = 35 && ammo > 0);

C:\Documents and Settings\User\Desktop\SCRIPT\gamemodes\WuD222.pwn(385) : warning 211: possibly unintended assignment
C:\Documents and Settings\User\Desktop\SCRIPT\gamemodes\WuD222.pwn(385) : error 036: empty statement
... gah ... why ? ;(





Re: Im trying ... (anti-wep) .. and I fail >.< - Pyrokid - 30.03.2009

pawn Код:
if (weapons = 35 && ammo > 0);
Should be
pawn Код:
if (weapons == 35 && ammo > 0);
There's two equal signs.


Re: Im trying ... (anti-wep) .. and I fail >.< - Divine - 30.03.2009

Quote:
Originally Posted by Pyrokid
pawn Код:
if (weapons = 35 && ammo > 0);
Should be
pawn Код:
if (weapons == 35 && ammo > 0);
There's two equal signs.
Код:
C:\Documents and Settings\User\Desktop\SCRIPT\gamemodes\WuD222.pwn(385) : error 036: empty statement
still same .. i dont get it


Re: Im trying ... (anti-wep) .. and I fail >.< - Pyrokid - 30.03.2009

Oh, and remove that semicolon.

if (weapons == 35 && ammo > 0)


Re: Im trying ... (anti-wep) .. and I fail >.< - Divine - 30.03.2009

Quote:
Originally Posted by Pyrokid
Oh, and remove that semicolon.

if (weapons == 35 && ammo > 0)
Now it looks like this
Код:
public OnPlayerUpdate(playerid)
{
new weapons, ammo, slot;
while(slot < 12)
slot++;
GetPlayerWeaponData(playerid, slot, weapons, ammo);
{
SendClientMessage(playerid,	0xE60000FF, "HACKER");
Kick(playerid);
}
return 1;
}
no errors ...
but how will it kick the MINIGUN .. if there is no minigun id ?


Re: Im trying ... (anti-wep) .. and I fail >.< - Shellegg - 30.03.2009

minigun is equipped on 12 slot like RPG and rocket launcher and flamethrower.. so every one of those weapons will kick the player


Re: Im trying ... (anti-wep) .. and I fail >.< - Divine - 30.03.2009

Quote:
Originally Posted by Shellegg
minigun is equipped on 12 slot like RPG and rocket launcher and flamethrower.. so every one of those weapons will kick the player
oh nice ...
but if

...
NY ******s...
IR ******s ...
and Parachute are in same slot ...
...
i want to kick those NY and IR ... but i dont want to kick Parachute


Re: Im trying ... (anti-wep) .. and I fail >.< - Divine - 30.03.2009

Quote:
Originally Posted by Divine
...
NY ******s...
IR ******s ...
and Parachute are in same slot ...
...
i want to kick those NY and IR ... but i dont want to kick Parachute
so maybe its ?

Код:
public OnPlayerUpdate(playerid)
{
new weapons, ammo, slot;
while(weapons < 45)
slot++;
GetPlayerWeaponData(playerid, slot, weapons, ammo);
{
SendClientMessage(playerid,	0xE60000FF, "HACKER");
Kick(playerid);
}
return 1;
}
will that work ?


Re: Im trying ... (anti-wep) .. and I fail >.< - Divine - 30.03.2009

Quote:
Originally Posted by Divine
will that work ?
YAY IT WORKED !!


THNX GUYS !!


Re: Im trying ... (anti-wep) .. and I fail >.< - Pyrokid - 30.03.2009

How did it work if you removed
if (weapons == 35 && ammo > 0)
??

I said remove the semicolon which is this ";" not the whole line.


Re: Im trying ... (anti-wep) .. and I fail >.< - Divine - 30.03.2009

Quote:
Originally Posted by Pyrokid
How did it work if you removed
if (weapons == 35 && ammo > 0)
??

I said remove the semicolon which is this ";" not the whole line.
.... magick ? ...
i just gave no errors...
maybe it might not work ... ?
... I MUST TEST this ..


Re: Im trying ... (anti-wep) .. and I fail >.< - Divine - 30.03.2009

Quote:
Originally Posted by Divine
Quote:
Originally Posted by Pyrokid
How did it work if you removed
if (weapons == 35 && ammo > 0)
??

I said remove the semicolon which is this ";" not the whole line.
.... magick ? ...
i just gave no errors...
maybe it might not work ... ?
... I MUST TEST this ..
ok it failed....

...................
i did some editing again .. looks tike this
Код:
public OnPlayerUpdate(playerid)
{
new weapons, ammo, slot;
while(slot < 12)
slot++;
if (weapons == 35 && ammo > 0)
GetPlayerWeaponData(playerid, slot, weapons, ammo);
{
SendClientMessage(playerid,	0xE60000FF, "HACKER");
Kick(playerid);
}
return 1;
}
...
lats thing i saw was a message "server clossed the connection" ...
now it works !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
tested and WORKS !!!!!!!!!!!!!!!!!......
..
Thnx guys !!!
I LOVE YOU !!! (in a friendly way, not gay :P )


Re: Im trying ... (anti-wep) .. and I fail >.< - Pyrokid - 30.03.2009

pawn Код:
if (weapons == 35 && ammo > 0)
GetPlayerWeaponData(playerid, slot, weapons, ammo);
{
Still looks wonky. It should be like this
pawn Код:
public OnPlayerUpdate(playerid)
{
    new weapons, ammo, slot;
    while(slot < 12)
    slot++;
    GetPlayerWeaponData(playerid, slot, weapons, ammo);
    if (weapons == 35 && ammo > 0)
    {
        SendClientMessage(playerid, 0xE60000FF, "HACKER");
        Kick(playerid);
    }
    return 1;
}



Re: Im trying ... (anti-wep) .. and I fail >.< - Divine - 30.03.2009

Quote:
Originally Posted by Pyrokid
pawn Код:
if (weapons == 35 && ammo > 0)
GetPlayerWeaponData(playerid, slot, weapons, ammo);
{
Still looks wonky. It should be like this
pawn Код:
public OnPlayerUpdate(playerid)
{
    new weapons, ammo, slot;
    while(slot < 12)
    slot++;
    GetPlayerWeaponData(playerid, slot, weapons, ammo);
    if (weapons == 35 && ammo > 0)
    {
        SendClientMessage(playerid, 0xE60000FF, "HACKER");
        Kick(playerid);
    }
    return 1;
}
scrooled all the weps .. nothing...
and MY version just kicks when i hold any wep at all


Re: Im trying ... (anti-wep) .. and I fail >.< - LarzI - 30.03.2009

I'm sorry for my bad code, abit tired


Re: Im trying ... (anti-wep) .. and I fail >.< - Divine - 31.03.2009

Quote:
Originally Posted by lrZ^ aka LarzI
I'm sorry for my bad code, abit tired
.. anyone got good and easy code ?? ... aww


Re: Im trying ... (anti-wep) .. and I fail >.< - illay - 31.03.2009

Anti-Weapon,

pawn Код:
#include <a_samp>

forward public WeaponCheating();
forward public BanPlayer();

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Anti-Weapon Cheat by illay");
    print("--------------------------------------\n");
    return 1;
}

public WeaponCheating() { //by illay (http://forum.sa-mp.com)
    for(new i=0;i<MAX_PLAYERS;i++) {
      if(GetPlayerWeapon(i)==38&&GetPlayerWeapon(i)==37) {
        SendClientMessage(i, 0xE60000FF, "No cheating in server, f*ck you! BANNED!");
        return SetTimer("BanPlayer",1000,false);
        }
    }
    return 1;
}

public BanPlayer() {
  for(new i=0;i<MAX_PLAYERS;i++) {
    return BanEx(i,"WEAPON CHEATING");//Reason to samp.ban file
    }
    return 1;
}



Re: Im trying ... (anti-wep) .. and I fail >.< - Divine - 02.04.2009

Quote:
Originally Posted by illay
Anti-Weapon,
Its good... But i want to kick only ///
What if i do like this

pawn Код:
#include <a_samp>

forward public WeaponCheating();



public WeaponCheating() { //by illay (http://forum.sa-mp.com)
    for(new i=0;i<MAX_PLAYERS;i++) {
      if(GetPlayerWeapon(i)==38&&GetPlayerWeapon(i)==37) {
        SendClientMessage(i, 0xE60000FF, "No cheating in server, f*ck you! KICKED!");
        Kick(i)
        }
    }
    return 1;
}
Would it work ? ....
..
im in school now so i cant test it :S :S