Issue with anticheat
#2

This should work, if it doesn't, try creating a per player variable and check on anti-cheat if it is safety or not

pawn Код:
GiveRealWeapon(playerid, weapon, bullets)
{
    new slot = GetWeaponSlot(weapon);
    if(PlayerInfo[playerid][pWeapons][slot] != 0)
    {
        if(3 <= slot <= 5 || weapon == PlayerInfo[playerid][pWeapons][slot]) PlayerInfo[playerid][pBullets][slot] += bullets;
        else PlayerInfo[playerid][pBullets][slot] = bullets;
        PlayerInfo[playerid][pWeapons][slot] = weapon;
    }
    else
    {
        PlayerInfo[playerid][pWeapons][slot] = weapon;
        PlayerInfo[playerid][pBullets][slot] = bullets;
    }
    return GivePlayerWeapon(playerid, weapon, bullets);
}
EDIT
If that doesn't work, try this.

pawn Код:
//Per Player Variable/Array
new
    bool:RealWeapon[ MAX_PLAYERS ];

//Function
GiveRealWeapon(playerid, weapon, bullets)
{
    new slot = GetWeaponSlot(weapon);
    if(PlayerInfo[playerid][pWeapons][slot] != 0)
    {
        if(3 <= slot <= 5 || weapon == PlayerInfo[playerid][pWeapons][slot]) PlayerInfo[playerid][pBullets][slot] += bullets;
        else PlayerInfo[playerid][pBullets][slot] = bullets;
        PlayerInfo[playerid][pWeapons][slot] = weapon;
    }
    else
    {
        PlayerInfo[playerid][pWeapons][slot] = weapon;
        PlayerInfo[playerid][pBullets][slot] = bullets;
    }
    GivePlayerWeapon(playerid, weapon, bullets);
    return RealWeapon[playerid] = true;
}

//Anti Cheat
for(new slot = 0; slot < 13; slot++)
{
    new weapon, bullets;
    GetPlayerWeaponData(playerid, slot, weapon, bullets);
    if(weapon != 0 && weapon!= 46 && RealWeapon[playerid] == false)
    {
        if(weapon!= PlayerInfo[playerid][pWeapons][slot] || weapon> PlayerInfo[playerid][pBullets][slot])
        {
            format(textArray, sizeof(textArray), "[ANTICHEAT ID:%d]: Player %s has spawned weapons.", playerid, PlayerInfo[playerid][pName]);
            SendClientMessageToAll(COLOR_RED, textArray);
            break;
        }
        else PlayerInfo[playerid][pBullets][slot] = bullets;
    }
}
Reply


Messages In This Thread
Issue with anticheat - by Xabi - 28.12.2013, 10:56
Re: Issue with anticheat - by Patrick - 28.12.2013, 11:20
Respuesta: Issue with anticheat - by Xabi - 28.12.2013, 14:41
Respuesta: Issue with anticheat - by Xabi - 29.12.2013, 18:23

Forum Jump:


Users browsing this thread: 3 Guest(s)