Cmd bugged in-game (1 thingy only)
#1

pawn Код:
//pinvis
    if(strcmp(cmdtext, "/pinvis", true) == 0)
    {
        if(pInvisOn == 0)
        if(PlayerKills[playerid] >= 10)
        {
            for( new i = 0; i < MAX_PLAYERS; i++) SetPlayerMarkerForPlayer(i, playerid, 0xFFFFFF00);
            for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(i, playerid, false);
            SendClientMessage(playerid, COLOR_YELLOW, "You have dissapeared from the radar and your nametag has been removed.");
            pInvisOn = 1;
       
        }
        else
        {
            for( new i = 0; i < MAX_PLAYERS; i++) SetPlayerMarkerForPlayer(i, playerid, (GetPlayerColor(playerid)));
            for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(i, playerid, true);
            SendClientMessage(playerid, COLOR_YELLOW, "Your blip is now back on the radar and your name tag has appeared back.");
            pInvisOn = 0;
        }
        return 1;
    }
At hte ''if(PlayerKills[playerid] >= 10)'', where do i need to put it? becasue this place makes it bugged
Reply
#2

I'm not too sure but you do know you could just use 1 loop per block?
like this
pawn Код:
if(strcmp(cmdtext, "/pinvis", true) == 0)
    {
        if(pInvisOn == 0)
        if(PlayerKills[playerid] >= 10)
        {
            for( new i = 0; i < MAX_PLAYERS; i++)
            {
                if(!IsPlayerConnected(i))continue;
                SetPlayerMarkerForPlayer(i, playerid, 0xFFFFFF00);
                ShowPlayerNameTagForPlayer(i, playerid, false);
            }
            SendClientMessage(playerid, COLOR_YELLOW, "You have dissapeared from the radar and your nametag has been removed.");
            pInvisOn = 1;
            return 1;

        }
        else
        {
            for( new i = 0; i < MAX_PLAYERS; i++)
            {
                if(!IsPlayerConnected(i))continue;
                SetPlayerMarkerForPlayer(i, playerid, (GetPlayerColor(playerid)));
                ShowPlayerNameTagForPlayer(i, playerid, true);
            }
            SendClientMessage(playerid, COLOR_YELLOW, "Your blip is now back on the radar and your name tag has appeared back.");
            pInvisOn = 0;
        }
        return 1;
    }
It looks to me like that code should work.
Reply
#3

Remove this line: if(PlayerKills[playerid] >= 10)
OR use this:
pawn Код:
if(strcmp(cmdtext, "/pinvis", true) == 0)
{
        if(PlayerKills[playerid] >= 10)
        {
        if(pInvisOn == 0)
            {
                    for( new i = 0; i < MAX_PLAYERS; i++)
                    {
                        SetPlayerMarkerForPlayer(i, playerid, 0xFFFFFF00);
                        ShowPlayerNameTagForPlayer(i, playerid, false);
                    }
                    SendClientMessage(playerid, COLOR_YELLOW, "You have dissapeared from the radar and your nametag has been removed.");
                    pInvisOn = 1;
                    return 1;

            }
            else
            {
                    for( new i = 0; i < MAX_PLAYERS; i++)
                {
                        SetPlayerMarkerForPlayer(i, playerid, (GetPlayerColor(playerid)));
                        ShowPlayerNameTagForPlayer(i, playerid, true);
                    }
                    SendClientMessage(playerid, COLOR_YELLOW, "Your blip is now back on the radar and your name tag has appeared back.");
                    pInvisOn = 0;
            }
    }
        return 1;
}
Reply
#4

you're not doing anything with
pawn Код:
if(pInvisOn == 0)
try this:

pawn Код:
//pinvis
    if(strcmp(cmdtext, "/pinvis", true) == 0)
    {
        if(pInvisOn == 0)
        {
            if(PlayerKills[playerid] >= 10)
            {
                for( new i = 0; i < MAX_PLAYERS; i++) SetPlayerMarkerForPlayer(i, playerid, 0xFFFFFF00);
                for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(i, playerid, false);
                SendClientMessage(playerid, COLOR_YELLOW, "You have dissapeared from the radar and your nametag has been removed.");
                pInvisOn = 1;

            }
            else
            {
                for( new i = 0; i < MAX_PLAYERS; i++) SetPlayerMarkerForPlayer(i, playerid, (GetPlayerColor(playerid)));
                for(new i = 0; i < MAX_PLAYERS; i++) ShowPlayerNameTagForPlayer(i, playerid, true);
                SendClientMessage(playerid, COLOR_YELLOW, "Your blip is now back on the radar and your name tag has appeared back.");
                pInvisOn = 0;
            }
        }
        return 1;
    }
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)