Tazer bugged
#1

So im civilian and i can use /tazer i dont really get it please help me

Code:
Код:
CMD:tazer(playerid, params[])
{
	if(IsACop(playerid) || Team_EDLS(playerid) && PlayerInfo[playerid][pDivision] == 2 || Team_EDLS(playerid) && PlayerInfo[playerid][pRank] >= 5 || (PlayerInfo[playerid][pMember] == 12 && PlayerInfo[playerid][pDivision] == 2)) {
  new string[128];
		if(/*PlayerInfo[playerid][pConnectTime] < 2 ||*/PlayerInfo[playerid][pWRestricted] > 0) return SendClientMessageEx(playerid, COLOR_GRAD2, "You cannot use this as you are currently restricted from possessing weapons!");

		if(IsPlayerInAnyVehicle(playerid))
		{
			SendClientMessageEx(playerid, COLOR_GREY, "You can't do this while you're in a vehicle.");
			return 1;
		}

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

		if(PlayerInfo[playerid][pJailed] > 0)
		{
			SendClientMessageEx(playerid, COLOR_WHITE, "You cannot use this in jail/prison.");
			return 1;
		}
		if(PlayerCuffed[playerid] >= 1) {
			SendClientMessageEx(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;
		}
		PlayerHasJustTakenTazer[playerid] = 1;
		SetTimerEx("TazerTakenDisable",3*1000,0,"i",playerid);
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GREY, "   You are not a Cop / FBI / Coastguard!");
		return 1;
	}
	return 1;
}
Reply
#2

Havent tested it.
pawn Код:
CMD:tazer(playerid, params[])
{
    if(IsACop(playerid) || Team_EDLS(playerid) && PlayerInfo[playerid][pDivision] == 2 || Team_EDLS(playerid) && PlayerInfo[playerid][pRank] >= 5 || PlayerInfo[playerid][pMember] == 12 && PlayerInfo[playerid][pDivision] == 2))
    {
        new string[128];
        if(/*PlayerInfo[playerid][pConnectTime] < 2 ||*/PlayerInfo[playerid][pWRestricted] > 0) return SendClientMessageEx(playerid, COLOR_GRAD2, "You cannot use this as you are currently restricted from possessing weapons!");

        if(IsPlayerInAnyVehicle(playerid))
        {
            SendClientMessageEx(playerid, COLOR_GREY, "You can't do this while you're in a vehicle.");
            return 1;
        }

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

        if(PlayerInfo[playerid][pJailed] > 0)
        {
            SendClientMessageEx(playerid, COLOR_WHITE, "You cannot use this in jail/prison.");
            return 1;
        }
        if(PlayerCuffed[playerid] >= 1) {
            SendClientMessageEx(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;
        }
        PlayerHasJustTakenTazer[playerid] = 1;
        SetTimerEx("TazerTakenDisable",3*1000,0,"i",playerid);
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GREY, "   You are not a Cop / FBI / Coastguard!");
        return 1;
    }
    return 1;
}
Reply
#3

Its two errors..
Код:
C:\Users\Alzack\Desktop\Ny mapp\AlzackRP.pwn(68767) : error 029: invalid expression, assumed zero
C:\Users\Alzack\Desktop\Ny mapp\AlzackRP.pwn(68829) : error 029: invalid expression, assumed zero
This line
Код:
    if(IsACop(playerid) || Team_EDLS(playerid) && PlayerInfo[playerid][pDivision] == 2 || Team_EDLS(playerid) && PlayerInfo[playerid][pRank] >= 5 || PlayerInfo[playerid][pMember] == 12 && PlayerInfo[playerid][pDivision] == 2))
Reply
#4

pawn Код:
CMD:tazer(playerid, params[])
{
    if(!IsACop(playerid) || !Team_EDLS(playerid) && !PlayerInfo[playerid][pDivision] == 2 || !Team_EDLS(playerid) && !PlayerInfo[playerid][pRank] >= 5 || !PlayerInfo[playerid][pMember] == 12 && !PlayerInfo[playerid][pDivision] == 2)) return SendClientMessageEx(playerid, COLOR_GREY, "   You are not a Cop / FBI / Coastguard!");
    if(PlayerInfo[playerid][pWRestricted] > 0) return SendClientMessageEx(playerid, COLOR_GRAD2, "You cannot use this as you are currently restricted from possessing weapons!");
    if(IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, "You can't do this while you're in a vehicle.");
    if(GetPVarInt(playerid, "IsInArena") >= 0) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this right now, you are in a arena!");
    if(GetPVarInt( playerid, "EventToken") != 0) return SendClientMessageEx(playerid, COLOR_GREY, "You can't use the tazer while you're in an event.");
    if(PlayerCuffedTime[playerid] > 0) return SendClientMessageEx(playerid, COLOR_GREY, "You can't do this right now.");
    if(GetPVarInt(playerid, "Injured") == 1) return SendClientMessageEx(playerid, COLOR_GREY, "You can't do this right now.");
    if(PlayerInfo[playerid][pJailed] > 0) return SendClientMessageEx(playerid, COLOR_WHITE, "You cannot use this in jail/prison.");
    if(PlayerCuffed[playerid] >= 1) return SendClientMessageEx(playerid, COLOR_WHITE, "You cannot use this while tazed/cuffed.");
    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;
    }
    PlayerHasJustTakenTazer[playerid] = 1;
    SetTimerEx("TazerTakenDisable",3*1000,0,"i",playerid);
    return 1;
}
Reply
#5

pawn Код:
CMD:tazer(playerid, params[])
{
    if(IsACop(playerid) || Team_EDLS(playerid) || PlayerInfo[playerid][pMember] == 12)
    {
        if(PlayerInfo[playerid][pDivision] == 2 || PlayerInfo[playerid][pRank] >= 5)
        {
            if(/*PlayerInfo[playerid][pConnectTime] < 2 || */PlayerInfo[playerid][pWRestricted]) return SendClientMessageEx(playerid, COLOR_GRAD2, "You cannot use this as you are currently restricted from possessing weapons!");
            if(IsPlayerInAnyVehicle(playerid)) return SendClientMessageEx(playerid, COLOR_GREY, "You can't do this while you're in a vehicle.");
            if(GetPVarInt(playerid, "IsInArena")) return SendClientMessageEx(playerid, COLOR_WHITE, "You can't do this right now, you are in a arena!");
            if(GetPVarInt( playerid, "EventToken")) return SendClientMessageEx(playerid, COLOR_GREY, "You can't use the tazer while you're in an event.");
            if(PlayerCuffedTime[playerid]) return SendClientMessageEx(playerid, COLOR_GREY, "You can't do this right now.");
            if(GetPVarInt(playerid, "Injured")) return SendClientMessageEx(playerid, COLOR_GREY, "You can't do this right now.");
            if(PlayerInfo[playerid][pJailed]) return SendClientMessageEx(playerid, COLOR_WHITE, "You cannot use this in jail/prison.");
            if(PlayerCuffed[playerid]) return SendClientMessageEx(playerid, COLOR_WHITE, "You cannot use this while tazed/cuffed.");
            new string[];
            if(!pTazer[playerid])
            {
                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);
            }
            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] = (pTazer[playerid]) ? (0) : (1);
            PlayerHasJustTakenTazer[playerid] = 1;
            SetTimerEx("TazerTakenDisable", 3000, 0, "i", playerid);
            return 1;
        }
    }
    SendClientMessageEx(playerid, COLOR_GREY, "   You are not a Cop / FBI / Coastguard!");
    return 1;
}
Reply
#6

Still getting errors from Treshold

Код:
C:\Users\Alzacko\Desktop\Ny mapp\.pwn(68779) : error 009: invalid array size (negative, zero or out of bounds)
C:\Users\Alzacko\Desktop\Ny mapp\P.pwn(68779) : error 036: empty statement
C:\Users\Alzacko\Desktop\Ny mapP.pwn(68784) : error 017: undefined symbol "string"
C:\Users\Alzacko\Desktop\NP.pwn(68784) : error 017: undefined symbol "string"
C:\Users\Alzacko\Desktop\Ny RP.pwn(68784) : error 029: invalid expression, assumed zero
C:\Users\Alzacko\Desktop\Ny mRP.pwn(68784) : fatal error 107: too many error messages on one line
Reply
#7

Oh yeah I forgot to fill in the string size. I normally fill that in after I finish the code but I forgot this time. Change 'new string[]' to 'new string[50]'.
Reply
#8

Get some example on this script
Код:
CMD:tazer(playerid, params[]) {

	if(IsACop(playerid) || (PlayerInfo[playerid][pFaction] == 5 && PlayerInfo[playerid][pDivision] == 5) || PlayerInfo[playerid][pFaction] == 5 && PlayerInfo[playerid][pDivision] == 2)
	{
		new string[128];
		if(PlayerInfo[playerid][pConnectTime] < 2) return SendClientMessage(playerid, COLOR_GRAD2, "You can't use this as you're currently restricted from possessing weapons!");

		if(IsPlayerInAnyVehicle(playerid))
		{
			SendClientMessage(playerid, COLOR_GREY, "You can't do this while you're in a vehicle.");
			return 1;
		}

		if(GetPVarInt(playerid, "PBM") > 0)
		{
			SendClientMessage(playerid, COLOR_WHITE, "You're not able to do this while in a paintball game.");
			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 can't use this in jail/prison.");
			return 1;
		}
		if(PlayerCuffed[playerid] >= 1) {
			SendClientMessage(playerid, COLOR_WHITE, "You can't 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
	{
		SendClientMessage(playerid, COLOR_GREY, "   You're not a Cop / FBI!");
		return 1;
	}
	return 1;
}
Reply
#9

...........
Reply
#10

problem solved
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)