I get an error
#1

Hello
I just downloaded the GEO filterscript,and copied the stocks from there into my mod.
But when I copy them I get this error:
PHP код:
error 022: must be lvalue (non-constant) 
For this line:
PHP код:
       a=strval(Params[0]); 
Why am I getting this error? When its on the Filterscript it works great.
Please help
Reply
#2

Bump
Reply
#3

Where did you use it then not in your filterscript? And post both codes please
Reply
#4

Quote:
Originally Posted by Anteino
Посмотреть сообщение
Where did you use it then not in your filterscript? And post both codes please
I put the stocks at the end of my mode and all else in their publics.
And here is the stock:
pawn Код:
GetPlayerCountry(playerid,Country[256]){
    new IPAddress[256];
    new a,b,c,d,ipf;
    new File:IPFile;
    new Text[256],start,end;
    GetPlayerIp(playerid,IPAddress,sizeof(IPAddress));
    GetParams(IPAddress);
    a=strval(Params[0]);
    b=strval(Params[1]);
    c=strval(Params[2]);
    d=strval(Params[3]);
    if(a==127 && b==0 && c==0 && d==1){
        format(Country,sizeof(Country),"Localhost");
        return 1;
    }
    ipf = (16777216*a) + (65536*b) + (256*c) + d;
    if(!fexist("CountriesIPs/IPLIST.csv")) return SendClientMessage(playerid,0xFF0000FF,"Country file not found.");
    IPFile=fopen("CountriesIPs/IPLIST.csv",io_read);
    fread(IPFile,Text,sizeof(Text),false);
    while(strlen(Text)>0){
        GetFileData(Text);
        start=strval(FileData[0]);
        end=strval(FileData[1]);
        if(ipf>=start && ipf<=end){
            format(Country,sizeof(Country),"%s(%s)",FileData[6],FileData[5]);
            fclose(IPFile);
            return 1;
        }
        fread(IPFile,Text,sizeof(Text),false);
    }
    fclose(IPFile);
    return 1;
}
Reply
#5

Did you use
pawn Код:
stock GetPlayerCountry(playerid,Country[256]){
Because if you forget to put the actual word "stock" in front of a stock function it won't work and it'll give you weird errors and warnings
Reply
#6

Quote:
Originally Posted by Anteino
Посмотреть сообщение
Did you use
pawn Код:
stock GetPlayerCountry(playerid,Country[256]){
Because if you forget to put the actual word "stock" in front of a stock function it won't work and it'll give you weird errors and warnings
This function in the fs is without stock,so I copied it the same.
Anyway it still won't work
Reply
#7

Quote:
Originally Posted by Montserrat
Посмотреть сообщение
This function in the fs is without stock,so I copied it the same.
Anyway it still won't work
Well I can see no line where you put a value in params[0]. Please post the code of the whole filterscript
Reply
#8

Quote:
Originally Posted by Anteino
Посмотреть сообщение
Well I can see no line where you put a value in params[0]. Please post the code of the whole filterscript
pawn Код:
GetParams(Source[]){
    new Destination[256];
    new SLen=strlen(Source);
    new at,pos=0,tp=0;
    new tempo[256];

    format(Params[0],sizeof(Params),"");
    format(Params[1],sizeof(Params),"");
    format(Params[2],sizeof(Params),"");
    format(Params[3],sizeof(Params),"");


    for(at=pos;at<=SLen;at++){
        strmid(tempo,Source,at,at+1,sizeof(tempo));
        if(!strcmp(tempo,".",true)){
            if(tp<=10){
                strmid(Destination,Source,pos,at,sizeof(Destination));
                format(Params[tp][0],256,"%s",Destination);
                tp=tp+1;
            }
            pos=at+1;
        }
    }
    return 1;
}


GetFileData(Source[]){
    new Destination[256];
    new SLen=strlen(Source);
    new at,pos=0,tp=0;
    new tempo[256];

    format(FileData[0],sizeof(FileData),"");
    format(FileData[1],sizeof(FileData),"");
    format(FileData[2],sizeof(FileData),"");
    format(FileData[3],sizeof(FileData),"");
    format(FileData[4],sizeof(FileData),"");
    format(FileData[5],sizeof(FileData),"");
    format(FileData[6],sizeof(FileData),"");

    for(at=pos;at<=SLen;at++){
        strmid(tempo,Source,at,at+1,sizeof(tempo));
        if(!strcmp(tempo,",",true)){
            if(tp<=10){
                strmid(Destination,Source,pos,at,sizeof(Destination));
                format(FileData[tp][0],256,"%s",Destination);
                tp=tp+1;
            }
            pos=at+1;
        }
    }
    return 1;
}

GetPlayerCountry(playerid,Country[256]){
    new IPAddress[256];
    new a,b,c,d,ipf;
    new File:IPFile;
    new Text[256],start,end;
    GetPlayerIp(playerid,IPAddress,sizeof(IPAddress));
    GetParams(IPAddress);
    a=strval(Params[0]);
    b=strval(Params[1]);
    c=strval(Params[2]);
    d=strval(Params[3]);
    if(a==127 && b==0 && c==0 && d==1){
        format(Country,sizeof(Country),"Localhost");
        return 1;
    }
    ipf = (16777216*a) + (65536*b) + (256*c) + d;
    if(!fexist("CountriesIPs/IPLIST.csv")) return SendClientMessage(playerid,0xFF0000FF,"Country file not found.");
    IPFile=fopen("CountriesIPs/IPLIST.csv",io_read);
    fread(IPFile,Text,sizeof(Text),false);
    while(strlen(Text)>0){
        GetFileData(Text);
        start=strval(FileData[0]);
        end=strval(FileData[1]);
        if(ipf>=start && ipf<=end){
            format(Country,sizeof(Country),"%s(%s)",FileData[6],FileData[5]);
            fclose(IPFile);
            return 1;
        }
        fread(IPFile,Text,sizeof(Text),false);
    }
    fclose(IPFile);
    return 1;
}
Reply
#9

As long as you DID define params[3] globally I don't know what you are doing wrong, cause I can see nowhere params[3] being defined.
Reply
#10

Quote:
Originally Posted by Anteino
Посмотреть сообщение
As long as you DID define params[3] globally I don't know what you are doing wrong, cause I can see nowhere params[3] being defined.
Me either.
Shall I put this code somewhere else in the mode? Cause it seems like the problem is in my mode and not in the stocks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)