Help With Announce
#1

Hello, I am in need of some help, I have made an announce script, but I want it to work with Ladmin4v2, I have the include, but every time I try to compile it, I get 1 error and 1 warning I can't fix.

Code:
C:\Documents and Settings\Administrator\Desktop\AnnounceScript1.pwn(9) : error 017: undefined symbol "cmd"
C:\Documents and Settings\Administrator\Desktop\AnnounceScript1.pwn(11) : warning 204: symbol is assigned a value that is never used: "cmd"
I am a new coder, so I have tried to do this:

Code:
#include <a_samp>
#include <isplayerLadmin>
#include <core>
#pragma tabsize 0


public OnPlayerCommandText(playerid, cmdtext[])
{
	if(strcmp(cmd,"/at",true)==0)
	{
	new cmd[128], tmp[512], idx;
	strtok(cmdtext, idx);
	IsPlayerAdminLevel(playerid, 2);
		{
	new sendername[128];
	new string[128];
 	tmp = strtok(cmdtext, idx);
			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, 0xFF0000FF, "USAGE: /at message");
				return 1;
			}
			format(string, sizeof(string), "[ ! ] %s", result);
			SendClientMessageToAll(0xFF0000FF,string);
		}
		return 1;
	}
return 0;
}
EDIT: I read the pawno compiler and fixed a few things, if they are wrong, feel free to correct me.
Reply
#2

try this
pawn Code:
#include <a_samp>
#include <isplayerLadmin>
#include <core>
#pragma tabsize 0


public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[128], tmp[512], idx;
    cmd = strtok(cmdtext, idx);
    if(strcmp(cmd,"/at",true)==0)
    {
    IsPlayerAdminLevel(playerid, 2);
        {
    new sendername[128];
    new string[128];
    tmp = strtok(cmdtext, idx);
            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, 0xFF0000FF, "USAGE: /at message");
                return 1;
            }
            format(string, sizeof(string), "[ ! ] %s", result);
            SendClientMessageToAll(0xFF0000FF,string);
        }
        return 1;
    }
return 0;
}
Reply
#3

I tried doing this, but I get an error on a line.

Code:
C:\Documents and Settings\Administrator\Desktop\Announcefs1.pwn(10) : error 047: array sizes do not match, or destination array is too small
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
This is what the script looks like right now:

Code:
#include <a_samp>
#include <isplayerLadmin>
#include <core>
#pragma tabsize 0


public OnPlayerCommandText(playerid, cmdtext[])
{
	new cmd[128], tmp[512], idx;
	cmd = strtok(cmdtext, idx);
    if(strcmp(cmd,"/at",true)==0)
	{
    IsPlayerAdminLevel(playerid, 2);
		{
	new sendername[128];
	new string[128];
 	tmp = strtok(cmdtext, idx);
			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, 0xFF0000FF, "USAGE: /at message");
				return 1;
			}
			format(string, sizeof(string), "[ ! ] %s", result);
			SendClientMessageToAll(0xFF0000FF,string);
		}
		return 1;
	}
return 0;
}
Reply
#4

pawn Code:
if(strcmp(cmd,"/at",true)==0)
    {
    new sendername[128];
    new string[128];
        IsPlayerAdminLevel(playerid, 2);
        {

            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_LIGHTRED, "USAGE: /at message");
                return 1;
            }
            format(string, sizeof(string), "[ ! ] %s", result);
            SendClientMessageToAll(COLOR_YELLOW,string);
        }
        return 1;
    }
..................................dots............ ..............................
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)