Tazer bug
#1

Hello, i got a problem with my tazer for my roleplay server. the people we taze at, dosent get tazed. This is my /tazer code

pawn Код:
if(strcmp(cmd, "/tazer", true) ==0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 3 ||  PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pMember] == 7)
            {
                /*new x_job[20];
                x_job = strtok(cmdtext, idx);
                if(!strlen(x_job))
                {
                    SendClientMessage(playerid, COLOR_GREY, "USAGE: /tazer [get/putaway]");
                    return 1;
                }
                tmp = strtok(cmdtext, idx);*/

                if(TazerHolster[playerid] == 1)
                {
                    if(PlayerInfo[playerid][pGun2] == 24) PlayerHadDeagle[playerid] = 1;
                    GivePlayerGun(playerid, 23);
                    PlayerHasTazer[playerid] = 1;
                    TazerHolster[playerid] = 0;
                    format(string, sizeof(string), "* %s unholsters his tazer from his duty-belt", PlayerName(playerid));
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                }
                else if(TazerHolster[playerid] == 0)
                {
                    if(PlayerHasTazer[playerid] == 0) return SendClientMessage(playerid,COLOR_GREY,"You don't have a tazer out!");
                    TakeWeapon(playerid, 23);
                    if(PlayerHadDeagle[playerid] == 1) GivePlayerGun(playerid, 24);
                    PlayerHasTazer[playerid] = 0;
                    PlayerHadDeagle[playerid] = 0;
                    TazerHolster[playerid] = 1;
                    format(string, sizeof(string), "* %s holsters his tazer on duty-belt.", PlayerName(playerid));
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "   You are not apart of SAPD, FBI, National Guard or Secret Service !");
            }
        }
        return 1;
    }
And this is the tazer code under OnPlayerUpdate

pawn Код:
new Keys, ud, lr;
    GetPlayerKeys(playerid, Keys, ud, lr);
    if(Keys & KEY_FIRE)
    {
        if(GetPlayerWeapon(playerid) == 23 && PlayerHasTazer[playerid] == 1)
        {
            for(new i; i<MAX_PLAYERS; i++)
            {
                if(IsPlayerAimingAtPlayer(playerid, i))
                {
                    if(i == playerid) return 1;
                    if(GetDistanceBetweenPlayers(playerid, i) < 8)
                    {
                        if(PlayerCuffed[i]) return 1;
                        if(IsACop(i)) return SendClientMessage(playerid, COLOR_GREY, "   Cannot Tazer taze anyone that is apart of SAPD or FBI !");
                        if(IsPlayerInAnyVehicle(i)) return SendClientMessage(playerid, COLOR_GREY, "   Get the suspect out of the vehicle !");
                        if(TazerTime[playerid] == 1) return SendClientMessage(playerid, COLOR_GREY, "   Please wait while your tazer recharges!");
                        if(GetPlayerWeapon(i) != 0) { new rush[124]; format(rush, sizeof(rush), "* %s has probably rushtazed %s", PlayerName(playerid),PlayerName(i)); ABroadCast(COLOR_YELLOW,rush,1); }
                        new string[128];
                        TogglePlayerControllable(i, 0);
                        format(string, sizeof(string), "* You were Tazed by %s for 8 seconds.", PlayerName(playerid));
                        SendClientMessage(i, COLOR_LIGHTBLUE, string);
                        if(PlayerInfo[i][pMask] == 1)
                        {
                            format(string, sizeof(string), "* You Tazed A Stranger for 8 seconds.");
                            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                            format(string, sizeof(string), "* %s shoots with his Tazer at A Stranger, and tazed him.", PlayerName(playerid));
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        }
                        else
                        {
                            format(string, sizeof(string), "* You Tazed %s for 8 seconds.",PlayerName(i));
                            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
                            format(string, sizeof(string), "* %s shoots with his Tazer at %s, and tazed him.", PlayerName(playerid),PlayerName(i));
                            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        }
                        SetTimerEx("TazerTimer", 8000, false, "i", playerid);
                        TazerTime[playerid] = 1;
                        GameTextForPlayer(i, "~r~Tazed", 2500, 3);
                        PlayerCuffed[i] = 1;
                        PlayerCuffedTime[i] = 8;
                        ApplyAnimation(i, "PED","FLOOR_hit_f", 4.0, 1, 0, 0, 0, 0);
                    }
                    else
                    {
                        SendClientMessage(playerid, COLOR_GREY, " You are too far away from the suspect !");
                        return 1;
                    }
                }
            }
        }
    }
    new iCurWeap = GetPlayerWeapon(playerid); // Return the player's current weapon
    if(iCurWeap != iCurrentWeapon[playerid]) // If he changed weapons since the last update
    {
        OnPlayerChangeWeapon(playerid, iCurrentWeapon[playerid], iCurWeap);
        iCurrentWeapon[playerid] = iCurWeap; //Update the weapon variable
    }

    return 1;
}
Can anybody help me, i tried to fix it. But it wont just taze.

Thanks, Alex
Reply
#2

Anyone knows?
Reply
#3

Hmm, Anybody can help me, Still dosent work. Matter what i do, it dosent work
Reply
#4

If you didn't bump so often we would help.
Reply
#5

This can be deleted, I used the new tazer system for 0.3c
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)