tazer bugged or some bug please help.
#1

This is my tazer function
pawn Код:
if(newkeys & KEY_LOOK_BEHIND && IsPlayerENF(playerid) && !IsPlayerInAnyVehicle(playerid) && PlayerTemp[playerid][isevent] == 0)
    {
        if(GetPVarInt(playerid, "Tazer") == 1)
        {
            //GivePlayerWeapon(playerid, 24, GetPVarInt(playerid, "Tazer"));
            SetPVarInt(playerid, "Tazer", 0);
            RemovePlayerAttachedObject(playerid, 0);
            Action(playerid, "puts his taser back into his belt.");
            return 1;
        }

        SetPVarInt(playerid, "Tazer", 1);
        //SetPlayerAttachedObject(playerid, 0, 18642, 6, 0.06, 0.01, 0.08, 180.0, 0.0, 0.0);
        GivePlayerWeapon(playerid, 23, 10);
        Action(playerid, "takes his taser out of his belt.");
        return 1;
    }
pawn Код:
if(newkeys & KEY_FIRE && newkeys & KEY_HANDBRAKE)
    {
        if(!IsPlayerInAnyVehicle(playerid) && GetPlayerWeapon(playerid) == 41)
        {
            new Float:fp[4];
            PlayerLoop(q)
            {
                if(q == playerid) continue;
                GetPlayerPos(q, fp[0], fp[1], fp[2]);
                if(IsPlayerAimingAt(playerid, fp[0], fp[1], fp[2], 0.9) && GetDistanceBetweenPlayers(playerid, q) < 4 && tazed[q] == 0)
                {
                    RedScreen(q, minrand(5,15));
                    return 1;
                }
            }
        }
pawn Код:
if(!IsPlayerInAnyVehicle(playerid) && GetPVarInt(playerid, "Tazer") == 1 && IsPlayerENF(playerid) && !RecentlyShot[playerid] || !IsPlayerInAnyVehicle(playerid) && GetPlayerWeapon(playerid) == 23 && PlayerInfo[playerid][power] >= 11)
        {
            RecentlyShot[playerid] = 1;
            SetTimerEx("AntiSpam", 1000, false, "d", playerid);
            new Float:fp[4];
            PlayerLoop(q)
            {
                if(q == playerid) continue;
                GetPlayerPos(q, fp[0], fp[1], fp[2]);
                if(IsPlayerAimingAt(playerid, fp[0], fp[1], fp[2], 0.9) && GetDistanceBetweenPlayers(playerid, q) < 5 && tazed[q] == 0 && !IsPlayerInAnyVehicle(q))
                {
                    ApplyAnimation(playerid,"KNIFE","knife_3",4.1,0,1,1,0,0,1);
                    new tazemsg[ 128 ], wat[MAX_PLAYER_NAME];
                    if(PlayerTemp[q][hname]==1) myStrcpy(wat,"Stranger"); else myStrcpy(wat,RPName(q));
                    if(PlayerInfo[playerid][playerteam]==COPS) format(tazemsg,sizeof(tazemsg),"[LSPD] %s has been tazed by %s",wat,RPName(playerid));
                    else if(PlayerInfo[playerid][playerteam]==SASF) format(tazemsg,sizeof(tazemsg),"[SASF] %s has been tazed by %s",wat,RPName(playerid));
                    else format(tazemsg,sizeof(tazemsg),"[FBI] %s has been tazed by %s",wat,RPName(playerid));
                    NearMessage(playerid,tazemsg,COLOR_ME);
                    tazed[ q ] = 1;
                    TogglePlayerControllable(q,false);
                    SetTimerEx("UnTaze",20000,0,"i",q);
                    SetPlayerDrunkLevel(q, GetPlayerDrunkLevel(playerid)+4300);
                    ApplyAnimation(q,"CRACK", "crckdeth2", 4.1, 0, 0, 0, 1, 1); // irl crack!
                    new string[ 128 ];
                    format(string, sizeof(string), "6{TAZE} %s[%d] has been tazed by %s[%d]",PlayerName(q),q, PlayerName(playerid), playerid);
                    iEcho(string);
                    return 1;
                }
            }
        }
        return 1;
    }
pawn Код:
tazed[playerid] = 0;
pawn Код:
if(IsPlayerConnected(playerid))
    {
        if(GetPVarInt(playerid, "Tazer") && GetPlayerWeapon(playerid))
        {
            SendClientInfo(playerid, "You cannot hold a weapon while having the taser in your hand.");
            SetPlayerArmedWeapon(playerid, 0);
            return 1;
        }
        if(IsPlayerInAnyVehicle(playerid))
        {
            for(new i; i < sizeof(Spikes); i++)
            {
                if(IsPlayerInRangeOfPoint(playerid, 5.0, Spikes[i][sX], Spikes[i][sY], Spikes[i][sZ]) && Spikes[i][sX] != 0)
                {
                    new tires, panels, doors, lights;
                    GetVehicleDamageStatus(GetPlayerVehicleID(playerid), panels, doors, lights, tires);
                    tires = encode_tires(1,1,1,1); // damage all tires
                    UpdateVehicleDamageStatus(GetPlayerVehicleID(playerid), panels, doors, lights, tires);
                }
            }
        }
    }
    return 1;
}
and my command now work properly
pawn Код:
COMMAND:tazer(playerid, params[])
{
    if(GetPVarInt(playerid, "Tazer", false))
    {
        SetPVarInt(playerid, "Tazer", 0);
        Action(playerid, "puts his taser back into his belt.");
          // return GivePlayerWeapon(playerid, 23, 0);
    }
    SetPVarInt(playerid, "Tazer", 1);
    Action(playerid, "takes his taser out of his belt.");
    //return GivePlayerWeapon(playerid, 23, 10);
}
Reply
#2

You didn't describe your problem. Additionally, I'm not sure about operator precedence in pawn, so just in case, wrap your bitwise operations (with single ampersand operator) in braces.
Reply
#3

my problem is, when i takes out the tazer, it's doesn't give me a weapon(silence pistol). Also, when i hit someone, it doesn't taze him
Reply
#4

Hey bro, Simply use this : Tazer System
Reply
#5

Quote:
Originally Posted by Juandawson
Посмотреть сообщение
Hey bro, Simply use this : Tazer System
No, i want to fix it only.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)