SA-MP Forums Archive
/department - 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)
+--- Thread: /department (/showthread.php?tid=301874)



/department - Armqus_FIN - 06.12.2011

I have a problem.
I have a command of /department chat, but it only works for Sheriff Department (gGroupType 1) and Army.
I want it to work with Medics too, when a Medic type /department [text] it doesn't give any message to a person who has written it, but to Army and SD it shows.
Also Medics doesn't see Army and SD /Department messages.

Any helpful?


pawn Code:
CMD:department(playerid, params[]) {

    if(playerVariables[playerid][pStatus] != 1 || playerVariables[playerid][pGroup] < 1)
        return SendClientMessage(playerid, COLOR_GREY, "Your group data is invalid.");

    if(groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 1 && groupVariables[playerVariables[playerid][pGroup]][gGroupType] == 4) {
        return SendClientMessage(playerid, COLOR_GREY, "This group does not have an official radio frequency.");
 }

    if(playerVariables[playerid][pFreezeType] > 0) {
        return SendClientMessage(playerid, COLOR_GREY, "You can't use this command while cuffed, tazed, or frozen.");
 }

    if(isnull(params))
        return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/d(epartment) [message]");

    GetPlayerName(playerid, szPlayerName, MAX_PLAYER_NAME);

    switch(playerVariables[playerid][pGroupRank]) {

        case 1: format(szMessage, sizeof(szMessage), "*** %s %s: %s, over.", groupVariables[playerVariables[playerid][pGroup]][gGroupRankName1], szPlayerName, params);
        case 2: format(szMessage, sizeof(szMessage), "*** %s %s: %s, over.", groupVariables[playerVariables[playerid][pGroup]][gGroupRankName2], szPlayerName, params);
        case 3: format(szMessage, sizeof(szMessage), "*** %s %s: %s, over.", groupVariables[playerVariables[playerid][pGroup]][gGroupRankName3], szPlayerName, params);
        case 4: format(szMessage, sizeof(szMessage), "*** %s %s: %s, over.", groupVariables[playerVariables[playerid][pGroup]][gGroupRankName4], szPlayerName, params);
        case 5: format(szMessage, sizeof(szMessage), "*** %s %s: %s, over.", groupVariables[playerVariables[playerid][pGroup]][gGroupRankName5], szPlayerName, params);
        case 6: format(szMessage, sizeof(szMessage), "*** %s %s: %s, over.", groupVariables[playerVariables[playerid][pGroup]][gGroupRankName6], szPlayerName, params);
        default: format(szMessage, sizeof(szMessage), "*** %s %s: %s, over.", groupVariables[playerVariables[playerid][pGroup]][gGroupRankName1], szPlayerName, params);
 }

    sendDepartmentMessage(COLOR_DCHAT, szMessage);
    format(szMessage, sizeof(szMessage), "(radio) ''%s''",params);
    SetPlayerChatBubble(playerid, szMessage, COLOR_CHATBUBBLE, 10.0, 10000);
    return 1;
}



Re: /department - [MG]Dimi - 06.12.2011

Show us:
pawn Code:
stock sendDepartmentMessage(COLOR_DCHAT, szMessage);



Re: /department - Armqus_FIN - 06.12.2011

There are not that kind of thing..


Re: /department - Max_Coldheart - 06.12.2011

Then it shouldn't even work, you see you're using sendDepartmentMessage(COLOR_DCHAT, szMessage);, but you don't have it defined


Re: /department - Armqus_FIN - 07.12.2011

pawn Code:
stock sendDepartmentMessage(colour, string[]) {
    foreach(Player, i) {
        if(playerVariables[i][pStatus] == 1 && (groupVariables[playerVariables[i][pGroup]][gGroupType] == 1 || groupVariables[playerVariables[i][pGroup]][gGroupType] == 2)) {
            SendClientMessage(i, colour, string);
        }
    }
    return 1;
}



Re: /department - Armqus_FIN - 12.12.2011

/Bump!


Re: /department - [MG]Dimi - 12.12.2011

How you define all groups you wanna use?


Re: /department - Armqus_FIN - 12.12.2011

I don't understand what you mean, but Sheriff's Group ID is 1 And medics is 4.

And I want /d to work with medics..