Hiding badge for LSPD & FBI
#1

Hi SAMP community users, can someone make me a zcmd command that allowes only FBI and LSPD to hide their badges ? I mean, it will be useful for undercover operations. And, if possible, when a LSPD detective / FBI Agent type /hidebadge to show a message only for them "You concealed your badge" and make their names white and when they type again to show a message "You took out your badge" and make their names blue. Can someone help me with that ? Because I'm a noob scripter and I don't know how to script that.
Reply
#2

SA:MP doesn't provide native functions for a faction system or badges, you'll have to give examples of your code that's relevant to faction badges (setting them, hiding them, detecting them).
Reply
#3

I mean, when an FBI or LSPD types /hidebadge to get a message with "You concealed your badge" and simply make their names white from blue and when they type again to get a message with "You took out your badge" and make their names blue from white.
For LSPD I have "IsACop"
And for FBI I have "IsFBI"
PS: A command that makes only feds and officers name white from their duty color, blue and vice versa.
Reply
#4

So, can anyone help me ?
Reply
#5

Aye.
Код:
new badgeActive[MAX_PLAYERS];

public OnPlayerConnect(playerid)
{
	badgeActive[playerid] = true;
}

COMMAND:showbadge(playerid) return cmd_hidebadge(playerid);
COMMAND:hidebadge(playerid)
{
	badgeActive[playerid] = !badgeActive[playerid];
	new string[24];
	format(string, sizeof string, "Badge status: %s", ( badgeActive[playerid] ) ? ("visible") : ("hidden") )
	return 1;
}
And just use this variable somewhere in your /badge command.
Reply
#6

Quote:
Originally Posted by kubak01
Посмотреть сообщение
Aye.
Код:
new badgeActive[playerid];

public OnPlayerConnect(playerid)
{
	badgeActive[playerid] = true;
}

COMMAND:showbadge(playerid) return cmd_hidebadge(playerid);
COMMAND:hidebadge(playerid)
{
	badgeActive[playerid] = !badgeActive[playerid];
	new string[128];
	format(string, sizeof string, "Badge status: %s", ( badgeActive[playerid] ) ? ("visible") : ("hidden") )
	return 1;
}
And just use this variable somewhere in your /badge command.
this won't work, you can't declare player variable by adding [ playerid ], only by adding [ MAX_PLAYERS ].
also this string length looks like shit, 128? ok.
Reply
#7

Quote:
Originally Posted by ElMaestro123
Посмотреть сообщение
this won't work, you can't declare player variable by adding [ playerid ], only by adding [ MAX_PLAYERS ].
also this string length looks like shit, 128? ok.
Aye i wrote this on the forums and didn't even realise this mistake with declaring somehow, thanks for correcting me.
Reply
#8

Quote:
Originally Posted by kubak01
Посмотреть сообщение
Aye i wrote this on the forums and didn't even realise this mistake with declaring somehow, thanks for correcting me.
This is Scripting Help, not script for you... By simply pasting up bad code, it encourages those who aren't actually following the rules, to continue doing so because they will just get what they want.

They need to provide code themselves, otherwise there should be no help.
Reply
#9

Took me less than a minute to write that, you can edit and expand on this one, if you want to-
Here you go;

pawn Код:
bool:BadgeStatus[MAX_PLAYERS char],

public OnPlayerConnect(playerid)
{
    BadgeStatus{playerid} = false;
    return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp("/mycommand", cmdtext, true, 10) == 0)
    {
        if(BadgeStatus{playerid})
        {
            SendClientMessage(playerid, -1, "You've hidden your badge.");
            SetPlayerColor(playerid, COLORWHENBADGEISHIDDEN);
            BadgeStatus{playerid} = false;
        }
        else
        {
            SendClientMessage(playerid, -1, "You've brought your badge back!");
            SetPlayerColor(playerid, COLORWHENBADGEISON);
            BadgeStatus{playerid} = true;
        }
        return 1;
    }
    return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)