something wrong plz help
#1

Well, I wanted to make 2 lines whenever I write a long text, I tried to do that, but it shows a text messed up..., but when I write short text, it looks fine. dunno why, take atleast one look on it, plz and thx

Код:
if(strcmp(cmd, "/d", true) == 0)
	{
	    new string[256];
	    if(IsPlayerConnected(playerid))
	    {
	        if(IsLogged[playerid] == 0)
	        {
	            SendClientMessage(playerid, COLOR_WHITE, "You are not logged in yet.");
	            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;
			if(!strlen(result))
			{
				SendClientMessage(playerid, COLOR_WHITE, "	USAGE: /r [radio transmission]");
				return 1;
			}
			if(strlen(cmdtext) > 50)
	  		{
   		     new string2[120];
	 	     format(string,120,"[GOV]%s:%s...", sendername,cmdtext[50]);
	 	     strdel(cmdtext,50,strlen(cmdtext));
		 	 format(string2,120,"... %s",cmdtext[4]);
       		 SendClientMessageToAll(COLOR_DEPART_RADIO,string);
		  	 SendClientMessageToAll(COLOR_DEPART_RADIO,string2);
   		    }
		    else
			{
		  	format(string,120,"[GOV]%s: %s", sendername,cmdtext[4]);
		  	SendClientMessageToAll(COLOR_DEPART_RADIO,string);
			}
		}
		return 1;
	}
Reply
#2

On the second line should'nt you make cmdtext[4] into cmdtext[strlen(cmdtext)-50] ?

Just guessing
Reply
#3

Excuse me, but I didn't understand anything..
Reply
#4

As I posted in your other topic, this would do fine:

pawn Код:
if(strcmp(cmdtext, "/d", true, 2) == 0)
    {
        new string[128], pname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pname, sizeof(pname));

        if(IsLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_WHITE, "You are not logged in yet.");
        if(strlen(cmdtext[3]) == 0) return SendClientMessage(playerid, COLOR_GREY, "    USAGE: /b [text]");

        format(string, sizeof(string), "((%s: %s))", pname, cmdtext[3]);
        SendClientMessageToAll(COLOR_GREY, string);
        return 1;
    }
Reply
#5

Well, this will make only for one line, I want that /d works in 2 lines when it got 2 long text, understood now ?
Reply
#6

I understand, but I don't think you really need that :P. But if you insist, try this:

pawn Код:
if(strcmp(cmdtext, "/d", true, 2) == 0)
    {
        new string[128], pname[MAX_PLAYER_NAME];
        GetPlayerName(playerid, pname, sizeof(pname));

        if(IsLogged[playerid] == 0) return SendClientMessage(playerid, COLOR_WHITE, "You are not logged in yet.");
        if(strlen(cmdtext[3]) == 0) return SendClientMessage(playerid, COLOR_GREY, "    USAGE: /b [text]");

        if(strlen(cmdtext) > 50)
        {
            strmid(string, cmdtext, 3, 50);
            format(string, sizeof(string), "[GOV]%s: %s...", pname, string);
            SendClientMessageToAll(COLOR_GREY, string);
           
            format(string, sizeof(string), "...%s", cmdtext[50]);
            SendClientMessageToAll(COLOR_GREY, string);
        }
        else
        {
            format(string, sizeof(string), "[GOV]%s: %s", pname, cmdtext[3]);
            SendClientMessageToAll(COLOR_GREY, string);
        }
        return 1;
    }
Reply
#7

Thanks man, appreciate it...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)