How can i make this +REP
#1

how can i make to give /givecolor ID (set's player color )
/givecolor ID , i have made but only to give to myself but i need to give to other ..
+REP for help
Reply
#2

pawn Код:
COMMAND:givecolor(playerid, params[])
{
    new targetid, color;
    if(PlayerStat[playerid][AdminLevel] < 1) return SendClientMessage(playerid, WHITE, "SERVER: Unknown command.");
    if(sscanf(params,"ud", targetid, color))return SendClientMessage(playerid, GREY, "USAGE: /givecolor [playerid] [colors(1-3)]");
    if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid, GREY, "Target ID not found.");
    if(color == 1)
    {
        SetPlayerColor(targetid, 0xFF0000FF);
        SendClientMessage(targetid, GREEN, "Your name is now red.");
        return 1;
    }
    if(color == 2)
    {
        SetPlayerColor(targetid, 0xFFFFFFFF);
        SendClientMessage(targetid, GREEN, "Your name is now white.");
        return 1;
    }
    return 1;
}
Reply
#3

Код:
CMD:givecolor(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
new color[64],id;
if(sscanf(params,"is[64]",id,color)
{
SendClientMessage(playerid,-1,"/givecolor [ID] [Hex Color Code]");
return 1;
}
else
{
if(IsPlayerConnected(id))
{
SetPlayerColor(id,color);
}
else
{
SendClientMessage(playerid,-1,"Player is not Connected");
return 1;
}
}
}
else
{
SendClientMessage(playerid,-1,"You are not an Admin");
return 1;
}
return 1;
}
Reply
#4

pawn Код:
if(strcmp(cmd, "/givecolor", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(PlayerInfo[playerid][pAdmin] >= 1) // Check if admin.
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setplayercolor [playerid] [color]");
                    SendClientMessage(playerid, COLOR_GRAD1, "Available colors: Red, Pink, Orange, Yellow, Cyan, Green, Blue, Black, White, Marker");
                    return 1;
                }
                giveplayerid = ReturnUser(tmp);
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        new x_job[128];
                        x_job = strtok(cmdtext, idx);
                        if(!strlen(x_job))
                        {
                            SendClientMessage(playerid, COLOR_WHITE, "USAGE: /setplayercolor [playerid] [color]");
                            SendClientMessage(playerid, COLOR_GRAD1, "Available colors: Red, Pink, Orange, Yellow, Cyan, Green, Blue, Black, White, Marker");
                            return 1;
                        }
                        if(strcmp(x_job,"red",true) == 0) SetPlayerColor(giveplayerid, SCOLOR_RED);
                        else if(strcmp(x_job,"pink",true) == 0) SetPlayerColor(giveplayerid, SCOLOR_PINK);
                        else if(strcmp(x_job,"orange",true) == 0) SetPlayerColor(giveplayerid, SCOLOR_ORANGE);
                        else if(strcmp(x_job,"yellow",true) == 0) SetPlayerColor(giveplayerid, SCOLOR_YELLOW);
                        else if(strcmp(x_job,"cyan",true) == 0) SetPlayerColor(giveplayerid, SCOLOR_CYAN);
                        else if(strcmp(x_job,"green",true) == 0) SetPlayerColor(giveplayerid, SCOLOR_GREEN);
                        else if(strcmp(x_job,"blue",true) == 0) SetPlayerColor(giveplayerid, SCOLOR_BLUE);
                        else if(strcmp(x_job,"black",true) == 0) SetPlayerColor(giveplayerid, SCOLOR_BLACK);
                        else if(strcmp(x_job,"white",true) == 0) SetPlayerColor(giveplayerid, SCOLOR_WHITE);
                        else if(strcmp(x_job,"marker",true) == 0) SetPlayerColor(giveplayerid, SCOLOR_MARKER);
                        GetPlayerName(playerid, sendername, sizeof(sendername));
                        GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                        format(string, sizeof(string), "! %s has set %s's name color.", sendername, giveplayer);
                        SendClientMessage(giveplayerid, COLOR_GRAD1, "   Your name color has been set by an admin.");
                        ABroadCast(COLOR_LIGHTRED, string, 1);
                        return 1;
                    }
                    return 1;
                }
                SendClientMessage(playerid, COLOR_WHITE, "You are not authorized to use this command.");
                return 1;
            }
            format(string, sizeof(string), "   %d is not an active player !", giveplayerid);
            SendClientMessage(playerid, COLOR_GRAD1, string);
            return 1;
        }
        return 0;
    }
Reply
#5

Thanks all , all rep+
Reply


Forum Jump:


Users browsing this thread: