SA-MP Forums Archive
weapon ac not working - 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: weapon ac not working (/showthread.php?tid=193926)



weapon ac not working - The_Gangstas - 28.11.2010

pawn Код:
new ScriptWeaponsUpdated[MAX_PLAYERS];
new ScriptWeapons[MAX_PLAYERS][13];

public SafeResetPlayerMoney(playerid)
{
    PlayerInfo[playerid][Money] = 0;
    return ResetPlayerMoney(playerid);
}
public SafeGivePlayerWeapon(playerid, weaponid, ammo)
{
    ScriptWeaponsUpdated[playerid] = 1;
    GivePlayerWeapon(playerid, weaponid, ammo);
    UpdateWeapons(playerid);
    return 1;
}
public SafeResetPlayerWeapons(playerid)
{
    ScriptWeaponsUpdated[playerid] = 1;
    ResetPlayerWeapons(playerid);
    UpdateWeapons(playerid);
    return 1;
}
forward UpdateWeapons(plyid);
public UpdateWeapons(plyid)
{
    new weaponid, ammo;
    for(new i = 0; i < 13; i++)
    {
        GetPlayerWeaponData(plyid, i, weaponid, ammo);
        ScriptWeapons[plyid][i] = weaponid;
    }
    ScriptWeaponsUpdated[plyid] = 0;
    return 1;
}
pawn Код:
foreach(Player,i)
    {
        if(ScriptWeaponsUpdated[i] == 0)
        {
            for (new c = 0; c < 13; c++)
            {
                GetPlayerWeaponData(i, c, weaponid, ammo);
                if (weaponid != 0 && ammo != 0)
                {
                    if (ScriptWeapons[i][c] != weaponid)
                    {
                        new weapon[24]; GetWeaponName(weaponid, weapon, 24);
                       
                        new string[128];
                        format(string, sizeof(string), "**(AUTO BAN)** %s(%d) Has Been Banned From The Server - Reason: Weapon Hacks/Cheats",Playername(i),i);
                        SendClientMessageToAll(PINK, string);
                        format(string, sizeof(string),"You have Been Banned by The K Anticheat For Weapon Hacking A %s(%d) For 15 Days",weapon,weaponid);
                        SafeResetPlayerWeapons(i);
                        SafeBan(i,"Auto Weapon Hacks",15);
                    }
                }
            }
        }
i use safegiveplayerweapon and it bans me..


Re: weapon ac not working - XoSarahMoX - 28.11.2010

search for any giveplayerweapon in the script and make sure it isnt altering with your other commands or things.


Re: weapon ac not working - The_Gangstas - 28.11.2010

no.. its all safegiveplayerweapon


Re: weapon ac not working - XoSarahMoX - 28.11.2010

Why did you make it SafeBan? maybe that is causing the problem why not just use normal banex? or ban?


Re: weapon ac not working - The_Gangstas - 28.11.2010

please dont post if u dont know what your saying..


Re: weapon ac not working - cessil - 28.11.2010

If you're not running the server locally then you're going to have lag between the server setting your weapon and the time you actually get the weapon client side.

So if you have a normal shotgun and you buy a combat shotgun the script will say "ok he has a combat shotgun not a normal shotgun" and due to lag you'll receive the weapon shortly after, if the weapon cheat checks before you get the weapon you will be banned.


Re: weapon ac not working - The_Gangstas - 28.11.2010

nevermind i fixed it.

i made a updateweapon(playerid,weaponid) function on onplayerupdate when the player changes a weapon


Re: weapon ac not working - cessil - 28.11.2010

you'll still have the same problem


Re: weapon ac not working - The_Gangstas - 28.11.2010

nope, it works fine. i tested it, and i added a custom addplayerclass and setspawninfo

pawn Код:
public OnPlayerUpdate(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        new iCurWeap = GetPlayerWeapon(playerid);
        if(iCurWeap != GetPVarInt(playerid, "iCurrentWeapon"))
        {
        OnPlayerChangeWeapon(playerid, GetPVarInt(playerid, "iCurrentWeapon"), iCurWeap);
        SetPVarInt(playerid, "iCurrentWeapon", iCurWeap);//Update the weapon variable
        }

forward OnPlayerChangeWeapon(playerid, oldweapon, newweapon);
public OnPlayerChangeWeapon(playerid, oldweapon, newweapon)
{
    UpdateWeapon(playerid,newweapon);
    switch(newweapon)
    {
etc .. works fine.