Tazer help
#1

I have problems with command tazzer
Here is error:
pawn Код:
C:\Users\home\Desktop\GFHF\gamemodes\rp1.pwn(1437) : error 017: undefined symbol "pTazer"
C:\Users\home\Desktop\GFHF\gamemodes\rp1.pwn(1437) : warning 215: expression has no effect
C:\Users\home\Desktop\GFHF\gamemodes\rp1.pwn(1437) : error 001: expected token: ";", but found "]"
C:\Users\home\Desktop\GFHF\gamemodes\rp1.pwn(1437) : error 029: invalid expression, assumed zero
C:\Users\home\Desktop\GFHF\gamemodes\rp1.pwn(1437) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
and Tazer cmd:
pawn Код:
CMD:tazer(playerid, params[])
{
    if(PlayerInfo[playerid][pLevel] == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            SendClientMessage(playerid, COLOR_GREY, "You can't do this while you're in a vehicle.");
            return 1;
        }

        if(GetPVarInt(playerid, "IsInArena") >= 0)
        {
            SendClientMessage(playerid, COLOR_WHITE, "You can't do this right now, you are in a arena!");
            return 1;
        }
        if(GetPVarInt( playerid, "EventToken") != 0)
        {
            SendClientMessage(playerid, COLOR_GREY, "You can't use the tazer while you're in an event.");
            return 1;
        }
        if(PlayerCuffedTime[playerid] > 0)
        {
            SendClientMessage(playerid, COLOR_GREY, "You can't do this right now.");
            return 1;
        }
        if(GetPVarInt(playerid, "Injured") == 1)
        {
            SendClientMessage(playerid, COLOR_GREY, "You can't do this right now.");
            return 1;
        }

        if(PlayerInfo[playerid][pJailed] > 0)
        {
            SendClientMessage(playerid, COLOR_WHITE, "You cannot use this in jail/prison.");
            return 1;
        }
        if(PlayerCuffed[playerid] >= 1) {
            SendClientMessage(playerid, COLOR_WHITE, "You cannot use this while tazed/cuffed.");
            return 1;
        }

        if(pTazer[playerid] == 0)
        {
            pTazerReplace[playerid] = PlayerInfo[playerid][pGuns][2];
            if(PlayerInfo[playerid][pGuns][2] != 0) RemovePlayerWeapon(playerid, PlayerInfo[playerid][pGuns][2]);
            format(string, sizeof(string), "* %s unholsters their tazer.", GetPlayerNameEx(playerid));
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            GivePlayerValidWeapon(playerid, 23, 60000);
            pTazer[playerid] = 1;
        }
        else
        {
            RemovePlayerWeapon(playerid, 23);
            GivePlayerValidWeapon(playerid, pTazerReplace[playerid], 60000);
            format(string, sizeof(string), "* %s holsters their tazer.", GetPlayerNameEx(playerid));
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            pTazer[playerid] = 0;
        }
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GREY, "   You are not a Cop!");
        return 1;
    }
    return 1;
}
Reply
#2

I add in my enum pTazer but i get new errors

pawn Код:
C:\Users\home\Desktop\GFHF\gamemodes\rp1.pwn(1438) : error 028: invalid subscript (not an array or too many subscripts): "pTazer"
C:\Users\home\Desktop\GFHF\gamemodes\rp1.pwn(1438) : warning 215: expression has no effect
C:\Users\home\Desktop\GFHF\gamemodes\rp1.pwn(1438) : error 001: expected token: ";", but found "]"
C:\Users\home\Desktop\GFHF\gamemodes\rp1.pwn(1438) : error 029: invalid expression, assumed zero
C:\Users\home\Desktop\GFHF\gamemodes\rp1.pwn(1438) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
Reply
#3

Can you show me your player enum please?
Reply
#4

This: pTazer[playerid]
should be PlayerInfo[playerid][pTazer] if you added it to your enum I gues.
Reply
#5

Add #define pTazer at the top.
Reply
#6

pawn Код:
enum Info
{
    pPassword[128],
    pLevel,
    pExp,
    pSex,
    pOrigin,
    pAge,
    pCash,
    pAccent,
    pAdminLevel,
    pAdmin,
    pJailed,
    pHelper,
    pTazer,
    pw,
    AdminLevel,
    cash,
    level
};
This is my enum
Reply
#7

Код:
CMD:tazer(playerid, params[])
{
    if(PlayerInfo[playerid][pLevel] == 0)
    {
        if(IsPlayerInAnyVehicle(playerid))
        {
            SendClientMessage(playerid, COLOR_GREY, "You can't do this while you're in a vehicle.");
            return 1;
        }

        if(GetPVarInt(playerid, "IsInArena") >= 0)
        {
            SendClientMessage(playerid, COLOR_WHITE, "You can't do this right now, you are in a arena!");
            return 1;
        }
        if(GetPVarInt( playerid, "EventToken") != 0)
        {
            SendClientMessage(playerid, COLOR_GREY, "You can't use the tazer while you're in an event.");
            return 1;
        }
        if(PlayerCuffedTime[playerid] > 0)
        {
            SendClientMessage(playerid, COLOR_GREY, "You can't do this right now.");
            return 1;
        }
        if(GetPVarInt(playerid, "Injured") == 1)
        {
            SendClientMessage(playerid, COLOR_GREY, "You can't do this right now.");
            return 1;
        }

        if(PlayerInfo[playerid][pJailed] > 0)
        {
            SendClientMessage(playerid, COLOR_WHITE, "You cannot use this in jail/prison.");
            return 1;
        }
        if(PlayerCuffed[playerid] >= 1) {
            SendClientMessage(playerid, COLOR_WHITE, "You cannot use this while tazed/cuffed.");
            return 1;
        }

        if(PlayerInfo[playerid][pTazer] == 0)
        {
            pTazerReplace[playerid] = PlayerInfo[playerid][pGuns][2];
            if(PlayerInfo[playerid][pGuns][2] != 0) RemovePlayerWeapon(playerid, PlayerInfo[playerid][pGuns][2]);
            format(string, sizeof(string), "* %s unholsters their tazer.", GetPlayerNameEx(playerid));
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            GivePlayerValidWeapon(playerid, 23, 60000);
            PlayerInfo[playerid][pTazer] = 1;
        }
        else
        {
            RemovePlayerWeapon(playerid, 23);
            GivePlayerValidWeapon(playerid, pTazerReplace[playerid], 60000);
            format(string, sizeof(string), "* %s holsters their tazer.", GetPlayerNameEx(playerid));
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            PlayerInfo[playerid][pTazer] = 0;
        }
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GREY, "   You are not a Cop!");
        return 1;
    }
    return 1;
}
Reply
#8

FIXED i add pTazer in enum but it need to add new pTazer[MAX_PLAYERS];
Reply
#9

Well i am glad you fixed it, if you have any other question just PM me and i will help you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)