pics & video added

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 Menufunction onScriptLoad()
{
LoadTunning();
}
function LoadTunning()
{
local q = QuerySQL( Vehicles, "SELECT * FROM Creation" ), i = 0;
while( GetSQLColumnData( q, 0 ) )
{
local Model= GetSQLColumnData( q, 1 );
QuerySQL( Vehicles, "INSERT INTO Tunning ( ID, Acceleration, MaxSpeed, NumberGears, Flags ) VALUES ( '" + GetSQLColumnData( q, 0 ) + "','" + GetHandlingRule( GetSQLColumnData( q, 1 ), 14) + "','" + GetHandlingRule(GetSQLColumnData( q, 1 ), 13) + "', '" + GetHandlingRule(GetSQLColumnData( q, 1 ), 12) + "', '" + GetHandlingRule(GetSQLColumnData( q, 1 ), 28) + "' )" );
GetSQLNextRow( q );
i++;
}
print("Writen ("+i+")");
return 0;
}
[/noae][/noae][/noae][/noae][/noae][/noae]function onScriptLoad()
{
I_KEY <- BindKey(true, 0x49, 0, 0);
ENTER <- BindKey(true, 0x0D, 0, 0);
teleport <- array(GetMaxPlayers(),0);
Customer <- CreateCheckpoint(null, 0, true, Vector(-846.449, -902.177, 11.1034), RGB(0, 0, 200), 3.0);
Marker_Customer <- CreateMarker(0, Vector( -846.449, -902.177, 11.1034 ), 2, RGB(41, 182, 0), 20 );
//KrLoz script's db
Vehicles <- ConnectSQL( "scripts/Vehicles.db" );
QuerySQL(Vehicles, "CREATE TABLE IF NOT EXISTS Creation ( id NUMERIC, model NUMERIC, x NUMERIC, y NUMERIC, z NUMERIC, col1 NUMERIC, col2 NUMERIC, world NUMERIC, angle NUMERIC)" );
QuerySQL(Vehicles, "CREATE TABLE IF NOT EXISTS Sale ( ID NUMERIC, Cost NUMERIC, Owner TEXT, Shared TEXT, Shared2 TEXT )" );
LoadVehicles();
QuerySQL(Vehicles, "create table if not exists Tunning ( ID NUMERIC, Acceleration FLOAT, MaxSpeed FLOAT, NumberGears NUMERIC, Flags Numeric ) ");
tuni <- array(GetMaxPlayers(), null);
}
function onScriptUnload()
{
}
function LoadVehicles()
{
local q = QuerySQL( Vehicles, "SELECT * FROM Creation" ), i = 0;
while( GetSQLColumnData( q, 0 ) )
{
local
Model= GetSQLColumnData( q, 1 ),
X= GetSQLColumnData( q, 2 ),
Y= GetSQLColumnData( q, 3 ),
Z= GetSQLColumnData( q, 4 ),
Col1= GetSQLColumnData( q, 5 ),
Col2= GetSQLColumnData( q, 6 ),
World= GetSQLColumnData( q, 7 ),
Angle= GetSQLColumnData( q, 8 );
CreateVehicle( Model, World, Vector(X, Y, Z), Angle, Col1, Col2 );
GetSQLNextRow( q );
i++;
}
print("Vehicles Count ("+i+")");
return 0;
}
// ========================================== V E H I C L E E V E N T S =============================================
function onPlayerEnterVehicle( player, vehicle, door )
{
local veh = player.Vehicle;
local q = QuerySQL(Vehicles, "SELECT * FROM Tunning WHERE ID = '" + vehicle.ID + "'");
if (q)
{
veh.SetHandlingData(14, GetSQLColumnData(q, 1));
veh.SetHandlingData(13, GetSQLColumnData(q, 2));
veh.SetHandlingData(12, GetSQLColumnData(q, 3));
veh.SetHandlingData(28, GetSQLColumnData(q, 4));
}else
{
local veh = vehicle.ID;
QuerySQL( Vehicles, "INSERT INTO Tunning ( ID, Acceleration, MaxSpeed, NumberGears, Flags ) VALUES ( '" + veh + "','" + GetHandlingRule( vehicle.Model, 14) + "','" + GetHandlingRule(vehicle.Model, 13) + "', '" + GetHandlingRule(vehicle.Model, 12) + "', '" + GetHandlingRule(vehicle.Model, 28) + "' )" );
}
}
function IsVehForSale( id )
{
local q = QuerySQL( Vehicles, "SELECT * FROM Sale WHERE ID='"+id+"'" );
local own = GetSQLColumnData( q, 2 );
if ( own == "Unowned" ) return 1;
else return 0;
}
function IsOwnerOrSharer( veh, player )
{
local q = QuerySQL( Vehicles, "SELECT * FROM Sale WHERE ID='"+veh.ID+"'" );
local owner = GetSQLColumnData( q, 2 );
local sha = GetSQLColumnData( q, 3 );
local sha2 = GetSQLColumnData( q, 4 );
if ( ( owner == player.Name ) || ( sha == player.Name ) || ( sha2 == player.Name ) ) return 1;
else return 0;
}
function IsVehicleOwner( veh, player )
{
local q = QuerySQL( Vehicles, "SELECT * FROM Sale WHERE ID='"+veh.ID+"'" );
local owner = GetSQLColumnData( q, 2 );
if ( owner == player.Name ) return 1;
else return 0;
}
//================================= O T H E R F U N C T I O N S ==========================================================
function GetTok(string, separator, n, ...)
{
local m = vargv.len() > 0 ? vargv[0] : n,
tokenized = split(string, separator),
text = "";
if (n > tokenized.len() || n < 1) return null;
for (; n <= m; n++)
{
text += text == "" ? tokenized[n-1] : separator + tokenized[n-1];
}
return text;
}
function NumTok(string, separator)
{
local tokenized = split(string, separator);
return tokenized.len();
}
function GetPlayer( plr )
{
if ( plr )
{
if ( IsNum( plr ) )
{
plr = FindPlayer( plr.tointeger() );
if ( plr ) return plr;
else return false;
}
else
{
plr = FindPlayer( plr );
if ( plr ) return plr;
else return false;
}
}
else return false;
}
// =========================================== P I C K U P E V E N T S ==============================================
// =========================================== P L A Y E R E V E N T S ==============================================
function onPlayerCommand( player, cmd, text )
{
if ( cmd =="pos")
{
Message( ""+ player.Pos.x + ", " + player.Pos.y + ", " + player.Pos.z);
}
else if ( cmd == "cag")
{
local veh = FindVehicle(1);
veh.Pos = Vector( player.Pos.x + 1, player.Pos.y+1, player.Pos.z );
}
else if(cmd == "bring") {
if(!text) MessagePlayer( "Error - Correct syntax - /bring <Name/ID>' !",player );
else {
local plr = FindPlayer(text);
if(!plr) MessagePlayer( "Error - Unknown player !",player);
else {
plr.Pos = player.Pos;
MessagePlayer( "[ /" + cmd + " ] " + plr.Name + " was sent to " + player.Name, player );
}
}
}
/*
else if(cmd == "exec")
{
if( !text ) MessagePlayer( "Error - Syntax: /exec <Squirrel code>", player);
else
{
try
{
local script = compilestring( text );
script();
}
catch(e) MessagePlayer( "Error: " + e, player);
}
}
*/
return 1;
}
function onClientScriptData( player )
{
local int = Stream.ReadInt(),
string = Stream.ReadString();
Message(""+ string);
if(string == "r1")
{
if( player.Vehicle)
{
local veh = player.Vehicle;
local q = QuerySQL(Vehicles, "SELECT * FROM Tunning WHERE ID = '" + veh.ID + "'");
if (q)
{
PlaySound(player.World, 50012, player.Pos);
veh.SetHandlingData(13, 1.0);
QuerySQL( Vehicles,"UPDATE Tunning SET Acceleration='"+ 10.0 +"' WHERE ID='"+player.Vehicle.ID+"'"); // 0.0 value is the new value of car's acceleration you need to change it with your values
QuerySQL( Vehicles,"UPDATE Tunning SET MaxSpeed='"+ 10.0 +"' WHERE ID='"+player.Vehicle.ID+"'");// 0.0 value is the new value of car's maxspeed you need to change it with your values
MessagePlayer("Vehicle successfully upgraded",player);
}
}else MessagePlayer("You need to be in a vehicle to do this", player)
}
if(string == "motor2")
{
if( player.Vehicle)
{
local veh = player.Vehicle;
local q = QuerySQL(Vehicles, "SELECT * FROM Tunning WHERE ID = '" + veh.ID + "'");
if (q)
{
veh.SetHandlingData(13, 0.0);
PlaySound(player.World, 50011, player.Pos);
QuerySQL( Vehicles,"UPDATE Tunning SET MaxSpeed='"+ 0.0 +"' WHERE ID='"+player.Vehicle.ID+"'");// 0.0 value is the new value of car's maxspeed you need to change it with your values
MessagePlayer("Vehicle successfully upgraded",player);
}
}else MessagePlayer("You need to be in a vehicle to do this", player)
}
if(string == "motor3")
{
if( player.Vehicle)
{
local veh = player.Vehicle;
local q = QuerySQL(Vehicles, "SELECT * FROM Tunning WHERE ID = '" + veh.ID + "'");
if (q)
{
veh.SetHandlingData(13, 0.0);
PlaySound(player.World, 50011, player.Pos);
QuerySQL( Vehicles,"UPDATE Tunning SET MaxSpeed='"+ 0.0 +"' WHERE ID='"+player.Vehicle.ID+"'"); // 0.0 value is the new value of car's maxspeed you need to change it with your values
MessagePlayer("Vehicle successfully upgraded",player);
}
}else MessagePlayer("You need to be in a vehicle to do this", player)
}
if(string == "speed1")
{
if( player.Vehicle)
{
local veh = player.Vehicle;
local q = QuerySQL(Vehicles, "SELECT * FROM Tunning WHERE ID = '" + veh.ID + "'");
if (q)
{
veh.SetHandlingData(14, 0.0);
PlaySound(player.World, 50011, player.Pos);
QuerySQL( Vehicles,"UPDATE Tunning SET Acceleration='"+ 0.0 +"' WHERE ID='"+player.Vehicle.ID+"'"); // 0.0 value is the new value of car's acceleration you need to change it with your values
MessagePlayer("Vehicle successfully upgraded",player);
}
}else MessagePlayer("You need to be in a vehicle to do this", player)
}
if(string == "speed2")
{
if( player.Vehicle)
{
local veh = player.Vehicle;
local q = QuerySQL(Vehicles, "SELECT * FROM Tunning WHERE ID = '" + veh.ID + "'");
if (q)
{
veh.SetHandlingData(14, 0.0);
PlaySound(player.World, 50011, player.Pos);
QuerySQL( Vehicles,"UPDATE Tunning SET Acceleration='"+ 0.0 +"' WHERE ID='"+player.Vehicle.ID+"'"); // 0.0 value is the new value of car's acceleration you need to change it with your values
MessagePlayer("Vehicle successfully upgraded",player);
}
}else MessagePlayer("You need to be in a vehicle to do this", player)
}
if(string == "speed3")
{
if( player.Vehicle)
{
local veh = player.Vehicle;
local q = QuerySQL(Vehicles, "SELECT * FROM Tunning WHERE ID = '" + veh.ID + "'");
if (q)
{
veh.SetHandlingData(14, 0.0);
PlaySound(player.World, 50011, player.Pos);
QuerySQL( Vehicles,"UPDATE Tunning SET Acceleration='"+ 0.0 +"' WHERE ID='"+player.Vehicle.ID+"'"); // 0.0 value is the new value of car's acceleration you need to change it with your values
MessagePlayer("Vehicle successfully upgraded",player);
}
}else MessagePlayer("You need to be in a vehicle to do this", player)
}
// After this, is yours you can add anything you want. for car Handling list http://wiki.thijn.ovh/index.php?title=Changing_Vehicle_Handling
}
// ====================================== C H E C K P O I N T E V E N T S ==========================================
function onCheckpointEntered( player, checkpoint )
{
teleport[player.ID]=checkpoint.ID;
if ( teleport[player.ID] == 0)
{
Announce("Press I", player, 0);
}
}
function onCheckpointExited( player, checkpoint )
{
}
// =========================================== B I N D E V E N T S =================================================
function onKeyUp( player, key )
{
if (key == I_KEY)
{
switch(teleport[player.ID])
{
case 0:
if( player.Vehicle)
{
local data = Stream();
data.StartWrite( );
data.WriteInt(42);
Stream.SendStream(player)
}
break;
}
}
}
// ================================== E N D OF O F F I C I A L E V E N T S ======================================
function SendDataToClient( player, ... )
{
if( vargv[0] )
{
local byte = vargv[0],
len = vargv.len();
if( 1 > len ) devprint( "ToClent <" + byte + "> No params specified." );
else
{
Stream.StartWrite();
Stream.WriteByte( byte );
for( local i = 1; i < len; i++ )
{
switch( typeof( vargv[i] ) )
{
case "integer": Stream.WriteInt( vargv[i] ); break;
case "string": Stream.WriteString( vargv[i] ); break;
case "float": Stream.WriteFloat( vargv[i] ); break;
}
}
if( player == null ) Stream.SendStream( null );
else if( typeof( player ) == "instance" ) Stream.SendStream( player );
else devprint( "ToClient <" + byte + "> Player is not online." );
}
}
else devprint( "ToClient: Even the byte wasn't specified..." );
}
[/noae][/noae][/noae][/noae][/noae][/noae]Quote from: habi on Jul 14, 2020, 08:09 AMI can understand. But can you explain your work a little.i woke up now,
We touch some pickup and this picture appear on screen?
Quote from: Sebastian on Jul 14, 2020, 10:37 AMI recommend you to reupload it, but with the things you have done only. No need to upload the server.exe and other files which everybody should have by standard.
PS: The picture looks good!
Quote from: habi on Jul 13, 2020, 01:57 PMnice, no sound from video?Game sounds off in my game
function onScriptLoad()
{
thirst <- array( 1000, 100 );
}
function onPlayerRequestSpawn( player )
{
thirst[ player.ID ] = 100;
}
function onPlayerSpawn( player )
{
local th = thirst[ player.ID ]
local data = Stream();
data.StartWrite( );
data.WriteInt( 42 );
data.WriteString(th);
data.SendStream( player );
}
function Thirst()
{
for (local i = 0; i <GetMaxPlayers (); i ++)
{
local player = FindPlayer (i);
if (player)
{
if (player.IsSpawned)
{
if ( thirst[ player.ID ] >= 1 )
{
thirst[ player.ID ] -= 5;
local th = thirst[ player.ID ]
local data = Stream();
data.StartWrite( );
data.WriteInt( 42 );
data.WriteString(th);
data.SendStream( player );
}
if ( player.Vehicle )
{
thirst[ player.ID ] -= 0.00001;
local th = thirst[ player.ID ]
local data = Stream();
data.StartWrite( );
data.WriteInt( 42 );
data.WriteString(th);
data.SendStream( player );
}
else if ( thirst[ player.ID ] < 1 )
{
player.Speed = Vector( 0, 0, 0 );
player.Health -=100;
local th = thirst[ player.ID ]
local data = Stream();
data.StartWrite( );
data.WriteInt( 42 );
data.WriteString(th);
data.SendStream( player );
}
}
if ( player.Health == 1 )
{
thirst[ player.ID ] -= 0.001;
local th = thirst[ player.ID ]
local data = Stream();
data.StartWrite( );
data.WriteInt( 42 );
data.WriteString(th);
data.SendStream( player );
}
}
}
}
function onTimeChange(oldHour, oldMin, newHour, newMin)
{
switch( newMin )
{
case 0:
Thirst( );
break;
case 10:
Thirst( );
break;
case 20:
case 30:
case 40:
case 50:
Thirst( );
break;
}
}
[/noae][/noae][/noae][/spoiler] Thirstu <- 100;
Peace <-
{
Tbar = null
Tlabel = null
Th = 100
}
function Server::ServerData(stream)
{
local StreamReadInt = stream.ReadInt(),
StreamReadString = stream.ReadString();
switch (StreamReadInt.tointeger())
{
case 42: local data = StreamReadString; Dude(); ::Thirstu = StreamReadString.tofloat(); break;
}
}
function Dude(){
Peace.Tbar = GUIProgressBar();
Peace.Tbar.Pos = VectorScreen( sX * 0.0, sY*0.0 );
Peace.Tbar.Size = VectorScreen( sX * 0.08, sY * 0.025 );
Peace.Tbar.StartColour = Colour( 40, 255, 40 );
Peace.Tbar.EndColour = Colour( 180, 110, 110 );
Peace.Tbar.MaxValue = 100;
Peace.Tbar.BackgroundShade = 0.3;
Peace.Tbar.Thickness = 2;
Peace.Tlabel = GUILabel( );
Peace.Tlabel.Text = "Thirst";
Peace.Tlabel.Pos = VectorScreen( sX * 0.0, sY*-0.01 );
Peace.Tlabel.FontSize = 24;
Peace.Tlabel.FontName = "Squada One";
Peace.Tlabel.TextColour = Colour( 255, 255, 255 );
Peace.Tbar.AddChild( Peace.Tlabel );
Peace.Tbar.Value = ::Thirstu;
Peace.Th = ::Thirstu;
Peace.Tlabel.Text = "Thirst";
Peace.Tlabel.FontSize = 12;
Peace.Tlabel.FontName = "Squada One";
}
[/noae][/noae][/noae][/spoiler]Quote from: Alpays on Jul 12, 2020, 04:32 PMmind f--kQuote from: Sonmez on Jul 12, 2020, 01:40 PMQuote from: SonmezTR on Jul 10, 2020, 12:17 PMWhat is SetGreenScanLines please someone explain guys. :sWho the f**is this guy?
you
Quote from: MEGAMIND on Feb 21, 2020, 03:02 PMQuote from: habi on Feb 17, 2020, 02:17 PMgoogle how to port forwardhttps://www.youtube.com/watch?v=7FqbZBwN_Lg
then check eg. https://www.canyouseeme.org/ port 8192
the server which runs on your computer sends data to internet through 8192 port, and if it is 'not port forwarded', the data will not reach internet and no people over internet can see the server.
Quote from: Sebastian on Jul 29, 2019, 11:06 PMIdk why, but this snippet made me smile, in the good way.![]()
Quote from: Doom_Kill3R on Jul 31, 2019, 05:27 AMQuote from: KrooB on Jul 31, 2019, 12:48 AMyou can edit your sound and you can make it 1second you don't have to script itBad advice.