SA-MP Forums Archive
[Help]how to make a tag. - 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]how to make a tag. (/showthread.php?tid=354129)



[Help]how to make a tag. - [A]ndrei - 25.06.2012

Hey i need help when a admin says Hi all i want it to be like this [Admin][Name][Text]

Anyone help me please...i mean in minichat not above player head.


Re: [Help]how to make a tag. - Kindred - 25.06.2012

Example:

pawn Код:
public OnPlayerText(playerid, text[])
{
    new string[128], name[MAX_PLAYER_NAME];
    if(Adminvariable[playerid] >= 1)
    {
        format(string, sizeof(string), "[Admin] %s: %s", GetPlayerName(playerid, name, sizeof(name)), text);
        SendClientMessageToAll(playerid, -1, string);
        return 0;
    }
    return 1;
}



Re: [Help]how to make a tag. - [A]ndrei - 25.06.2012

hey how to make it detect level one admin and also can you show me how to make [Moderator]color=red And [Leader]color=blue Also [V.I.P](color=green)

and for admin color=orange please do it for me and thx...
also for vip can you make it detect level 1 admin.


Re: [Help]how to make a tag. - .Wicked - 25.06.2012

pawn Код:
COMMAND:announce(playerid, params[])
{
    new string[256], text[256]; // Strings
    if(sscanf(params, "s[256]", text)) SendClientMessage(playerid, COLOR_GREY, "USAGE: /announce [Message]"); // If you type in /announce with a space it will send you this message <
    else
    {
        if(PlayerInfo[playerid][pAdmin] >= 1) // If admin is level 1 or above.
        {
            format(string, sizeof(string), "[ANNOUNCEMENT] %s %s: "COL_WHITE"%s", GetAdminLvlName(playerid), GetName(playerid), text); // When using the command /announce [Message] it will come up as [Announcement] Admin Level X, The players name that used the command, and then the text will be white.
            SendClientMessageToAll(COLOR_GREY, string); // Send the message to all the players.
        }
        else SendClientMessage(playerid, COLOR_LIGHTRED, "WARNING: You do not have access to this command!"); // If you are not an admin it will send you the message above.
    }
    return 1;
}
NOTE: You will need to make stocks "GetAdminLvlName", "GetName"!


Re: [Help]how to make a tag. - Dubya - 25.06.2012

pawn Код:
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_BLUE 0x0000BBAA

public OnPlayerText(playerid, text[])
{
    new string[128], name[MAX_PLAYER_NAME];
    if(Adminvariable[playerid] == 1)
    {
        format(string, sizeof(string), "[V.I.P] %s: %s", GetPlayerName(playerid, name, sizeof(name)), text);
        SendClientMessageToAll(playerid, COLOR_GREEN, string);
        return 0;
    }
    if(Adminvariable[playerid] == 2)
    {
        format(string, sizeof(string), "[Moderator] %s: %s", GetPlayerName(playerid, name, sizeof(name)), text);
        SendClientMessageToAll(playerid, COLOR_GREEN, string);
        return 0;
    }
    else if(Adminvariable[playerid] >= 3)
    {
        format(string, sizeof(string), "[%d Admin] %s: %s", Admincariable[playerid], GetPlayerName(playerid, name, sizeof(name)), text);
        SendClientMessageToAll(playerid, COLOR_ORANGE, string);
        return 0;  
    }
    else if(Adminvariable[playerid] == 0)
    {
        format(string, sizeof(string), "[Player] %s: %s", GetPlayerName(playerid, name, sizeof(name)), text);
        SendClientMessageToAll(playerid, COLOR_WHITE, string);
        return 0;  
    }  
    else if(Leadervariable[playerid] == 1)
    {
        format(string, sizeof(string), "[Leader] %s: %s", GetPlayerName(playerid, name, sizeof(name)), text);
        SendClientMessageToAll(playerid, COLOR_BLUE, string);
        return 0;  
    }
    return 1;
}



Re: [Help]how to make a tag. - Kindred - 25.06.2012

pawn Код:
stock GetAdminRank(playerid)
{
    if(!IsPlayerConnected(playerid)) return 0;
    new AdminRank[40]
    switch(Adminvariable[playerid])
    {
        case 0: { Adminrank = "None"; }
        case 1: { Adminrank = "Moderator"; }
        case 2: { Adminrank = "Junior Admin"; }
        //And so forth
    }
    return Adminrank;
}

public OnPlayerText(playerid, text[])
{
    new string[128], name[MAX_PLAYER_NAME];
    if(Adminvariable[playerid] >= 1)
    {
        format(string, sizeof(string), "[%s] %s: %s", GetAdminRank(playerid), GetPlayerName(playerid, name, sizeof(name)), text);
        SendClientMessageToAll(playerid, -1, string);
        return 0;
    }
    return 1;
}
This is a better example.


Re: [Help]how to make a tag. - .Wicked - 25.06.2012

May I ask why do you put it on "OnPlayerText"?


Re: [Help]how to make a tag. - Kindred - 25.06.2012

Who are you talking to, us? If that's the case, it's because he never said anything about a command.

Elsewhere, I don't know why he'd want this.


Re: [Help]how to make a tag. - [A]ndrei - 26.06.2012

Quote:
Originally Posted by Dubya
Посмотреть сообщение
pawn Код:
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_BLUE 0x0000BBAA

public OnPlayerText(playerid, text[])
{
    new string[128], name[MAX_PLAYER_NAME];
    if(Adminvariable[playerid] == 1)
    {
        format(string, sizeof(string), "[V.I.P] %s: %s", GetPlayerName(playerid, name, sizeof(name)), text);
        SendClientMessageToAll(playerid, COLOR_GREEN, string);
        return 0;
    }
    if(Adminvariable[playerid] == 2)
    {
        format(string, sizeof(string), "[Moderator] %s: %s", GetPlayerName(playerid, name, sizeof(name)), text);
        SendClientMessageToAll(playerid, COLOR_GREEN, string);
        return 0;
    }
    else if(Adminvariable[playerid] >= 3)
    {
        format(string, sizeof(string), "[%d Admin] %s: %s", Admincariable[playerid], GetPlayerName(playerid, name, sizeof(name)), text);
        SendClientMessageToAll(playerid, COLOR_ORANGE, string);
        return 0;  
    }
    else if(Adminvariable[playerid] == 0)
    {
        format(string, sizeof(string), "[Player] %s: %s", GetPlayerName(playerid, name, sizeof(name)), text);
        SendClientMessageToAll(playerid, COLOR_WHITE, string);
        return 0;  
    }  
    else if(Leadervariable[playerid] == 1)
    {
        format(string, sizeof(string), "[Leader] %s: %s", GetPlayerName(playerid, name, sizeof(name)), text);
        SendClientMessageToAll(playerid, COLOR_BLUE, string);
        return 0;  
    }
    return 1;
}

hey can you post in pastebin becuase qwhen i copy/paste it comes out in one lineplease


Re: [Help]how to make a tag. - [A]ndrei - 27.06.2012

Quote:
Originally Posted by Dubya
Посмотреть сообщение
pawn Код:
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_BLUE 0x0000BBAA

public OnPlayerText(playerid, text[])
{
    new string[128], name[MAX_PLAYER_NAME];
    if(Adminvariable[playerid] == 1)
    {
        format(string, sizeof(string), "[V.I.P] %s: %s", GetPlayerName(playerid, name, sizeof(name)), text);
        SendClientMessageToAll(playerid, COLOR_GREEN, string);
        return 0;
    }
    if(Adminvariable[playerid] == 2)
    {
        format(string, sizeof(string), "[Moderator] %s: %s", GetPlayerName(playerid, name, sizeof(name)), text);
        SendClientMessageToAll(playerid, COLOR_GREEN, string);
        return 0;
    }
    else if(Adminvariable[playerid] >= 3)
    {
        format(string, sizeof(string), "[%d Admin] %s: %s", Admincariable[playerid], GetPlayerName(playerid, name, sizeof(name)), text);
        SendClientMessageToAll(playerid, COLOR_ORANGE, string);
        return 0;  
    }
    else if(Adminvariable[playerid] == 0)
    {
        format(string, sizeof(string), "[Player] %s: %s", GetPlayerName(playerid, name, sizeof(name)), text);
        SendClientMessageToAll(playerid, COLOR_WHITE, string);
        return 0;  
    }  
    else if(Leadervariable[playerid] == 1)
    {
        format(string, sizeof(string), "[Leader] %s: %s", GetPlayerName(playerid, name, sizeof(name)), text);
        SendClientMessageToAll(playerid, COLOR_BLUE, string);
        return 0;  
    }
    return 1;
}
can you please put this in pastebin PLEASE?