when i type /car its say cose null ; 0x00000 owner null 0x000 sharer nul 0x0000 why
note: the cmds of kakan
car cmdselse if ( cmd == "car" )
{
local plr = GetPlayer( text );
if ( !text ) MessagePlayer( "[Syntax] - /" + cmd + " <Nick/ID>.", player );
else{
if ( !plr ) MessagePlayer( "[Error] - Invalid Nick/ID", player );
else if ( !plr.IsSpawned ) MessagePlayer( "[Error] - This player hasn't spawned.", player );
else
{
local veh = plr.Vehicle;
if ( veh )
{
local vid = veh.ID, hp = veh.Health.tointeger() /10;
MessagePlayer( plr + " is driving a " + GetVehicleNameFromModel( veh.Model ) + " (ID: " + vid + ") (Health: " + hp + "%)", player );
local q = QuerySQL( db, "SELECT * FROM Vehicles WHERE ID='" + veh.ID + "'" );
MessagePlayer( "Vehicle:[ " + GetVehicleNameFromModel( veh.Model ) + " ] Cost:[ " + GetSQLColumnData( q, 1 ) + " ]", player );
MessagePlayer( "ID:[ " + veh.ID + " ] Owner:[ " + GetSQLColumnData( q, 2 ) + " ] Share:[ " + GetSQLColumnData( q, 3 ) + " ]", player );
}
else MessagePlayer( plr + " is currently on foot.", player );
}
}
}
functionfunction onPlayerEnterVehicle( player, vehicle, isPassenger )
{
Announce( "~b~ ID ~p~" + vehicle.ID + ".",player,4);
MessagePlayer("[#1fcecb]Press [#50c878]I[#1fcecb] rapidly to activate boost .",player);
MessagePlayer("[#FFFFFF]Have 100000?.Type /buycar " + vehicle.ID + " to buy this car if its forsale",player);
return 1;
}
function onPlayerExitVehicle( player, vehicle )
{
Announce( "~b~ ID ~p~" + vehicle.ID + ".",player,4);
ePrivMessage("Exit Vehicle ID: " + vehicle.ID + ".",player);
}
Because you havent saved vehicle data in database. Have you created Vehicles table in db? Search EXISTS Vehicles in your .nut files and pass that line here
function VehExists( veh )
{
if ( veh <= GetVehicleCount() ) return 1;
else return 0;
}
in database the table added with cars
Wait.. What? My cmds? I have never done a query on a simple car cmd
Better use this one:-
http://forum.vc-mp.org/?topic=1454.0
And yes, how did you announce the text at the bottom of the screen?(left-bottom)
this script cmds doesnt works for me i try
Forget that,
Just do /iamdoing once while in server then wait 5 minutes
Put this cmd
else if(cmd =="iamdoing")
{
MessagePlayer("doing just wait 5 minutes",player);
QuerySQL(db, "CREATE TABLE IF NOT EXISTS Vehicles ( Cost INT, Owner TEXT, Shared TEXT)");
local Max= GetVehicleCount();
for(local i=0; i < Max; i++)
{
QuerySQL( db, "INSERT INTO Vehicles ( Cost, Owner, Shared) VALUES ( '600000', 'Vice-City', 'None')" );
print("Done ID: "+i.tointeger());
}
}
After 5 minutes restart server then try /car
same error
in db table name is cars and in cmds everywhere vehicles involved is its effect
Yea it effects try changing Vehicles to cars
Quote from: xxkillerxx on Sep 17, 2015, 08:54 AMin db table name is cars and in cmds everywhere vehicles involved is its effect
LOL!! You should tell this at 1st
solved but its credits goto whose ;) :D
i want to when i sited in cars i type /car show me its price owner ect dont ask for nick in which car i sit tell me the car information if i am not in car then ask nick
Quote from: xxkillerxx on Sep 17, 2015, 08:29 AMin database the table added with cars
i tell it but you guys did not take attention i tell you 35 mint ago
To do what you meant, just remove the part where it asks for name. Is that so hard?
Please "learn" to script.
else if ( cmd == "car" )
{
local veh = player.Vehicle;
if ( veh )
{
local vid = veh.ID, hp = veh.Health.tointeger() /10;
MessagePlayer( plr + " is driving a " + GetVehicleNameFromModel( veh.Model ) + " (ID: " + vid + ") (Health: " + hp + "%)", player );
local q = QuerySQL( db, "SELECT * FROM Vehicles WHERE ID='" + veh.ID + "'" );
if ( GetSQLColumnData( q, 1 ) )
{
MessagePlayer( "Vehicle:[ " + GetVehicleNameFromModel( veh.Model ) + " ] Cost:[ " + GetSQLColumnData( q, 1 ) + " ]", player );
MessagePlayer( "ID:[ " + veh.ID + " ] Owner:[ " + GetSQLColumnData( q, 2 ) + " ] Share:[ " + GetSQLColumnData( q, 3 ) + " ]", player );
}
}
}
if i want to check any one else car with nick will it works
Quote from: xxkillerxx on Sep 17, 2015, 09:33 AMif i want to check any one else car with nick will it works
Why can't you try?
I'll fix the errors.
EDIT:
Since I was free, I've coded it.
Dunno if it works or not.
DON'T EXPECT PEOPLE TO CODE FOR YOU EVERY-TIME.
else if ( cmd == "car" )
{
if ( !text )
{
local veh = plr.Vehicle;
if ( veh )
{
local vid = veh.ID, hp = veh.Health.tointeger() /10;
MessagePlayer( plr.Name + " is driving a " + GetVehicleNameFromModel( veh.Model ) + " (ID: " + vid + ") (Health: " + hp + "%)", player );
local q = QuerySQL( db, "SELECT * FROM Vehicles WHERE ID='" + veh.ID + "'" );
if ( GetSQLColumnData( q, 1 ) )
{
MessagePlayer( "Vehicle:[ " + GetVehicleNameFromModel( veh.Model ) + " ] Cost:[ " + GetSQLColumnData( q, 1 ) + " ]", player );
MessagePlayer( "ID:[ " + veh.ID + " ] Owner:[ " + GetSQLColumnData( q, 2 ) + " ] Share:[ " + GetSQLColumnData( q, 3 ) + " ]", player );
}
}
else MessagePlayer( "You're currently on foot.", player );
}
else
{
local plr = FindPlayer( text );
if ( !plr ) MessagePlayer( "[Error] - Invalid Nick/ID", player );
else if ( !plr.IsSpawned ) MessagePlayer( "[Error] - This player hasn't spawned.", player );
else
{
local veh = plr.Vehicle;
if ( veh )
{
local vid = veh.ID, hp = veh.Health.tointeger() /10;
MessagePlayer( plr.Name + " is driving a " + GetVehicleNameFromModel( veh.Model ) + " (ID: " + vid + ") (Health: " + hp + "%)", player );
local q = QuerySQL( db, "SELECT * FROM Vehicles WHERE ID='" + veh.ID + "'" );
if ( GetSQLColumnData( q, 1 ) )
{
MessagePlayer( "Vehicle:[ " + GetVehicleNameFromModel( veh.Model ) + " ] Cost:[ " + GetSQLColumnData( q, 1 ) + " ]", player );
MessagePlayer( "ID:[ " + veh.ID + " ] Owner:[ " + GetSQLColumnData( q, 2 ) + " ] Share:[ " + GetSQLColumnData( q, 3 ) + " ]", player );
}
}
else MessagePlayer( plr.Name + " is currently on foot.", player );
}
}
}
kusnangi help me robin give me a cmds in which we not able to check anyone else car he dont know scripting i think i want which palyer in cars show him his car information dont want nick and for others want nick
Try it
else if ( cmd == "car" )
{
if ( !text )
{
local veh= player.Vehicle; // robinx made mistake here by typing plr.Vehicle
if (veh)
{
local vid = veh.ID, hp = veh.Health.tointeger() /10;
MessagePlayer( player.Name + " is driving a " + GetVehicleNameFromModel( veh.Model ) + " (ID: " + vid + ") (Health: " + hp + "%)", player );
local q = QuerySQL( db, "SELECT * FROM Vehicles WHERE ID='" + veh.ID + "'" );
if ( GetSQLColumnData( q, 1 ) )
{
MessagePlayer( "Vehicle:[ " + GetVehicleNameFromModel( veh.Model ) + " ] Cost:[ " + GetSQLColumnData( q, 1 ) + " ]", player );
MessagePlayer( "ID:[ " + veh.ID + " ] Owner:[ " + GetSQLColumnData( q, 2 ) + " ] Share:[ " + GetSQLColumnData( q, 3 ) + " ]", player );
}
}
else MessagePlayer( "You're currently on foot. So do instead /car <nick/id>", player );
}
else
{
local plr = GetPlayer( text );
if ( !plr ) MessagePlayer( "[Error] - Invalid Nick/ID", player );
else if ( !plr.IsSpawned ) MessagePlayer( "[Error] - This player hasn't spawned.", player );
else
{
local veh = plr.Vehicle;
if ( veh )
{
local vid = veh.ID, hp = veh.Health.tointeger() /10;
MessagePlayer( plr.Name + " is driving a " + GetVehicleNameFromModel( veh.Model ) + " (ID: " + vid + ") (Health: " + hp + "%)", player );
local q = QuerySQL( db, "SELECT * FROM Vehicles WHERE ID='" + veh.ID + "'" );
if ( GetSQLColumnData( q, 1 ) )
{
MessagePlayer( "Vehicle:[ " + GetVehicleNameFromModel( veh.Model ) + " ] Cost:[ " + GetSQLColumnData( q, 1 ) + " ]", player );
MessagePlayer( "ID:[ " + veh.ID + " ] Owner:[ " + GetSQLColumnData( q, 2 ) + " ] Share:[ " + GetSQLColumnData( q, 3 ) + " ]", player );
}
}
else MessagePlayer( plr.Name + " is currently on foot.", player );
}
}
}
Try now
if i gave a valid id its says invalid kusnangi
thanx kusnangi and robin i tryed but i cant so i ask understood