Sscanf normal user and vip user
#2

you can do the part where the player types in the color, but here is how you would format it..

pawn Code:
CMD:label(playerid, params[])
{
    new msg[128],string[128];
   
    if(GetPVarInt(playerid, "AdminOnDuty") == 1) return SendClientMessage(playerid, COLOR_ERROR, "[ERROR] You can't use this command on admin duty");
    if(pInfo[playerid][VipLevel] == 0 && pInfo[playerid][EXP] < 1000) return SendClientMessage(playerid, COLOR_ERROR, "[ERROR] You need 1000 EXP or VIP to use this command");
   
    if(pInfo[playerid][VipLevel] == 0 && pInfo[playerid][EXP] >= 1000) //if the player is NOT VIP and has score equal to or more than 1000
    {
        if(sscanf(params, "s", msg)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /label [TEXT]");
        format(string, sizeof(string), "%s", msg);
        if(GetPVarInt(playerid, "PlayerLabel") == 0)
        {
            SetPVarInt(playerid, "PlayerLabel", 1);
            PlayerLabel[playerid] = CreateDynamic3DTextLabel(string, COLOR_LABEL, 0.0, 0.0, 0.0+0.4, 15.0, playerid, INVALID_VEHICLE_ID, 0, -1, -1);
            SendClientMessage(playerid, COLOR_SERVER, "[LABEL]"COL_WHITE" It made you the label successfully");
        }
        else
        {
            UpdateDynamic3DTextLabelText(PlayerLabel[playerid], COLOR_WHITE, string);
            format(string, sizeof(string), "[LABEL]"COL_WHITE" You have changed your label to %s", msg);
            SendClientMessage(playerid, COLOR_SERVER, string);
        }
    }
    else if(pInfo[playerid][VipLevel] == 1) //if the player IS VIP, you need to add the color coding
    {
        if(sscanf(params, "s", msg)) return SendClientMessage(playerid, COLOR_ORANGE, "Usage: /label [TEXT] [COLOR]"); //change this line
        format(string, sizeof(string), "%s", msg);
        if(GetPVarInt(playerid, "PlayerLabel") == 0)
        {
            SetPVarInt(playerid, "PlayerLabel", 1);
            PlayerLabel[playerid] = CreateDynamic3DTextLabel(string, COLOR_LABEL, 0.0, 0.0, 0.0+0.4, 15.0, playerid, INVALID_VEHICLE_ID, 0, -1, -1);
            SendClientMessage(playerid, COLOR_SERVER, "[LABEL]"COL_WHITE" It made you the label successfully");
        }
        else
        {
            UpdateDynamic3DTextLabelText(PlayerLabel[playerid], COLOR_WHITE, string);
            format(string, sizeof(string), "[LABEL]"COL_WHITE" You have changed your label to %s", msg);
            SendClientMessage(playerid, COLOR_SERVER, string);
        }
    }
    return 1;
}
Reply


Messages In This Thread
Sscanf normal user and vip user - by Cerealguy - 28.01.2015, 23:47
Re: Sscanf normal user and vip user - by SnG.Scot_MisCuDI - 29.01.2015, 06:55

Forum Jump:


Users browsing this thread: 1 Guest(s)