[AJUDA/HELP]FS Nгo funcionando!
#2

pawn Код:
#include <a_samp>
#tryinclude <angdist>

#if !defined IsPlayerAimingAtPlayer
        #error You need the 'angdist' include. You can get it at the release topic.
#endif

#define SECONDS 10
#define TAZE_MS 400
#define IsNotCop(%0) ((GetPlayerSkin(%0) < 280 && GetPlayerSkin(%0) > 288))

forward Unfreeze(playerid);
forward OnPlayerTazePlayer(playerid);

public OnFilterScriptInit()
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i)) SetPVarInt(i, "TazeTimer", SetTimerEx("OnPlayerTazePlayer", TAZE_MS, true, "i", i));
    }
    return 1;
}

public OnPlayerConnect(playerid)
{
    SetPVarInt(playerid, "TazeTimer", SetTimerEx("OnPlayerTazePlayer", TAZE_MS, true, "i", playerid));
    return 1;
}

public OnPlayerDisconnect(playerid)
{
    KillTimer(GetPVarInt(playerid, "TazeTimer"));
    return 1;
}

public OnPlayerTazePlayer(playerid)
{
    new Keys[3];
    GetPlayerKeys(playerid, Keys[0], Keys[1], Keys[2]);
    if(Keys[0] & KEY_FIRE)
    {
        if(IsNotCop(playerid)) return 1;
        else
        {
            if(GetPlayerWeapon(playerid) == 23 && GetPVarInt(playerid, "HasTazer") == 1)
            {
                new targetid = 0;
                while (targetid < MAX_PLAYERS && IsPlayerConnected(targetid))
                {
                    if(GetDistanceBetweenPlayers(playerid, targetid) >= 4)
                    {
                        if(IsPlayerAimingAtPlayer(playerid, targetid))
                        {
                            if(!IsPlayerInAnyVehicle(targetid) && !IsPlayerInAnyVehicle(playerid))
                            {
                                if(targetid != playerid)
                                {
                                    if(GetPVarInt(targetid, "Tazed") == 1) return 0;
                                    ApplyAnimation(targetid, "CRACK", "crckdeth2", 4.0, 1, 0, 0, 0, 0);
                                    TogglePlayerControllable(targetid, 0);
                                    SetTimerEx("Unfreeze", (SECONDS * 1000), false, "i", targetid);
                                    SetPVarInt(targetid, "Tazed", 1);
                                }
                            }
                        }
                    }
                    targetid ++;
                }
            }
        }
    }
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(!strcmp(cmdtext, "/tazer", true))
    {
        if(IsNotCop(playerid)) return 1;
        if(GetPVarInt(playerid, "HasTazer") == 0)
        {
            SetPVarInt(playerid, "HasTazer", 1);
            GivePlayerWeapon(playerid, 23, 65500);
            SendClientMessage(playerid, 0xFFFF00FF, "Tazer unholstered.");
        }
        else
        {

            DeletePVar(playerid, "HasTazer");
            SetPlayerAmmo(playerid, 23, 0);
            SendClientMessage(playerid, 0xFFFF00FF, "Tazer holstered.");
        }
        return 1;
    }
    return 0;
}

public Unfreeze(playerid)
{
    TogglePlayerControllable(playerid, 1);
    DeletePVar(playerid, "Tazed");
    return ClearAnimations(playerid);
}
Not tested.
Reply


Messages In This Thread
[AJUDA/HELP]FS Nгo funcionando! - by MatheuS_MendeS - 02.11.2012, 18:15
Re: [AJUDA/HELP]FS Nгo funcionando! - by RedJohn - 02.11.2012, 18:28
Re: [AJUDA/HELP]FS Nгo funcionando! - by MatheuS_MendeS - 02.11.2012, 22:15

Forum Jump:


Users browsing this thread: 1 Guest(s)