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 Menuelse if ( (cmd == "carforsale") || (cmd == "carsforsale") )
{
local V2="";
local V=false;
for( local VehicleID = 0; VehicleID <= 1000; VehicleID++ )
{
local q = QuerySQL( Vehicles, "SELECT * FROM Sale WHERE ID='"+VehicleID+"'" );
local owner = GetSQLColumnData( q, 2 );
if("Unowned" == owner)
{
V=true;
V2+=""+VehicleID+",";
}
}
if (V==true) MessagePlayer("Vehicles ID: "+V2+"",player)
if (V==false) MessagePlayer( "No cars for sale.", player );
}
else if ( cmd == "setowner" )
{
if ( stats[ player.ID ].Reg == false ) return MessagePlayer( "[#95fcff]WARN > [#E0E0E0]You're not registered.", player );
else if ( stats[ player.ID ].Log == false ) return MessagePlayer( "[#95fcff]WARN > [#E0E0E0]You're not Logged-In", player );
else if ( !text ) MessagePlayer("[#95fcff]WARN > [#E0E0E0]Command: /"+cmd+" <Nick/ID> <Veh/ID>", player);
else if ( !IsOwnerOrSharer( veh, player ) ) MessagePlayer("[#95fcff]WARN > [#E0E0E0]This vehicle is not belong to you", player );
else {
local plr = GetPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) MessagePlayer("[#95fcff]WARN > [#E0E0E0]Unkown Player.", player );
else {
local veh = FindVehicle( GetTok( text, " ", 2 ).tointeger() );
if ( !veh ) MessagePlayer("[#95fcff]WARN > [#E0E0E0]Unkown vehicle ID", player );
else {
local q = QuerySQL( Vehicles, "SELECT * FROM Sale WHERE ID='"+veh.ID+"'" );
QuerySQL( Vehicles, "UPDATE Sale SET Owner='"+player.Name+"' WHERE ID='"+veh.ID+"'" );
Message( "[#95fcff]INFO > [#E0E0E0]Admin ["+player.Name+"] gave, Vehicle ID: "+veh.ID+" New Owner ["+plr.Name+"]" );
}
}
}
}
local
full codefunction onPlayerEnterVehicle( player, veh, isPassenger )
{
local VehicleID2 = QuerySQL( Vehicles, "SELECT * FROM Sale" );
if(VehicleID2)
{
local q = QuerySQL( Vehicles, "SELECT * FROM Sale WHERE ID='"+veh.ID+"'" );
local
Cost=GetSQLColumnData( q, 1 ),
Owner=GetSQLColumnData( q, 2 ),
Share=GetSQLColumnData( q, 3 ),
Sharer=GetSQLColumnData( q, 4 );
MessagePlayer( "ID: "+veh.ID+". Cost: "+Cost+".", player );
MessagePlayer( "Owner: "+Owner+". Shares: "+Share+" & "+Sharer+".", player );
}
}
function LoadVehicles()
{
local q = QuerySQL( Vehicles, "SELECT * FROM Creation" ), i = 0;
if( q )
{
while( GetSQLColumnData( q, 0 ) )
{
i++;
}
}
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;
}
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;
}
Vehicles <- ConnectSQL( "Databases/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 )" );
Quote from: umar4911 on Apr 13, 2020, 12:15 PMand what is the error being displayed?there is no error when i open the console.
function TopKillers()
{
local
query = "SELECT Name, Mato FROM Accounts ORDER BY Name DESC LIMIT 5", //Top 5
q,
Name1, Name2, Name3, Name4, Name5,
Top1, Top2, Top3, Top4, Top5, i = 1;
q = QuerySQL( db, query );
while( GetSQLColumnData( q, 0 ) )
{
switch(i)
{
case 1:
Name1 = GetSQLColumnData( q, 0 );
Top1 = GetSQLColumnData( q, 1 );
break;
case 2:
Name2 = GetSQLColumnData( q, 0 );
Top2 = GetSQLColumnData( q, 1 );
break;
case 3:
Name3 = GetSQLColumnData( q, 0 );
Top3 = GetSQLColumnData( q, 1 );
break;
case 4:
Name4 = GetSQLColumnData( q, 0 );
Top4 = GetSQLColumnData( q, 1 );
break;
case 5:
Name5 = GetSQLColumnData( q, 0 );
Top5 = GetSQLColumnData( q, 1 );
break;
}
GetSQLNextRow( q );
i++;
}
FreeSQLQuery(q);
Message("[#00ffff]Top 5 Matadores | Killers[#000000]: [#00bfff]" + Name1 + " [#ffffff]: [#00ff00]" + Top1 + ", [#00bfff]" + Name2 + " [#ffffff]: [#00ff00]" + Top2 + ", [#00bfff]" + Name3 + " [#ffffff]: [#00ff00]" + Top3 + ", [#00bfff]" + Name4 + " [#ffffff]: [#00ff00]" + Top4 + ", [#00bfff]" + Name5 + " [#ffffff]: [#00ff00]" + Top5 + "");
}