/accent help! Please! Seriously appreciated :)
#1

Код:
#define FILTERSCRIPT

#include <a_samp>

new AccentData[MAX_PLAYERS][30];

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
	print(" Accent System by Neal Anthony Loaded ");
	return 1;
}

public OnFilterScriptExit()
{
    print(" Accent System by Neal Anthony Unloaded ");
	return 1;
}

stock strtok(const string[], &index,seperator=' ')
{
	new length = strlen(string);
	new offset = index;
	new result[128];
	while ((index < length) && (string[index] != seperator) && ((index - offset) < (sizeof(result) - 1)))
	{
		result[index - offset] = string[index];
		index++;
	}

	result[index - offset] = EOS;
	if ((index < length) && (string[index] == seperator))
	{
		index++;
	}
	return result;
}
public OnPlayerConnect(playerid)
{
	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
	return 1;
}

public OnPlayerText(playerid, text[])
{
	new txt[155], name[24];
	GetPlayerName(playerid, name, 24);
	format(txt, 155, "%s says (%s accent): %s", name, AccentData[playerid], text);
	return 1;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
	new idx;
	new tmp[128];
	tmp = strtok(cmdtext, idx);
	if(!strcmp("/accent", cmdtext, true))
		{
			if(!strlen(tmp)) return SendClientMessage(playerid, 0xFFFFFFF, "/accept <accent> (German, Spanish etc..)");
			strmid(AccentData[playerid], tmp, 0, strlen(tmp), 255);
		}
	return 1;
}

#endif
I'm using this as a filterscript and it isn't working, if I use it all my commands no longer work.
I need someone to fix it for me and I really appreciate it!
Thanks!
Reply
#2

Put filterscript contents into your gamemode m8.

Peace...
Reply
#3

Quote:

Put filterscript contents into your gamemode m8.

Peace...

Not always the choice a majority of the people would like to make. Personally I'd rather have multiple scripts running instead of one.


You need to return false on the chat/command callbacks.
pawn Код:
#define FILTERSCRIPT

#include <a_samp>

new AccentData[MAX_PLAYERS][30];

#if defined FILTERSCRIPT

public OnFilterScriptInit()
{
    print(" Accent System by Neal Anthony Loaded ");
    return 1;
}

public OnFilterScriptExit()
{
    print(" Accent System by Neal Anthony Unloaded ");
    return 1;
}

stock strtok(const string[], &index,seperator=' ')
{
    new length = strlen(string);
    new offset = index;
    new result[128];
    while ((index < length) && (string[index] != seperator) && ((index - offset) < (sizeof(result) - 1)))
    {
        result[index - offset] = string[index];
        index++;
    }

    result[index - offset] = EOS;
    if ((index < length) && (string[index] == seperator))
    {
        index++;
    }
    return result;
}

public OnPlayerText(playerid, text[])
{
    new txt[155], name[24];
    GetPlayerName(playerid, name, 24);
    format(txt, 155, "%s says (%s accent): %s", name, AccentData[playerid], text);
    return 0;
}

public OnPlayerCommandText(playerid, cmdtext[])
{
    new idx;
    new tmp[128];
    tmp = strtok(cmdtext, idx);
    if(!strcmp("/accent", cmdtext, true))
    {
        if(!strlen(tmp)) return SendClientMessage(playerid, 0xFFFFFFF, "/accept <accent> (German, Spanish etc..)");
        strmid(AccentData[playerid], tmp, 0, strlen(tmp), 255);
    }
    return 0;
}

#endif
Reply
#4

@iFriSki Testing now, thanks for the tip!
Edit ::
Nope didn't work, all commands are now working, however the filterscript itself seems to not work.
I really appreciate the tip
But now I need someone to tell me what's wrong with the filterscript? Thanks again!!
Reply
#5

Fixed.
/Request Close.
Also released the new code
Thanks everyone for the help!

https://sampforum.blast.hk/showthread.php?pid=1060836#pid1060836
Reply
#6

Just a note: You aren't sending a MSG in OnPlayerText, and you are returning 0, normal chat won't work!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)