/ad characters
#1

When i try to make /ad "text 52+ characters" it dont show .. how can i make it to show when i type a text with 52+ characters ?


pawn Code:
if(strcmp(cmd, "/ad", true) == 0 || strcmp(cmd, "/advertise", true) == 0)//LS
    {
        if(IsPlayerConnected(playerid) && PlayerToPoint(3.0,playerid,844.7034,-1045.6367,25.4302))
        {
            if(gPlayerLogged[playerid] == 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "** You havent logged in yet !");
                return 1;
            }
            if(PlayerInfo[playerid][pLevel] < 3)
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "Trebuie sa ai level 3 ca sa poti folosi comanda /ad !");
                return 1;
            }
            if(PlayerToPoint(3.0,playerid,848.9610,-1042.7968,25.5209))
            {
                SendClientMessage(playerid, COLOR_LIGHTRED, "Trebuie sa fi la CNN Studio sa poti da /ad !");
                return 1;
            }
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new length = strlen(cmdtext);
            while ((idx < length) && (cmdtext[idx] <= ' '))
            {
                idx++;
            }
            new offset = idx;
            new result[64];
            while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
            {
                result[idx - offset] = cmdtext[idx];
                idx++;
            }
            result[idx - offset] = EOS;
            result[0] = toupper(result[0]);
            if(!strlen(result))
            {
                SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/ad)vertise [advert text]");
                return 1;
            }
            if ((!adds) && (PlayerInfo[playerid][pAdmin] < 1))
            {
                format(string, sizeof(string), "** Please try again later %d seconds between Advertisements !",  (addtimer/1000));
                SendClientMessage(playerid, COLOR_GRAD2, string);
                return 1;

            }
            new payout = idx * 5;
            if(GetPlayerMoney(playerid) < payout)
            {
                format(string, sizeof(string), "** You used %d characters which cost $%s, you don't have enough.", offset, payout);
                SendClientMessage(playerid, COLOR_WHITE, string);
                return 1;
            }
            GivePlayerMoney(playerid, - payout);
            SBizzInfo[7][sbTill] += payout;
            ExtortionSBiz(7, payout);
            format(string, sizeof(string), "{00D900}Advertisement: {FFFFFF}%s{00D900}, {00D900}Contact: {FFFFFF}%s {00D900}Tel: {FFFFFF}%d",  result, sendername,PlayerInfo[playerid][pPnumber]);
            OOCNews(TEAM_GROVE_COLOR,string);
            format(string, sizeof(string), "~r~Paid $%d~n~~w~Message contained: %d Characters", payout, idx);
            GameTextForPlayer(playerid, string, 5000, 1);
            if (PlayerInfo[playerid][pAdmin] < 1){SetTimer("AddsOn", addtimer, 0);adds = 0;
            }
        }
        return 1;
    }
Reply
#2

English: Hi
Romanian:Salut
Reply
#3

Increase
pawn Code:
new result[64];
to around
pawn Code:
new result[128];
Reply
#4

Quote:
Originally Posted by CmZxC
View Post
Increase
pawn Code:
new result[64];
to around
pawn Code:
new result[128];
The same problem .. i changed to "128" ... it's the same max 52 characters .. if i type a text with 54-60 characters the advertise don't appear
Reply
#5

I don't think that you can increase the amount of characters into a message, it's defined by SA:MP itself!
Reply
#6

Quote:
Originally Posted by Twisted_Insane
View Post
I don't think that you can increase the amount of characters into a message, it's defined by SA:MP itself!
I saw on other servers something like this

Exemple:

/ad BLA BLA BLA BLA BLA BLA ...
... BLA BLA BLA

i hope u understand what i try to say
Reply
#7

You want it to be written in two lines if it is too long to stay in one?
Reply
#8

if the text its above 52 characters yes ..
Reply
#9

anyone?
Reply
#10

then you should split that one string.

for example

Code:
}
    new string[256]="Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text Text ";
    new str[54];
    new i,j;
    i=0;
    begin:
    j=0;
    while(j<53)
    {
               str[j]=string[i];
               if(!str[j])
               {
                //send to players the message.
                      goto end;
                }
                i++;
                j++;
    }
    if(str[j-1]!='\0')
    {
        str[53]='\0';
        str[52]='.';
        str[51]='.';
        str[50]='.';
        i=i-3;
        //send the message
       goto begin;
       end:;
    }
    
}
I tested it in Dev C and it should work.
Output was
Code:
Text Text Text Text Text Text Text Text Text Text ...
Text Text Text Text Text Text
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)