SA-MP Forums Archive
Ammunition - 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)
+--- Thread: Ammunition (/showthread.php?tid=358620)



Ammunition - CoDeZ - 11.07.2012

Hello guys , i wanted to edit ammunition armor to 99 instead of 100

Question is , what are the functions needed for this?

Thanks!


Re: Ammunition - MP2 - 11.07.2012

You either need to disable ammunation or detect when they buy armour by tracking when their armour increases and checking if they are inside ammunation with a distance (IsPlayerInRangeOfPoint) and interior (GetPlayerInterior) check.


Re: Ammunition - CoDeZ - 11.07.2012

Basically i am working on a script to ban anyone who gets an armor with 100.
So i make an exception using an if statment not to ban players who get armor from ammunation?


Re: Ammunition - Cjgogo - 11.07.2012

Yes like that,when someone buys an armor set it's level to 99.And make a timer that checks everyone's armor level every second,higher than 99,well that's a ban.


Re: Ammunition - CoDeZ - 11.07.2012

Quote:
Originally Posted by Cjgogo
Посмотреть сообщение
Yes like that,when someone buys an armor set it's level to 99.And make a timer that checks everyone's armor level every second,higher than 99,well that's a ban.
I will have to use SetPlayerArmor?


Re: Ammunition - Cjgogo - 11.07.2012

Yes.


Re: Ammunition - clarencecuzz - 11.07.2012

pawn Код:
// This is a comment
// uncomment the line below if you want to write a filterscript
//#define FILTERSCRIPT

#include <a_samp>
new pArmour[MAX_PLAYERS];

public OnGameModeInit() //Or OnFilterScriptInit()
{
    SetTimer("ArmourCheck", 2000, true);
    return 1;
}

public OnPlayerConnect(playerid)
{
    SetPlayerArmour(playerid, 0);
    pArmour[playerid] = 0;
    return 1;
}

forward ArmourCheck();
public ArmourCheck()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            new Float:Armour;
            GetPlayerArmour(i, Armour);
            if(pArmour[i] < Armour)
            {
                if(!IsPlayerInRangeOfPoint(i, 30, 286.148987, -40.644398, 1001.569946) && GetPlayerInterior(i) != 1 || !IsPlayerInRangeOfPoint(i, 30, 286.800995, -82.547600, 1001.539978) && GetPlayerInterior(i) != 4||
                !IsPlayerInRangeOfPoint(i, 30, 296.919983, -108.071999, 1001.569946)&& GetPlayerInterior(i) != 6|| !IsPlayerInRangeOfPoint(i, 30, 314.820984, -141.431992, 999.661987) && GetPlayerInterior(i) != 7||
                !IsPlayerInRangeOfPoint(i, 30, 316.820984, -167.706985, 999.661987) && GetPlayerInterior(i) != 6)
                {
                    SendClientMessage(i, 0xFF0000AA, "You have been banned from this server. Reason: Armour Hacks");
                    Ban(i);
                    return 1;
                }
                else return pArmour[i] = Armour;
            }
        }
    }
    return 1;
}
Should work, if you find any errors please tell me.