Vice City: Multiplayer

Server Development => Scripting and Server Management => Topic started by: Pr0Ankit on May 22, 2015, 12:48 AM

Title: Load ITC does not exists along with other errors.
Post by: Pr0Ankit on May 22, 2015, 12:48 AM
Hello Everyone,

I am new to Squirrel Scripting and currently I'm putting skins,team and messages in my server.
But I am stuck at a point. Please help me.
I don't know which portion of code I should put here for more details so I'm putting a screenshot of my error.

http://pasteboard.co/DI8vdNA.png

Thanks,
Pr0Ankit
Title: Re: Load ITC does not exists along with other errors.
Post by: Honey on May 22, 2015, 12:55 AM
it looks like an index error, You're probably trying to use a function which doesn't exist.
Title: Re: Load ITC does not exists along with other errors.
Post by: Pr0Ankit on May 22, 2015, 02:48 AM
Hello Honey,

Thanks for helping me.
Actually I'm using Country Detector by Matheus . I don't know where I am making mistake but the country detector seems to be working fine. When I connect to server it says Connexao Local. My code is here
function
onScriptLoad()
{
dofile( "IPtoCountry/IPtoCountry.nut" );
secondarydb <- ConnectSQL( "IpToCountry.db" );
Load_ITC( "IPtoCountry/" ); // Loading the detector
}

Thanks,
Pr0Ankit
Title: Re: Load ITC does not exists along with other errors.
Post by: EK.IceFlake on May 22, 2015, 03:45 AM
Quote from: Pr0Ankit on May 22, 2015, 02:48 AMHello Honey,

Thanks for helping me.
Actually I'm using Country Detector by Matheus . I don't know where I am making mistake but the country detector seems to be working fine. When I connect to server it says Connexao Local. My code is here
function
onScriptLoad()
{
dofile( "IPtoCountry/IPtoCountry.nut" );
secondarydb <- ConnectSQL( "IpToCountry.db" );
Load_ITC( "IPtoCountry/" ); // Loading the detector
}

Thanks,
Pr0Ankit
Is there any "function Load_ITC"? Search for it if not thenyou have to put it there by looking at the detector again.
Title: Re: Load ITC does not exists along with other errors.
Post by: Pr0Ankit on May 22, 2015, 09:24 AM
Quote from: NE.CrystalBlue on May 22, 2015, 03:45 AM
Quote from: Pr0Ankit on May 22, 2015, 02:48 AMHello Honey,

Thanks for helping me.
Actually I'm using Country Detector by Matheus . I don't know where I am making mistake but the country detector seems to be working fine. When I connect to server it says Connexao Local. My code is here
function
onScriptLoad()
{
dofile( "IPtoCountry/IPtoCountry.nut" );
secondarydb <- ConnectSQL( "IpToCountry.db" );
Load_ITC( "IPtoCountry/" ); // Loading the detector
}

Thanks,
Pr0Ankit
Is there any "function Load_ITC"? Search for it if not thenyou have to put it there by looking at the detector again.
Hi,
I solved this issue by deleting the loaditc line as i did not had any such function in my script. And what are all those warnings in my script ?
Thx ,
Pr0Ankit
Title: Re: Load ITC does not exists along with other errors.
Post by: Honey on May 22, 2015, 10:24 AM
Removing won't help you fix the problem. You need these functions for the system to work correctly.

function Load_ITC( path )
{
secondarydb <- ConnectSQL( path + "IpToCountry.db" );
}

function Unload_ITC()
{
    DisconnectSQL( secondarydb );
}

function IpToCountry(IP)
{
local result, query, IPsplit = split( IP, "." );
if ( !secondarydb ) return "Error on db connection";
if ( IP == "127.0.0.1" ) return "Localhost";
if ( IPsplit.len() != 4 ) return "Invalid IP";
result = QuerySQL(secondarydb, "SELECT Country FROM countrydetected WHERE ((" + IPsplit[0].tointeger() + " * 16777216) + (" + IPsplit[1].tointeger() + " * 65536) + (" + IPsplit[2].tointeger() + " * 256) + " + IPsplit[3].tointeger() + ") BETWEEN Ip_From AND Ip_to LIMIT 1");
query = GetSQLColumnData( result, 0 );
if ( !query ) query = "Unknown";
FreeSQLQuery( result );
return query;
}
Title: Re: Load ITC does not exists along with other errors.
Post by: Pr0Ankit on May 22, 2015, 10:54 AM
Quote from: Honey on May 22, 2015, 10:24 AMRemoving won't help you fix the problem. You need these functions for the system to work correctly.

function Load_ITC( path )
{
secondarydb <- ConnectSQL( path + "IpToCountry.db" );
}

function Unload_ITC()
{
    DisconnectSQL( secondarydb );
}

function IpToCountry(IP)
{
local result, query, IPsplit = split( IP, "." );
if ( !secondarydb ) return "Error on db connection";
if ( IP == "127.0.0.1" ) return "Localhost";
if ( IPsplit.len() != 4 ) return "Invalid IP";
result = QuerySQL(secondarydb, "SELECT Country FROM countrydetected WHERE ((" + IPsplit[0].tointeger() + " * 16777216) + (" + IPsplit[1].tointeger() + " * 65536) + (" + IPsplit[2].tointeger() + " * 256) + " + IPsplit[3].tointeger() + ") BETWEEN Ip_From AND Ip_to LIMIT 1");
query = GetSQLColumnData( result, 0 );
if ( !query ) query = "Unknown";
FreeSQLQuery( result );
return query;
}

Quote from: Honey on May 22, 2015, 10:24 AM

Hi,
Thanks again for helping. I have solved out this error by removing the line and the system is working normal. I'm sorry but I could not understand what your code meant as I am a beginner and I am choosing simple and easy snippets to start with.
And what about the warnings which i get ? Why are they causing and another warning which says no custom weapons to load though I have added M6 as weapon4 it does not works. Idk what is the problem.

Thanks and Best Regards,
Pr0Ankit
Title: Re: Load ITC does not exists along with other errors.
Post by: Honey on May 22, 2015, 11:55 AM
alright then,

Basically removing that line didn't fix your problem. Let's suppose your master / sensei asks you to find a box named Load_ITC. You can't find it anywhere so you return to your master and say "I was not able to find this", This happened with your server and when it says index not found so it's something mistyped or missing,  So then Your Master said " Ok nevermind" and there you go, earned nothing. That happens when you remove the lines, Put those function in your functions.nut or wherever you want to and then try this so It can successfully load it. As for the warnings I can't understand what you mean, elaborate
Title: Re: Load ITC does not exists along with other errors.
Post by: MatheuS on May 22, 2015, 04:30 PM
Look This (http://forum.vc-mp.org/?topic=208.0)
Title: Re: Load ITC does not exists along with other errors.
Post by: Thijn on May 22, 2015, 05:05 PM
That load line did just connect to the SQLite database, something he already did in his onScriptLoad. That line is perfectly fine to remove in this case.
Title: Re: Load ITC does not exists along with other errors.
Post by: Pr0Ankit on May 23, 2015, 12:51 AM
Quote from: Thijn on May 22, 2015, 05:05 PMThat load line did just connect to the SQLite database, something he already did in his onScriptLoad. That line is perfectly fine to remove in this case.

Yea i think you are correct Thijn.
function onScriptLoad()
{
dofile( "IPtoCountry/IPtoCountry.nut" );
secondarydb <- ConnectSQL( "IpToCountry.db" ); <------------- SQL Connected here in this line so extra line is not needed.
}

function onPlayerJoin( player )
{
Message("[#DF0101]"+player.Name+" joined the server.");
local country = IpToCountry( player.IP );
Message( "[#F5FFFA]"+player.Name+" Country: [#06FA16]"+country+"[#F5FFFA]." ); <----- How do i change this line to say Pr0Ankit joined from Connexao Local. And why it says Connexao ? Whenver i try to add extra words inside quotation It gives error.
}

Thanks,
Pr0Ankit
Title: Re: Load ITC does not exists along with other errors.
Post by: Mashreq on May 23, 2015, 10:01 AM
Can you provide us your IpToCountry function? Probably "Connexao Local" stands for "local" in english since "Connexao Local" is a word in brazilian language.
Title: Re: Load ITC does not exists along with other errors.
Post by: Pr0Ankit on May 23, 2015, 03:19 PM
Quote from: Steam on May 23, 2015, 10:01 AMCan you provide us your IpToCountry function? Probably "Connexao Local" stands for "local" in english since "Connexao Local" is a word in brazilian language.

function onPlayerJoin( player )
{
pstats[ player.ID ] = PlayerClass( player.Name, sqliteDB );
pstats[ player.ID ].Join( player );
Message("[#DF0101]"+player.Name+" joined the server.");
local country = IpToCountry( player.IP );
Message( "[#F5FFFA]"+player.Name+" Country: [#06FA16]"+country+"[#F5FFFA]." );
if(timer_status == false)
                {
                        timer_status = true;
                        meter.Paused = false;
                        print("Timer Resumed");
                }
}

and

this one below is the file iptocountry.nut
function IpToCountry(IP)
{
local result, query, IPsplit = split( IP, "." );
if ( !secondarydb ) return "Error on db connection";
if ( IP == "127.0.0.1" ) return "Conexao Local";
if ( IPsplit.len() != 4 ) return "Invalid IP";
result = QuerySQL(secondarydb, "SELECT Country FROM countrydetected WHERE ((" + IPsplit[0].tointeger() + " * 16777216) + (" + IPsplit[1].tointeger() + " * 65536) + (" + IPsplit[2].tointeger() + " * 256) + " + IPsplit[3].tointeger() + ") BETWEEN Ip_From AND Ip_to LIMIT 1");
query = GetSQLColumnData( result, 0 );
if ( !query ) query = "Nao encontrado";
FreeSQLQuery( result );
return query;
}

I tried checking the database with a sqlite browser and i found that ip 0 was said reserved but I did not find Connexao Local or Local in any of the tables.

Thanks and Best Regards,
Pr0Ankit
Title: Re: Load ITC does not exists along with other errors.
Post by: Mashreq on May 23, 2015, 05:28 PM
Ankit, because you didn't checked it clearly :P
Have a look here in your IpToCountry function:

if ( IP == "127.0.0.1" ) return "Conexao Local";
Change it to
if ( IP == "127.0.0.1" ) return "Local host";
Title: Re: Load ITC does not exists along with other errors.
Post by: MatheuS on May 23, 2015, 10:11 PM
It makes no difference in the script.
Title: Re: Load ITC does not exists along with other errors.
Post by: Kratos_ on May 24, 2015, 02:43 AM
if( IP == "127.0.0.1" ) return "Connexao Local";

Joining server as local host ? Return will simply stop the function from executing further and return the value if condition is satisfied .

You should call the query in an else statement if you're checking if a database isn't connected .
Title: Re: Load ITC does not exists along with other errors.
Post by: Pr0Ankit on May 24, 2015, 04:15 AM
Quote from: Steam on May 23, 2015, 05:28 PMAnkit, because you didn't checked it clearly :P
Have a look here in your IpToCountry function:

if ( IP == "127.0.0.1" ) return "Conexao Local";
Change it to
if ( IP == "127.0.0.1" ) return "Local host";

LOL I did not notice it.  Anyway after fixing that I want it to say Pr0Ankit joined the server from India. but it says Pr0Ankit Country : India. And when i try to change the text under quotation marks it does not works.

EDIT : I fixed it by using this code :

Message( "[#DF0101]"+player.Name+" joined the server from [#06FA16]"+country+"[#F5FFFA]." );

How do i define a colour for my class and a world for vehicles ? it gives me warnings.
Title: Re: Load ITC does not exists along with other errors.
Post by: jayant on May 24, 2015, 10:54 AM
Like this -
<Vehicle model="191" x="338.6310" y="-237.6571" z="29.1708" angle="98.9897" col1="0" col2="0" world="1"/>
And -
Class team="6" skin="49" x="468.2072" y="-1720.5450" z="11.6664" angle="81.3630" weapon1="25" ammo1="999" weapon2="21" ammo2="250" weapon3="32" ammo3=" 500" r="0" g="0" b="255" a="0"/>
I don't know much about r g b a values..But I think the values will be like in here - http://forum.vc-mp.org/?topic=260.0
Title: Re: Load ITC does not exists along with other errors.
Post by: Pr0Ankit on May 25, 2015, 03:27 AM
Quote from: jayant on May 24, 2015, 10:54 AMLike this -
<Vehicle model="191" x="338.6310" y="-237.6571" z="29.1708" angle="98.9897" col1="0" col2="0" world="1"/>
And -
Class team="6" skin="49" x="468.2072" y="-1720.5450" z="11.6664" angle="81.3630" weapon1="25" ammo1="999" weapon2="21" ammo2="250" weapon3="32" ammo3=" 500" r="0" g="0" b="255" a="0"/>
I don't know much about r g b a values..But I think the values will be like in here - http://forum.vc-mp.org/?topic=260.0

What is the world for vehicle and which world should i define for which vehicle ? I should put random numbers or specific world for specific car ?

EDIT : I fixed all my warnings and errors by setting a common world id 1 to all vehicles and different team colours and also ipcountry. Now I am adding some simple commands in my server as I cant go for complex one right now. Thank you everyone for all your kind help and support.

Thanks and Best Regards,
Pr0Ankit