erros with strcat..?
#1

Hey guys, i've been trying to compile this test script (not written by me)
Код:
if(playertextid == TDEditor_PTD[playerid][20])
    {
    	new pDialog[512];
		strcat(pDialog, ""COL_WHITE"Hi, and welcome to my "COL_RED"super duper awesome "COL_WHITE"server!\n", sizeof(pDialog));
		strcat(pDialog, ""COL_WHITE"Here are some "COL_RED"rules "COL_WHITE"that you should respect:\n", sizeof(pDialog));
		strcat(pDialog, ""COL_GREEN"1. "COL_WHITE"You are not allowed to spam.\n", sizeof(pDialog));
		strcat(pDialog, ""COL_GREEN"2. "COL_WHITE"You are not allowed to advertise.\n", sizeof(pDialog));
		strcat(pDialog, ""COL_GREEN"3. "COL_WHITE"You are not allowed to cheat/hack.\n", sizeof(pDialog));
		strcat(pDialog, ""COL_GREEN"4. "COL_WHITE"You are not allowed to spawnkill.\n", sizeof(pDialog));
		strcat(pDialog, ""COL_GREEN"5. "COL_WHITE"You are not allowed to insult others.\n", sizeof(pDialog));
		strcat(pDialog, ""COL_GREEN"6. "COL_WHITE"You are not allowed to beg for admin.\n", sizeof(pDialog));
		strcat(pDialog, ""COL_WHITE"There are special rules for "COL_GREEN"VIPs"COL_WHITE"! Please check\n", sizeof(pDialog));
		strcat(pDialog, ""COL_GREEN"/yaddayaddayadda "COL_WHITE"for more information!", sizeof(pDialog));
		ShowPlayerDialog(playerid, DIALOG_HELP, DIALOG_STYLE_MSGBOX, ""COL_BLUE"My Super Rules", pDialog, "OK", "Cancel");
  		CancelSelectTextDraw(playerid);
    }
and those are the erros am getting:
Код:
C:\Users\socky\Desktop\NZGaming\gamemodes\NZG.pwn(1632) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Users\socky\Desktop\NZGaming\gamemodes\NZG.pwn(1632) : error 001: expected token: "-string end-", but found "-identifier-"
C:\Users\socky\Desktop\NZGaming\gamemodes\NZG.pwn(1632) : warning 215: expression has no effect
C:\Users\socky\Desktop\NZGaming\gamemodes\NZG.pwn(1632) : error 001: expected token: ";", but found "-identifier-"
C:\Users\socky\Desktop\NZGaming\gamemodes\NZG.pwn(1632) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
this is lin e 1632:
Код:
strcat(pDialog, ""COL_WHITE"Hi, and welcome to my "COL_RED"super duper awesome "COL_WHITE"server!\n", sizeof(pDialog));
can anyone please explain this to me? thanks in advance!
Reply
#2

Remove the red part
strcat(pDialog, ""COL_WHITE"Hi, and welcome to my "COL_RED"super duper awesome "COL_WHITE"server!\n", sizeof(pDialog));

use format() to format your text
Reply
#3

Quote:
Originally Posted by Eoussama
Посмотреть сообщение
Remove the red part
strcat(pDialog, ""COL_WHITE"Hi, and welcome to my "COL_RED"super duper awesome "COL_WHITE"server!\n", sizeof(pDialog));

use format() to format your text
Why would that fix any errors?

https://sampwiki.blast.hk/wiki/Strcat

And what would he be formatting? There is no use for format here.

--

How have you defined 'COL_WHITE', 'COL_RED' etc.?

#define COL_WHITE 0xFFFFFFFF
or
#define COL_WHITE "{FFFFFF}"
??
Reply
#4

Quote:
Originally Posted by Threshold
Посмотреть сообщение
Why would that fix any errors?

https://sampwiki.blast.hk/wiki/Strcat

And what would he be formatting? There is no use for format here.

--

How have you defined 'COL_WHITE', 'COL_RED' etc.?

#define COL_WHITE 0xFFFFFFFF
or
#define COL_WHITE "{FFFFFF}"
??
yeah ofc i did


edit: "col_green" wasn't defined...lol sorry
fixed! thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)