Got one error on a return statement
#3

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
Really messy, man. And use a timer instead of OnPlayerUpdate(...).
pawn Код:
#include <a_samp>
#define COLOR_GREEN 0x33AA33AA

public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Blank Filterscript by your name here");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

public OnPlayerConnect(playerid)
{
    SendClientMessage(playerid, COLOR_GREEN, "[VANILLA-ANTICHEATS] ANTICHEAT SYSTEM IS ON. I'M WATCHING YOU ;)");
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    if(GetPlayerWeapon(killerid) == 38) Ban(killerid); //Ban if they have a minigun
    SendClientMessage(killerid, COLOR_GREEN, "[VANILLA-ANTICHEATS] YOU HAVE BEEN AUTO-BANNED FOR REASON: MINIGUN");
    if(GetPlayerWeapon(killerid) == 35) Ban(killerid); //Ban if they have a RPG
    SendClientMessage(killerid, COLOR_GREEN, "[VANILLA-ANTICHEATS] YOU HAVE BEEN AUTO-BANNED FOR REASON: RPG");
    if(GetPlayerWeapon(killerid) == 36) Ban(killerid); //Ban if they have a HEAT SEEKER
    SendClientMessage(killerid, COLOR_GREEN, "[VANILLA-ANTICHEATS] YOU HAVE BEEN AUTO-BANNED FOR REASON: HEAT SEEKER");
    return 1;
}

public OnPlayerUpdate(playerid)
{
    // ---------------- ANTI HEALTH HACK --------------------------------------------
    new Float:fHealth;

    GetPlayerHealth(playerid, fHealth);

    if(fHealth != GetPVarFloat(playerid, "faPlayerHealth"))
    {
        // Player health has changed since the last update -> server, so obviously thats the thing updated.
        // Lets do further checks see if he's lost or gained health, anti-health cheat? ;)

        if(fHealth > GetPVarFloat(playerid, "faPlayerHealth"))
        {
            Ban(playerid);
            SendClientMessage(playerid, COLOR_GREEN, "[VANILLA-ANTICHEATS] YOU HAVE BEEN AUTO-BANNED FOR REASON: HEALTH HACK");
            /* He has gained health! Cheating? Write your own scripts here to figure how a player
            gained health! */

        }
        else
        {
            /* He has lost health! */
        }

        SetPVarFloat(playerid, "faPlayerHealth", fHealth);
        return 1;
    }

    // ---------------- ANTI ARMOUR HACK --------------------------------------------
    new Float:fArmour;

    GetPlayerArmour(playerid, fArmour);

    if(fArmour != GetPVarFloat(playerid, "faPlayerArmour"))
    {
        // Player armour has changed since the last update -> server, so obviously thats the thing updated.
        // Lets do further checks see if he's lost or gained health, anti-health cheat? ;)

        if(fArmour > GetPVarFloat(playerid, "faPlayerArmour"))
        {
            Ban(playerid);
            SendClientMessage(playerid, COLOR_GREEN, "[VANILLA-ANTICHEATS] YOU HAVE BEEN AUTO-BANNED FOR REASON: ARMOUR HACK");
            /* He has gained armour! Cheating? Write your own scripts here to figure how a player
            gained health! */

        }
        else
        {
            /* He has lost armour! */
        }

        SetPVarFloat(playerid, "faPlayerArmour", fArmour);
        return 1;
    }


    //------------------------- ANTI WEAPON HACK --------------------------------------------------------------
    new iCurWeap = GetPlayerWeapon(playerid); // Return the player's current weapon
    if(iCurWeap != GetPVarInt(playerid, "iCurrentWeapon")) // If he changed weapons since the last update
    {
        // Lets call a callback named OnPlayerChangeWeapon
        OnPlayerChangeWeapon(playerid, GetPVarInt(playerid, "iCurrentWeapon"), iCurWeap);
        SetPVarInt(playerid, "iCurrentWeapon", iCurWeap);//Update the weapon variable
    }
    return 1; // Send this update to other players.
}

stock OnPlayerChangeWeapon(playerid, oldweapon, newweapon)
{
    new     s[128],
        oWeapon[24],
        nWeapon[24];

    GetWeaponName(oldweapon, oWeapon, sizeof(oWeapon));
    GetWeaponName(newweapon, nWeapon, sizeof(nWeapon));

    format(s, sizeof(s), "You changed weapon from %s to %s!", oWeapon, nWeapon);

    SendClientMessage(playerid, 0xFFFFFFFF, s);
    if(GetPlayerWeapon(playerid) == 38) Ban(playerid); //Ban if they have a minigun
    SendClientMessage(playerid, COLOR_GREEN, "[VANILLA-ANTICHEATS] YOU HAVE BEEN AUTO-BANNED FOR REASON: MINIGUN");
    if(GetPlayerWeapon(playerid) == 35) Ban(playerid); //Ban if they have a RPG
    SendClientMessage(playerid, COLOR_GREEN, "[VANILLA-ANTICHEATS] YOU HAVE BEEN AUTO-BANNED FOR REASON: RPG");
    if(GetPlayerWeapon(playerid) == 36) Ban(playerid); //Ban if they have a HEAT SEEKER
    SendClientMessage(playerid, COLOR_GREEN, "[VANILLA-ANTICHEATS] YOU HAVE BEEN AUTO-BANNED FOR REASON: HEAT SEEKER");
    return 1;
}
Thanx a lot man, that done the trick
Reply


Messages In This Thread
Got one error on a return statement - by VanillaRain - 03.06.2015, 21:40
Re: Got one error on a return statement - by SickAttack - 03.06.2015, 21:47
Re: Got one error on a return statement - by VanillaRain - 03.06.2015, 21:49
Re: Got one error on a return statement - by VanillaRain - 04.06.2015, 09:24
Re: Got one error on a return statement - by Konstantinos - 04.06.2015, 10:44
Re: Got one error on a return statement - by VanillaRain - 04.06.2015, 11:30
Re: Got one error on a return statement - by Vince - 04.06.2015, 11:35

Forum Jump:


Users browsing this thread: 2 Guest(s)