Lots of errors on a simple script. (Error 33; Error 10, Warnings)
#1

Hi, I am having a little problem with my script and I need someone's help.
The script is supposed to find if a player said a specific word, then send him a message, then kick him, but I get some errors.

Script:

PHP код:
#define FILTERSCRIPT
#include <a_samp>
//Colors
#define COLOR_GREY 0xAFAFAFAA
#define COLOR_GREEN 0x33AA33AA
#define COLOR_RED 0xFF0000AA
#define COLOR_YELLOW 0xFFFF00AA
#define COLOR_PINK 0xFF66FFAA
#define COLOR_BLUE 0x3A47DEFF
#define COLOR_TAN 0xBDB76BAA
#define COLOR_PURPLE 0x800080AA
#define COLOR_WHITE 0xFFFFFFAA
#define COLOR_LIGHTBLUE 0x33CCFFAA
#define COLOR_ORANGE 0xFF9900AA
#define COLOR_INDIGO 0x4B00B0AA
#define COLOR_BLACK 0x00000000
#define COLOR_DARKGREY 0x696969FF
enum swears
{
    
s0[64],
    
s1[64],
    
s2[64],
    
s3[64],
    
s4[64],
    
s5[64],
    
s6[64],
    
s7[64],
    
s8[64],
    
s9[64],
    
s10[64]
}
public 
OnFilterScriptInit()
{
    print(
"\n--------------------------------------");
    print(
" Anti-Swear by Miron (Mironinja4) B");
    print(
"--------------------------------------\n");
    return 
1;
}
public 
OnFilterScriptExit()
{
    return 
1;
}
public 
OnPlayerText(playeridtext[])
{
    new array[
swears];
    
format(array[s0], sizeof array[s0], "%s""Fuck");
    
format(array[s1], sizeof array[s1], "%s""Asshole");
    
format(array[s2], sizeof array[s2], "%s""Bitch");
    
format(array[s3], sizeof array[s3], "%s""Pizda");
    
format(array[s4], sizeof array[s4], "%s""Cur");
    
format(array[s5], sizeof array[s5], "%s""Pula");
    
format(array[s6], sizeof array[s6], "%s""Curvar");
    
format(array[s7], sizeof array[s7], "%s""Curva");
    
format(array[s8], sizeof array[s8], "%s""Fucker");
    
format(array[s9], sizeof array[s9], "%s""Cacat");
    
format(array[s10], sizeof array[s10], "%s""Whore");
    new 
size sizeof(array);
    
size +=1;
    new 
=0;
    while (
size)
     {
         new 
string[24] = "";
        
format(stringsizeof string"s%i"i);
        if ((
strfind(text, array[string], true) >= 0)
        {
            
SendClientMessage(playeridCOLOR_RED"Ai fost dat afara pentru limbaj vulgar.");
            
SetTimerEx("KickPlayer"1000false"i"playerid);
        }
        
i++;
    }
    return 
1;
}
forward KickPlayer(playerid);
public 
KickPlayer(playerid)
{
    
Kick(playerid);
    return 
1;

Thank you for reading it!
Reply
#2

Include the errors.
Reply
#3

antiswear2.pwn(71) : error 033: array must be indexed (variable "string")
antiswear2.pwn(74) : warning 217: loose indentation
antiswear2.pwn(76) : warning 217: loose indentation
antiswear2.pwn(78 ) : error 010: invalid function or declaration

2 Errors.
Reply
#4

Dont just copy, but understand what I did.
pawn Код:
#define FILTERSCRIPT

#include <a_samp>

#define COLOR_RED 0xFF0000AA


public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Anti-Swear by Miron (Mironinja4) B");
    print("--------------------------------------\n");
    return 1;
}

public OnFilterScriptExit()
{
    return 1;
}

public OnPlayerText(playerid, text[])
{
    new array[][] = { {"Fuck"},{"Asshole"},{"Bitch"},{"Pizda"},{"Cur"},{"Pula"},{"Curvar"},{"Curva"},{"Fucker"},{"Cacat"},{"Whore"} };
    for(new i; i < sizeof(array); i++)
    {
        if(strfind(text, array[i][0], true) != -1)
        {
            SendClientMessage(playerid,COLOR_RED , "Ai fost dat afara pentru limbaj vulgar.");
            SetTimerEx("KickPlayer", 1000, false, "i", playerid);
            break;
        }
    }
    return 0;
}
forward KickPlayers(playerid)
public KickPlayers(playerid)
{
    Kick(playerid);
    return 1;
}
Reply
#5

You can also use packed strings

pawn Код:
static const array[][] = {
    !"Fuck",
    !"Asshole",
    !"Bitch",
    !"Pizda",
    !"Cur",
    !"Pula",
    !"Curvar",
    !"Curva",
    !"Fucker",
    !"Cacat",
    !"Whore"
};
Reply
#6

Thank you very much, guys!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)