SA-MP Forums Archive
Cmd bugged in-game (1 thingy only) - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Cmd bugged in-game (1 thingy only) (/showthread.php?tid=186895)



Cmd bugged in-game (1 thingy only) - Andy_McKinley - 31.10.2010

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


Re: Cmd bugged in-game (1 thingy only) - iggy1 - 31.10.2010

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.


Re: Cmd bugged in-game (1 thingy only) - Double-O-Seven - 31.10.2010

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;
}



Re: Cmd bugged in-game (1 thingy only) - Bessensap - 31.10.2010

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;
    }