Need help fast!
#1

pawn Код:
#include <a_samp>
#define RED    0xE60000FF
stock IsNumeric(string[]) { for (new i = 0, j = strlen(string); i < j; i++) if (string > '9' || string < '0') return 0; return 1; }
public OnPlayerText(playerid, text[])
{

    new word[256],Index;while(Index < strlen(text)) {
        word = strtok(text,Index);
        if(CheckAdv(word)==1){
            new i=strfind(text,word),j=i+strlen(word)-1; text[i++]='[';
            while(i<j) {text='•';i++;}
            text[j]=']';
            Kick(playerid);
            new string[128];
            new pname[MAX_PLAYER_NAME];
            GetPlayerName(playerid, pname, sizeof(pname));
            format(string, sizeof(string), "Player %s (ID:%d) has been Kicked/Banned [Reason: IP Adverstiment]", pname, playerid);
            SendClientMessageToAll(RED, string);
        }
    }
    return 1;
}
stock CheckAdv(word[])
{
    if(strlen(word)>22) return 0;
    if(strfind(word,".", true)==-1) return 0;

    new ip[5][256],index;
    ip[0] = strtok(word,index,'.');
    ip[1] = strtok(word,index,'.');
    ip[2] = strtok(word,index,'.');
    if(strfind(word,":",true)>0){
        ip[3] = strtok(word,index,':');
        if(strfind(word,",",true)>0) ip[4] = strtok(word,index,',');else ip[4] = strtok(word,index);
    } else {
        if(strfind(word,",",true)==strlen(word)) ip[3] = strtok(word,index,',');else ip[3] = strtok(word,index);
        valstr(ip[4],0);
    }
    if(!IsNumeric(ip[0])||!IsNumeric(ip[1])||!IsNumeric(ip[2])||!IsNumeric(ip[3])||!IsNumeric(ip[4])
        ||!strlen(ip[0])||!strlen(ip[1])||!strlen(ip[2])||!strlen(ip[3])||!strlen(ip[4])
        ||(strval(ip[0])==192&&strval(ip[1])==168)
        ||(strval(ip[0])==172&&strval(ip[1])>=16&&strval(ip[1])<=31)
        ||strval(ip[0])==10||(strval(ip[0])==127&&strval(ip[1])==0&&strval(ip[2])==0&&strval(ip[3])==1)) return 0;
    return 1;
}
strtok(string[],&idx,seperator = ' ')
{
    new ret[128], i = 0, len = strlen(string);
    while(string[idx] == seperator && idx < len) idx++;
    while(string[idx] != seperator && idx < len)
    {
        ret = string[idx];
        i++;
        idx++;
    }
    while(string[idx] == seperator && idx < len) idx++;
    return ret;

And I'm getting these errors;

pawn Код:
C:\Documents and Settings\test.PC-06F6AC9FB95A\Desktop\adv2.pwn(3) : error 033: array must be indexed (variable "string")
C:\Documents and Settings\test.PC-06F6AC9FB95A\Desktop\adv2.pwn(11) : error 046: unknown array size (variable "text")
C:\Documents and Settings\test.PC-06F6AC9FB95A\Desktop\adv2.pwn(11) : warning 215: expression has no effect
C:\Documents and Settings\test.PC-06F6AC9FB95A\Desktop\adv2.pwn(52) : error 033: array must be indexed (variable "ret")
C:\Documents and Settings\test.PC-06F6AC9FB95A\Desktop\adv2.pwn(58) : error 030: compound statement not closed at the end of file (started at line 48)
Pawn compiler 3.2.3664          Copyright (c) 1997-2006, ITB CompuPhase


4 Errors.
My friend needs help with this,so could anyone help him?
Reply
#2

What lines are what?
Reply
#3

3

stock IsNumeric(string[]) { for (new i = 0, j = strlen(string); i < j; i++) if (string > '9' || string < '0') return 0; return 1; }

11


while(i<j) {text='•';i++;}

52

ret = string[idx];
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)