About Strings
#1

Well, I'm script an admin chat and I try to test it but it show like half of the text



How can I make the text longer like other servers did ?
Reply
#2

There is a function for that here
https://sampforum.blast.hk/showthread.php?tid=38965
Reply
#3

Your chat string variable is probably to small. Make it a bit larger.
Reply
#4

Quote:
Originally Posted by FTLOG
Посмотреть сообщение
Your chat string variable is probably to small. Make it a bit larger.
Yeah, I've try that but I don't want the server console to be spammed like it says, "String.....Define" something like that, idk .
Reply
#5

Well show your code so we don't have to incorrectly guess whats wrong with it.
Reply
#6

Don't be afraid of, the max lenght of string for chat is 128, just use that.
Reply
#7

Quote:
Originally Posted by Dwane
Посмотреть сообщение
Don't be afraid of, the max lenght of string for chat is 128, just use that.
My string is 128 but that is just half of the text
Reply
#8

You probably have something like this:
pawn Код:
CMD:chat(playerid, params[])
{
    new string[128];
    if(sscanf(params, "s", string)) return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /chat [text]");
    new string2[60];
    format(string2,sizeof(string2),"Admin: %s", string);
    SendClientMessageToAll(0xFFFF00FF, string2);
    return 1;
}
Notice how the string we are formatting, is actually less string length than our text length? This is most likely what you have done.

EDIT: Or possibly the other way around
Reply
#9

I'm not sure then, can you please post the part of code that you used for that line (the half of the text).
Reply
#10

Quote:
Originally Posted by Dwane
Посмотреть сообщение
I'm not sure then, can you please post the part of code that you used for that line (the half of the text).
Sorry for the late post again due to my PC button spoiled and I've send it to repair, here is the codes BTW

pawn Код:
CMD:a(playerid, params[])
{
    new str[128], text[100];
    if(PlayerInfo[playerid][Admin] >=1)
    {
        if(sscanf(params, "s", text)) return SendClientMessage(playerid, COLOR_GREY, "Syntax: /(a)dminchat [Text]");
        if(PlayerInfo[playerid][Admin] == 1)
        {
            format(str, sizeof(str), "(( Helping Hand %s : %s ))", GetName(playerid), text);
            SendMessageToAdmins(ADMIN_CHAT, str);
        }
        else if(PlayerInfo[playerid][Admin] == 2)
        {
            format(str, sizeof(str), "(( Mini-Moderator %s : %s ))", GetName(playerid), text);
            SendMessageToAdmins(ADMIN_CHAT, str);
        }
        else if(PlayerInfo[playerid][Admin] == 3)
        {
            format(str, sizeof(str), "(( Moderator %s : %s ))", GetName(playerid), text);
            SendMessageToAdmins(ADMIN_CHAT, str);
        }
        else if(PlayerInfo[playerid][Admin] == 4)
        {
            format(str, sizeof(str), "(( Super Moderator %s : %s ))", GetName(playerid), text);
            SendMessageToAdmins(ADMIN_CHAT, str);
        }
        else if(PlayerInfo[playerid][Admin] == 5)
        {
            format(str, sizeof(str), "(( Administrator %s : %s ))", GetName(playerid), text);
            SendMessageToAdmins(ADMIN_CHAT, str);
        }
        else if(PlayerInfo[playerid][Admin] == 6)
        {
            format(str, sizeof(str), "(( Head Administrator %s : %s ))", GetName(playerid), text);
            SendMessageToAdmins(ADMIN_CHAT, str);
        }
        else if(PlayerInfo[playerid][Admin] == 7)
        {
            format(str, sizeof(str), "(( Lead Administrator %s : %s ))", GetName(playerid), text);
            SendMessageToAdmins(ADMIN_CHAT, str);
        }
        else if(PlayerInfo[playerid][Admin] == 8)
        {
            format(str, sizeof(str), "(( Assistant Director %s : %s ))", GetName(playerid), text);
            SendMessageToAdmins(ADMIN_CHAT, str);
        }
        else if(PlayerInfo[playerid][Admin] ==9)
        {
            format(str, sizeof(str), "(( Director %s : %s ))", GetName(playerid), text);
            SendMessageToAdmins(ADMIN_CHAT, str);
        }
        else if(PlayerInfo[playerid][Admin] ==10)
        {
            format(str, sizeof(str), "(( Executive Director %s : %s ))", GetName(playerid), text);
            SendMessageToAdmins(ADMIN_CHAT, str);
        }
        else if(IsPlayerAdmin(playerid))
        {
            format(str, sizeof(str), "(( RCON Administrator %s : %s ))", GetName(playerid), text);
            SendMessageToAdmins(ADMIN_CHAT, str);
        }
    }
    else
    {
        SendClientMessage(playerid, COL_RED, "ERROR: You are not an Admin");
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)