Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Pr0Ankit

#1
Quote from: jayant on May 27, 2015, 04:32 AMelse if( cmd == "fix" )
{
   local veh = player.Vehicle;
   if (!veh) MessagePlayer("[#ffffff]You must be in a vehicle to fix your vehicle", player );
 else if (veh.Health == 1000) MessagePlayer("Your vehicle is already in excellent condition." ,player);
  else
  {
  veh.Health = 1000;
  veh.Damage = 0;
  MessagePlayer("[#ffffff]Your vehicle is fixed now",player);
  }
}
 
Notice that you have defined veh = player.Vehicle, so you will use veh and that code gives error because there it is defined as Vehicle = player.Vehicle..So, to fix you will use if ( !Vehicle)

Hi,
So I have to also change veh.health == 1000.0 to Vehicle.health == 1000.0 ? and also veh.Fix() to Vehicle.Fix() ?
But the veh.fix works idk why does it needs to be changed only in that particular line which checks if the player is in vehicle ?


Thanks and Best Regards,
Pr0Ankit
#2
Hi Everyone,

After learning what you all have posted here and seeing the example I came out with something :-


else if( cmd == "fix" )
{
   local Vehicle = player.Vehicle;
   if ( !veh ) MessagePlayer("[#06FA16]You must be in a vehicle to fix your vehicle", player );  <---- This line gives error (Line 269)
   else if (Vehicle.Health == 1000.0) MessagePlayer("Your vehicle is already in excellent condition." ,player);
   else
   {
  veh.Fix();
  player.Cash -= 200;
  MessagePlayer("[#06FA16]Your car has been fixed for 200$", player);
   }
}



EDIT : The line above which checks if the player is in veh or not it gives error.

images hosting
#3
Quote from: Steam on May 26, 2015, 03:43 AMYou cannot find a syntax in squirrel since squirrel codes are done using Notepad c++.
You can have a look in the wiki for all the syntax currently available for squirrel over here.

The error has occured because you have used MessagePlayer it is only for a player (private messages), so you need to use it as follows:

MessagePlayer("#06FA16] Your car has been fixed.", player);

Hi,

So you mean that I have not made any mistakes by only adding the first line or I have to define the variable first with local and then use it as PlayerX told me ?

Thanks and Best Regards,
Pr0Ankit
#4
Hi,

As you all have noticed in vcmp 0.3 pawno tool. You see all the syntax or things which can be used in script in the right hand side like ClientMessage,Showplayer,etc.
How do i know which syntax i can use for squirrel ?

I tried guessing and making a fix command.

else if( cmd == "fix" )
{
      [ player.SetCarHealth ] = 1000;
  MessagePlayer("#06FA16] Your car has been fixed.");

}

But this gives an error. So please guys instead of giving me this full code. Please tell me what are the syntax and what mistake i made so I can fix it myself and learn from my mistakes.

Thanks and Best Regards,
Pr0Ankit

#5
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
#6
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.
#7
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
#8
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
#9
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
#10
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
#11
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
#12
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
#13
Hello All,

I am new to Squirrel Scripting. Althought I am an old player of vcmp . I know some pawn scripting but I am new to Squirrel.
So, Can anyone tell me where can i learn squirrel scripting and mysql database. I want to make my server with admin commands and level system. So of course i need to connect mysql db to my server and then I think I have to upload my server to a vps and and allow my forum to check the webstats.db file.
P.S :- I'm not asking for giving me a script, code or any kind of direct help. Please guide me to the manual and I will do it myself.

Best Regards,
Pr0Ankit