Undefined symbol
#1

I get the following errors:
Код:
C:\Documents and Settings\YkZBoY\Desktop\dec-lands\gamemodes\decv0116.pwn(39383) : error 017: undefined symbol "cmd"
C:\Documents and Settings\YkZBoY\Desktop\dec-lands\gamemodes\decv0116.pwn(39392) : error 017: undefined symbol "string"
C:\Documents and Settings\YkZBoY\Desktop\dec-lands\gamemodes\decv0116.pwn(39392) : error 017: undefined symbol "string"
C:\Documents and Settings\YkZBoY\Desktop\dec-lands\gamemodes\decv0116.pwn(39392) : error 029: invalid expression, assumed zero
C:\Documents and Settings\YkZBoY\Desktop\dec-lands\gamemodes\decv0116.pwn(39392) : fatal error 107: too many error messages on one line

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


5 Errors.
For this script
Код:
if(strcmp(cmd, "/n", true) == 0)
{
	if(PlayerInfo[playerid][pMuted] == 1)
	{
		SendClientMessage(playerid, COLOR_GREY, "You are muted from the newbie chat channel.");
		return 1;
	}
	if(NewbieTimer[playerid] > 0)
	{
		format(string, sizeof(string), "You must wait %d between each message.", NewbieTimer[playerid]);
		SendClientMessage(playerid, COLOR_GREY, string);
		return 1;
	}
	new result[64];
	new length = strlen(cmdtext);
	new offset = idx;
	while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
	{
		result[idx - offset] = cmdtext[idx];
		idx++;
	}
	result[idx - offset] = EOS;
	if(!strlen(result))
	{
	SendClientMessage(playerid, COLOR_GREEN, "{33CCFF}USAGE:{FFFFFF} /n [text]");
    return 1;
	}
	if(PlayerInfo[playerid][pAdmin] < 1)
	{
		NewbieTimer[playerid] = 30;
	}
	if(PlayerInfo[playerid][pAdmin]<1)
	{
		format(string, sizeof(string), "** Newbie %s: %s", GetPlayerNameEx(playerid), result);
	}
	if(PlayerInfo[playerid][pAdmin] == 1)
	{
		format(string, sizeof(string), "** Moderator %s: %s", GetPlayerNameEx(playerid), result);
	}
	if(PlayerInfo[playerid][pAdmin] >= 2)
	{
		format(string, sizeof(string), "** Admin %s: %s", GetPlayerNameEx(playerid), result);
	}
	foreach(Player, n)
	{
			SetTimer("NewbTimer", 25000, 0);
			SendClientMessage(n, COLOR_GREEN, string);
	}
	return 1;
}
Reply
#2

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/command here", cmdtext, true, 10) == 0)
    {
For those undefined cmd & string
Reply
#3

Quote:
Originally Posted by RanSEE
Посмотреть сообщение
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/command here", cmdtext, true, 10) == 0)
    {
For those undefined cmd & string
The '10' would be an inappropriate string length in this matter.
Alternatively you can use:
if(strcmp(cmdtext, "/mycommand", true) == 0)
{
new string[145]; //You can replace 145 with the string size appropriate to your situation.
[/pawn]
The max string size for your text, including the null terminator, is approximately 108 cells. So remember to tell the player, or reject their request if their params are longer.

Example:
pawn Код:
if(!strlen(result)) return SendClientMessage(playerid, COLOR_GREEN, "{33CCFF}USAGE:{FFFFFF} /n [text]");
if(strlen(result) > 108) return SendClientMessage(playerid, COLOR_GREEN, "Your Message Must Be Less Than 108 Characters Long.");
Reply
#4

This is what I get now...
Код:
C:\Documents and Settings\YkZBoY\Desktop\dec-lands\gamemodes\decv0116.pwn(39383) : error 017: undefined symbol "cmdtext"
C:\Documents and Settings\YkZBoY\Desktop\dec-lands\gamemodes\decv0116.pwn(39392) : error 017: undefined symbol "string"
C:\Documents and Settings\YkZBoY\Desktop\dec-lands\gamemodes\decv0116.pwn(39392) : error 017: undefined symbol "string"
C:\Documents and Settings\YkZBoY\Desktop\dec-lands\gamemodes\decv0116.pwn(39392) : error 029: invalid expression, assumed zero
C:\Documents and Settings\YkZBoY\Desktop\dec-lands\gamemodes\decv0116.pwn(39392) : fatal error 107: too many error messages on one line

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


5 Errors.
Reply
#5

Make sure you are putting this command under OnPlayerCommandText.
Here is the full code:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if(strcmp(cmdtext, "/n", true) == 0)
    {
        new string[150];
        if(PlayerInfo[playerid][pMuted] == 1) return SendClientMessage(playerid, COLOR_GREY, "You are muted from the newbie chat channel.");
        if(NewbieTimer[playerid] > 0)
        {
            format(string, sizeof(string), "You must wait another %d seconds.", NewbieTimer[playerid]);
            return SendClientMessage(playerid, COLOR_GREY, string);
        }
        new result[64];
        new length = strlen(cmdtext);
        new offset = idx;
        while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
        {
            result[idx - offset] = cmdtext[idx];
            idx++;
        }
        result[idx - offset] = EOS;
        if(!strlen(result)) return SendClientMessage(playerid, COLOR_GREEN, "{33CCFF}USAGE:{FFFFFF} /n [text]");
        if(strlen(result) > 108) return SendClientMessage(playerid, COLOR_GREEN, "The length of your message must be less than 108 characters.");
        if(PlayerInfo[playerid][pAdmin] < 1)
        {
            NewbieTimer[playerid] = 30;
        }
        if(PlayerInfo[playerid][pAdmin] < 1)
        {
            format(string, sizeof(string), "** Newbie %s: %s", GetPlayerNameEx(playerid), result);
        }
        if(PlayerInfo[playerid][pAdmin] == 1)
        {
            format(string, sizeof(string), "** Moderator %s: %s", GetPlayerNameEx(playerid), result);
        }
        if(PlayerInfo[playerid][pAdmin] >= 2)
        {
            format(string, sizeof(string), "** Admin %s: %s", GetPlayerNameEx(playerid), result);
        }
        SendClientMessageToAll(COLOR_GREEN, string);
        return 1;
    }
    return 0;
}
Reply
#6

This is what I get now...
Код:
C:\Documents and Settings\YkZBoY\Desktop\dec-lands\gamemodes\decvtesteeeeeee.pwn(148) : error 010: invalid function or declaration
C:\Documents and Settings\YkZBoY\Desktop\dec-lands\gamemodes\decvtesteeeeeee.pwn(12346) : error 017: undefined symbol "GetPlayerNameEx"
C:\Documents and Settings\YkZBoY\Desktop\dec-lands\gamemodes\decvtesteeeeeee.pwn(12350) : error 017: undefined symbol "GetPlayerNameEx"
C:\Documents and Settings\YkZBoY\Desktop\dec-lands\gamemodes\decvtesteeeeeee.pwn(12354) : error 017: undefined symbol "GetPlayerNameEx"
C:\Documents and Settings\YkZBoY\Desktop\dec-lands\gamemodes\decvtesteeeeeee.pwn(12363) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
After I change GetPlayerNameEx to GetPlayerName:

Код:
C:\Documents and Settings\YkZBoY\Desktop\dec-lands\gamemodes\decvtesteeeeeee.pwn(148) : error 010: invalid function or declaration
C:\Documents and Settings\YkZBoY\Desktop\dec-lands\gamemodes\decvtesteeeeeee.pwn(12346) : warning 202: number of arguments does not match definition
C:\Documents and Settings\YkZBoY\Desktop\dec-lands\gamemodes\decvtesteeeeeee.pwn(12346) : warning 202: number of arguments does not match definition
C:\Documents and Settings\YkZBoY\Desktop\dec-lands\gamemodes\decvtesteeeeeee.pwn(12350) : warning 202: number of arguments does not match definition
C:\Documents and Settings\YkZBoY\Desktop\dec-lands\gamemodes\decvtesteeeeeee.pwn(12350) : warning 202: number of arguments does not match definition
C:\Documents and Settings\YkZBoY\Desktop\dec-lands\gamemodes\decvtesteeeeeee.pwn(12354) : warning 202: number of arguments does not match definition
C:\Documents and Settings\YkZBoY\Desktop\dec-lands\gamemodes\decvtesteeeeeee.pwn(12354) : warning 202: number of arguments does not match definition
C:\Documents and Settings\YkZBoY\Desktop\dec-lands\gamemodes\decvtesteeeeeee.pwn(12363) : warning 225: unreachable code
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)