SA-MP Forums Archive
Help in /dc ( DJ Chat) - 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: Help in /dc ( DJ Chat) (/showthread.php?tid=598368)



Help in /dc ( DJ Chat) - ProDude - 11.01.2016

when i go In Game and type /dc Hi it don't show me the message
PHP код:
CMD:dc(playeridparams[])
{
    new 
Nam[MAX_PLAYERS], message[128], str[256], playername[25];
    
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
    if (!
dini_Isset(AddDirFile(dir_userfilesplayername), "dj")) return SendClientMessage2(playeridCOLOR_RED"Error: You aren't DJ.");
    if(
sscanf(params,"s",message)) return SendClientMessage(playerid,COLOR_WHITE,"USAGE: /dc [Text]");
    
GetPlayerName(playerid,Nam,sizeof(Nam));
    
format(str,sizeof(str),"DJ Chat [%s] %s",Nam,message);
    for (new 
a=0;a<MAX_PLAYERS;a++)
    {
        if (
IsPlayerConnected(a))
            {
                if (!
dini_Isset(AddDirFile(dir_userfilesplayername), "dj"))
                {
                     
SendClientMessage(aCOLOR_ORANGEstr);
            }
            }
    }
    return 
1;

How can i fix it?


Re: Help in /dc ( DJ Chat) - lucamsx - 11.01.2016

PHP код:
CMD:dc(playeridparams[])
{
    new 
Nam[MAX_PLAYERS], message[128], str[256], playername[25];
    
GetPlayerName(playeridplayernameMAX_PLAYER_NAME);
    if(!
dini_Isset(AddDirFile(dir_userfilesplayername), "dj")) return SendClientMessage2(playeridCOLOR_RED"Error: You aren't DJ.");
    if(
sscanf(params,"s",message)) return SendClientMessage(playerid,COLOR_WHITE,"USAGE: /dc [Text]");
    
GetPlayerName(playerid,Nam,sizeof(Nam));
    
format(str,sizeof(str),"DJ Chat [%s] %s",Nam,message);
    for (new 
a=0;a<MAX_PLAYERS;a++)
    {
            if (
IsPlayerConnected(a))
        {
            if(
dini_Isset(AddDirFile(dir_userfilesplayername), "dj")) //! means negation...
            
{
                             
SendClientMessage(aCOLOR_ORANGEstr);
            }
        }
    } 
        return 
1;

And i would recommend you using some kind of variable like IsDJ[playerid] rather than calling dini check every time someone uses /dc.


Re: Help in /dc ( DJ Chat) - ProDude - 11.01.2016

Thx for the code it's working and i will try to do that Thank for telling