how we can create a system with which owners can lock there's cars and unlock
Quote from: Noob on Oct 22, 2015, 09:00 PMhow we I can create a system with which owners can lock there's cars and unlock
vehicle.IsLock = bool; //true or false...
Like this
else if (cmd == "lock")
{
if (!owner) messageplayer ("you are not the buyer" ,player)
else
{
vehicle.islock = true
messageplayer ("locked" ,player)
}
}
If you got a full vehicle system you can easily implement above cmd you mentioned.
!owner
...
understand what you did wrong there
ya i fix it with that line
else if ( GetSQLColumnData( q, 2 ) != player.Name ) MessagePlayer( "you are not buyer..", player );
Quote from: Zeeshan.Bhatti on Oct 22, 2015, 09:02 PMQuote from: Noob on Oct 22, 2015, 09:00 PMhow we I can create a system with which owners can lock there's cars and unlock
soory mis typed i post from mobile
can we save car locks on or off in db if yes then how
In your database you just need to make one more column,name it,for example,status. Make a simple command,in it query and SELECT your database and just toggle it on/off. [ You can see nogoto on command for an example ]. And yes do not forget this - vehicle.IsLock = true/false;
Quote from: Noob on Oct 23, 2015, 04:24 PMcan we save car locks on or off in db if yes then how
Must you ask that question? I supposed you want someone to give you some code and you just to copy and paste it. Then you to come here a couple more times because you can't even copy the code properly. And you know why? Coz you don't know sh!t.
no S.L.C I just ask how dont understand me wrong
And what did he tell?
That's the meaning of How :P
Btw, see
@jayant 's post
ya i understand on
@jayant post is very help full
Try to do it then.
If you find any error, you're free to post them, and we're ready to help you.
Good Luck!
error can not convert string line # 427local veh = FindVehicle( text.tointeger() );
else if ( cmd == "lock" )
{
local q = QuerySQL( db, "SELECT * FROM Cars WHERE rowid LIKE '" + text + "'" );
if ( !player.IsSpawned ) ePrivMessage( "[Error] - You haven't spawned yet..", player );
else if ( !text ) MessagePlayer( "Usage: /"+cmd+" [Vehicle/ID]", player );
else {
local veh = FindVehicle( text.tointeger() );
if ( !veh ) ePrivMessage( "[Error] - Invalid veh / ID", player );
else if ( !IsOwnerOrSharer( veh, player ) ) MessagePlayer(RED+"** [Error]: "+ORANGE+"You don't owned this vehicle!", player );
else {
if ( text == "on" )
{
if ( status[ player.ID ].Vehicle.Locked ) MessagePlayer( "** >> Locked-Vehicle: " + GetVehicleNameFromModel( veh.Model ) + "." , player )
else
{
status[ player.ID ].Vehicle.Locked = true;
ePrivMessage( "locked...", player );
}
}
}
}
Try its untested wrote from mobile, please let me know if it throw any errorelse if ( cmd == "lock" )
{
if ( !player.IsSpawned ) ePrivMessage( "[Error] - You haven't spawned yet..", player );
else if ( !text ) MessagePlayer( "Usage: /"+cmd+" [Vehicle/ID]", player );
else {
local veh = FindVehicle(GetTok(text," ",1)), mode = GetTok(text," ",2);
if ( !IsNum(veh) ) ePrivMessage( "[Error] - Invalid veh / ID", player );
else if(mode != "on" || mode !="off") ePrivMessage( "[Error] - Mode must be on/off", player );
else
{
local q = QuerySQL( db, "SELECT * FROM Cars WHERE rowid LIKE '" + veh + "'" );
if ( !IsOwnerOrSharer( veh, player ) ) MessagePlayer(RED+"** [Error]: "+ORANGE+"You don't owned this vehicle!", player );
else {
if ( mode == "on" )
{
if ( veh.Locked == true ) MessagePlayer("Error - This Veh Is Already Locked",player);
else
{
veh.Locked = true;
MessagePlayer( "** >> Locked-Vehicle: " + GetVehicleNameFromModel( veh.Model ) + "." , player );
}
}
else if( mode == "off")
{
if ( veh.Locked == false ) MessagePlayer("Error - This Veh Is Already Unlocked",player);
else
{
veh.Locked = false;
ePrivMessage( "Unlocked...", player);
}
}
}
}
}
}
onplayercommand one parameter has invalid type expected string integer no specific line
Quote from: Noob on Oct 24, 2015, 05:51 PMonplayercommand one parameter has invalid no specific line
How you using it., the actual syntax is /lock VehID on/off
i using with that syntax which you tell but error
Please post an screenshot of console error
(https://forum.vc-mp.org/proxy.php?request=http%3A%2F%2Fi59.tinypic.com%2F4rupgn.png&hash=a6198e3447bbee76aac6c2ae52f01eef165fffca)
Remove the try catch block around your onPlayerCommand...
not woking now giving error in this line local veh = FindVehicle(GetTok(text," ",1)), mode = GetTok(text," ",2);
Use this code it is tested
else if ( cmd == "lock" )
{
if ( !player.IsSpawned ) MessagePlayer( "[Error] - You haven't spawned yet..", player );
else if (!text) MessagePlayer("Invalid Syntax, use /lock ID",player);
else
{
if (!IsNum(text)) MessagePlayer("ID must be Integer",player);
else if (!IsOwnerOrSharer(veh, player)) MessagePlayer("You aren't sharer or owner of this vehicle",player);
else
{
local Veh = FindVehicle(text.tointeger());
if (Veh.Locked == true)
{
Veh.Locked = false;
MessagePlayer("Vehicle unlocked",player);
}
else{
Veh.Locked = true;
MessagePlayer("Vehicle locked",player);
}
}
}
}