SA-MP Forums Archive
Unknown Command on /dept - 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: Unknown Command on /dept (/showthread.php?tid=373217)



Unknown Command on /dept - D_Malfoy - 29.08.2012

pawn Код:
stock SendDeptMessage(color, string[])
{
    foreach(Player, i) {
                if(DAccess[i] != -1) { // Department Chat Access
            SendClientMessageEx(i, color, string);
        }
    }
}
I used printf to find out what causes the Unknown Command, SendDeptMessage, for some reason only ID 0 can see the messages yet, the player will still get a Unknown Command Error, other IDs/players won't see the message and get Unknown Command Error only.

SS:



First /dept was when no players are one, Second & Third are with 1 other player on


Re: Unknown Command on /dept - ddnbb - 29.08.2012

SendClientMessageEx is maybe returning 0... You also might want that stock return 1, not sure if it helps anything tho.


Re: Unknown Command on /dept - D_Malfoy - 29.08.2012

Quote:
Originally Posted by ddnbb
Посмотреть сообщение
SendClientMessageEx is maybe returning 0... You also might want that stock return 1, not sure if it helps anything tho.
it works now if their is more then 1 player in a faction, still always works if your ID 0


Re: Unknown Command on /dept - Misiur - 29.08.2012

Let's debug, shall we?
pawn Код:
stock SendDeptMessage(color, string[])
{
    foreach(Player, i) {
        printf("Iterator on player %d\n", i);
        if(DAccess[i] != -1) { // Department Chat Access
            printf("Player %d granted with DAccess %d\n", i, DAccess[i]);
            SendClientMessageEx(i, color, string);
        }
    }
    return 1;
}