warning 213: tag mismatch
#1

Hey guys, I got this annoying warning.

Its on line 46, the line 46 is:
Код:
if (!strlen(text) > 64) return
The code around is:

Код:
CMD:announce(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))
		return SendClientMessage(playerid, COLOR_GREEN, "You are not allowed to use this command!");

    new text[64], time, style;
    if (sscanf(params, "iis[64]", style, time, text)) return
        SendClientMessage(playerid, COLOR_GREEN, "Usage: /announce <style[0-6]> <time in ms> <text>");
    if (strlen(text) > 64) return
        SendClientMessage(playerid, COLOR_GREEN, "Message too long please shorten it!");
    if(style == 2) return SendClientMessage(playerid, COLOR_GREEN, "Bug with style 2 don't use it!");
    if (style < 0 || style > 6) return
        SendClientMessage(playerid, COLOR_GREEN,"Invalid style!");
    if (time > 20*1000) return
        SendClientMessage(playerid, COLOR_GREEN, "No longer than 20 seconds!");
    GameTextForAll(text, time, style);
    return 1;
}
Reply
#2

Try using this:

pawn Код:
new msglen;
msglen = strlen(text);
pawn Код:
if(msglen > 64) return SendClientMessage(playerid, COLOR_GREEN, "Message too long please shorten it!");
Reply
#3

Quote:
Originally Posted by jackx3rx
Посмотреть сообщение
Try using this:

pawn Код:
new msglen;
msglen = strlen(text);
pawn Код:
if(msglen > 64) return SendClientMessage(playerid, COLOR_GREEN, "Message too long please shorten it!");
If you look at it a bit more, you'd notice that "text" will never go over 64 characters as it only has 64 cells.

pawn Код:
CMD:announce(playerid, params[])
{
    if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREEN, "You are not allowed to use this command!");

    new text[128], time, style;
    if(sscanf(params, "iis[128]", style, time, text)) return SendClientMessage(playerid, COLOR_GREEN, "Usage: /announce <style[0-6]> <time in ms> <text>");
    if(strlen(text) > 64) return SendClientMessage(playerid, COLOR_GREEN, "Message too long please shorten it!");
    if(style == 2) return SendClientMessage(playerid, COLOR_GREEN, "Bug with style 2 don't use it!");
    if(style < 0 || style > 6) return SendClientMessage(playerid, COLOR_GREEN,"Invalid style!");
    if(time > 20 * 1000) return SendClientMessage(playerid, COLOR_GREEN, "No longer than 20 seconds!");
    GameTextForAll(text, time, style);
    return 1;
}
Reply
#4

The problem is, now the server is saying "Unknown command".
Reply
#5

Try replacing
pawn Код:
if (!strlen(text) > 64) return
with
pawn Код:
if (!strlen(inputtext) > 64) return SendClientMessage(playerid, COLOR_GREEN, "Message too long please shorten it!");
And see if that works? Haven't tried it.
Reply
#6

I am sorry guys that I am pretty much a lame in pawn, but.. I am really really weak beginner.

error 017: undefined symbol "inputtext"
The line of error is the 46:
Код:
if (!strlen(inputtext) > 64) return
I am like, should I guys give you a whole script? There can be something wrong by that doh.
Reply
#7

Put it back to 'text' and not 'inputtext'.
Reply
#8

I am posting whole script... I hope it will be possible to fix..

Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#define FILTERSCRIPT
#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" FS Announce by DeVix");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}
#endif

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/lfevent", cmdtext, true, 10) == 0)
	{
		SetPlayerHealth(playerid, 1000000);
		SetPlayerArmour(playerid, 100.0);
		return 1;
	}
	if (strcmp("/maverick", cmdtext, true, 10) == 0)
	{
	    new vehicleid = GetPlayerVehicleID(playerid);
		SetVehicleHealth(vehicleid, 1000000);
		return 1;
	}
	return 0;
}

CMD:announce(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))
		return SendClientMessage(playerid, 0xFF0000FF, "You are not allowed to use this command!");

    new text[128], time, style;
    if (sscanf(params, "iis[128]", style, time, text)) return
        SendClientMessage(playerid, 0xFF0000FF, "Usage: /announce <style[0-6]> <time in ms> <text>");
    if (!strlen(text) > 64) return
        SendClientMessage(playerid, 0xFF0000FF, "Message too long please shorten it!");
    if(style == 2) return SendClientMessage(playerid, 0xFF0000FF, "Bug with style 2 don't use it!");
    if (style < 0 || style > 6) return
        SendClientMessage(playerid, 0xFF0000FF,"Invalid style!");
    if (time > 20*1000) return
        SendClientMessage(playerid, 0xFF0000FF, "No longer than 20 seconds!");
    GameTextForAll(text, time, style);
    return 1;
}
Reply
#9

Quote:
Originally Posted by algebrodand
Посмотреть сообщение
I am posting whole script... I hope it will be possible to fix..

Код:
#include <a_samp>
#include <zcmd>
#include <sscanf2>
#define FILTERSCRIPT
#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print("\n--------------------------------------");
	print(" FS Announce by DeVix");
	print("--------------------------------------\n");
	return 1;
}

public OnFilterScriptExit()
{
	return 1;
}
#endif

public OnPlayerCommandText(playerid, cmdtext[])
{
	if (strcmp("/lfevent", cmdtext, true, 10) == 0)
	{
		SetPlayerHealth(playerid, 1000000);
		SetPlayerArmour(playerid, 100.0);
		return 1;
	}
	if (strcmp("/maverick", cmdtext, true, 10) == 0)
	{
	    new vehicleid = GetPlayerVehicleID(playerid);
		SetVehicleHealth(vehicleid, 1000000);
		return 1;
	}
	return 0;
}

CMD:announce(playerid, params[])
{
    if(!IsPlayerAdmin(playerid))
		return SendClientMessage(playerid, 0xFF0000FF, "You are not allowed to use this command!");

    new text[128], time, style;
    if (sscanf(params, "iis[128]", style, time, text)) return
        SendClientMessage(playerid, 0xFF0000FF, "Usage: /announce <style[0-6]> <time in ms> <text>");
    if (!strlen(text) > 64) return
        SendClientMessage(playerid, 0xFF0000FF, "Message too long please shorten it!");
    if(style == 2) return SendClientMessage(playerid, 0xFF0000FF, "Bug with style 2 don't use it!");
    if (style < 0 || style > 6) return
        SendClientMessage(playerid, 0xFF0000FF,"Invalid style!");
    if (time > 20*1000) return
        SendClientMessage(playerid, 0xFF0000FF, "No longer than 20 seconds!");
    GameTextForAll(text, time, style);
    return 1;
}
You don't even have zcmd. Download it and use the command I gave you, and convert the strcmp commands to zcmd.
Reply
#10

Of course I have zcmd.inc putted in my includes folder, without it It would telling me another errors or?

Oh, thats the problem, I dont know how to convert them, I am that much lame.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)