CMD player name...
#2

To make the actual command, you only need GetPlayerName and strcmp

But the command I posted has everything fixed and done better.
I'll explain everything in // comments.

Код:
COMMAND:glazba(playerid,params[])
{
    if (APlayerData[playerid][LoggedIn] == true && APlayerData[playerid][PlayerLevel] > 4)
    {
        new player_name[24];
        GetPlayerName(playerid, player_name, sizeof (player_name));
        if (!strcmp(player_name, "Red_John", false))
        {
            // zcmd has "params[]", which is already a string.
            // You shouldn't use sscanf when you only want to use a string.
            if (isnull(params)) return SendClientMessage(playerid, 0xFF0000FF, "Komanda: {FFFFFF}/Glazba ");
            // Your old SendClientMessage was this:
            // SendClientMessage(playerid, 0xFF0000FF, "{FF0000}Komanda:{FF0000} {FFFFFF}/Glazba {FFFFFF}");
            // What it meant was:
            // RED REDKomanda:RED WHITE/Glazba WHITE
            // While mine means: REDKomanda: WHITE/Glazba 
            for (new i=0; i < MAX_PLAYERS; i++)
            {
                (IsPlayerConnected(i) && !IsPlayerNPC(i))
                {
                    PlayAudioStreamForPlayer(i, params);
                }
            }
        }
        return 1;
    }
    return 0;
}
Reply


Messages In This Thread
CMD player name... - by xxxSpeedxxx - 08.06.2016, 15:10
Re: CMD player name... - by Stinged - 08.06.2016, 15:20
Re: CMD player name... - by Gammix - 08.06.2016, 15:21
Re: CMD player name... - by xxxSpeedxxx - 08.06.2016, 16:20
Re: CMD player name... - by Konstantinos - 08.06.2016, 16:43

Forum Jump:


Users browsing this thread: 1 Guest(s)