Please Fix these commands with level 9

Started by Adeelkhawaja, Feb 26, 2019, 12:00 PM

Previous topic - Next topic

Adeelkhawaja

an you fix this commands it works only for level 9 otherwise YOu are not allowed for this command


else if (cmd=="changecol")
{
if( !text ) MessagePlayer("Use /"+cmd+" <Veh/ID> <Col1/ID> <Col2/ID>.", player);
else if ( !player.IsSpawned ) MessagePlayer("You need be spawned to use this command.", player );
else {
local TextSplit = split( text, " " ),VehicleID=TextSplit[ 0 ],ColID1=TextSplit[ 1 ],ColID2=TextSplit[ 2 ];
if ( !IsNum(VehicleID)) MessagePlayer("Use /"+cmd+" <Veh/ID> <Col1/ID> <Col2/ID>.", player);
else if ( !IsNum(ColID1)) MessagePlayer("Use /"+cmd+" <Veh/ID> <Col1/ID> <Col2/ID>.", player);
else if ( !IsNum(ColID2)) MessagePlayer("Use /"+cmd+" <Veh/ID> <Col1/ID> <Col2/ID>.", player);
else if ( !FindVehicle(VehicleID.tointeger())) MessagePlayer("Vehicle ID does not exist.",player);
else {
local v=FindVehicle(VehicleID.tointeger())
v.Colour1=ColID1.tointeger();
v.Colour2=ColID2.tointeger();
QuerySQL( Vehicles,"UPDATE Creation SET Col1='"+ColID1+"' WHERE ID='"+VehicleID+"'");
QuerySQL( Vehicles,"UPDATE Creation SET Col2='"+ColID2+"' WHERE ID='"+VehicleID+"'");
Message("Admin ["+player.Name+"] changed the color of the vehicle ID: "+VehicleID+". Colour1 ID: "+ColID1+". Colour2 ID: "+ColID2+".");
}
}
}



Also this


else if (cmd=="changepos") //NOTE: This just works after restart the server.
{
if ( !player.IsSpawned ) MessagePlayer("You need be spawned to use this command.", player );
else if ( player.Vehicle ) MessagePlayer("You must be outside of the vehicle.", player );
else if( !text ) MessagePlayer("Use /"+cmd+" <Veh/ID>", player);
else if (!IsNum(text)) MessagePlayer("Use /"+cmd+" <Veh/ID>", player);
else if (!FindVehicle(text.tointeger())) MessagePlayer("Vehicle ID does not exist.",player);
else {
local v=FindVehicle(text.tointeger());
QuerySQL( Vehicles,"UPDATE Creation SET X='"+player.Pos.x+"' WHERE ID='"+v.ID+"'");
QuerySQL( Vehicles,"UPDATE Creation SET Y='"+player.Pos.y+"' WHERE ID='"+v.ID+"'");
QuerySQL( Vehicles,"UPDATE Creation SET Z='"+player.Pos.z+"' WHERE ID='"+v.ID+"'");
QuerySQL( Vehicles,"UPDATE Creation SET Angle='"+player.Angle+"' WHERE ID='"+v.ID+"'");
MessagePlayer("You have changed car ID "+v.ID+" Position." , player );
}
}





Also this:


else if (cmd=="addcar")
{
if ( player.Vehicle ) MessagePlayer("You must be outside of the vehicle.", player );
else if ( !player.IsSpawned ) MessagePlayer("You need be spawned to use this command.", player );
else if( !text ) MessagePlayer("Use /"+cmd+" <Veh/ID> <Col1/ID> <Col2/ID> <World> <Price>.", player);
else {
local TextSplit = split( text, " " ),ModelID=TextSplit[ 0 ],ColID1=TextSplit[ 1 ],ColID2=TextSplit[ 2 ],WorldID=TextSplit[ 3 ],Price=TextSplit[ 4 ];
if (!IsNum(ModelID)) MessagePlayer("Use /"+cmd+" <Veh/ID> <Col1/ID> <Col2/ID> <World> <Price>.", player);
else if ( !IsNum(ColID1)) MessagePlayer("Use /"+cmd+" <Veh/ID> <Col1/ID> <Col2/ID> <World> <Price>.", player);
else if ( !IsNum(ColID2)) MessagePlayer("Use /"+cmd+" <Veh/ID> <Col1/ID> <Col2/ID> <World> <Price>.", player);
else if ( !IsNum(WorldID)) MessagePlayer("Use /"+cmd+" <Veh/ID> <Col1/ID> <Col2/ID> <World> <Price>.", player);
else if ( !IsNum(Price)) MessagePlayer("Use /"+cmd+" <Veh/ID> <Col1/ID> <Col2/ID> <World> <Price>.", player);
else if ( !Price ) MessagePlayer("Use /"+cmd+" <Veh/ID> <Col1/ID> <Col2/ID> <World> <Price>.", player);
else if ((ModelID.tointeger() < 130) ) MessagePlayer ( "The models ID must be greater than 130" , player );
else if ((ModelID.tointeger() == 180))MessagePlayer ("This model ID is not a vehicle" , player );
else if ((ModelID.tointeger() == 181))MessagePlayer ("This model ID is not a vehicle" , player );
else if ((ModelID.tointeger() == 165))MessagePlayer ("This model ID is not a vehicle" , player );
else {
local VehicleID=GetVehicleCount();
VehicleID+=1;
QuerySQL( Vehicles, "INSERT INTO Creation ( id, model, x, y, z, col1, col2, world, angle ) VALUES ( '"+VehicleID+"', '"+ModelID+"', '"+player.Pos.x+"', '"+player.Pos.y+"', '"+player.Pos.z+"', '"+ColID1+"', '"+ColID2+"', '"+WorldID+"', '"+player.Angle+"' )" );
QuerySQL( Vehicles, "INSERT INTO Sale ( ID, Cost, Owner, Shared, Shared2 ) VALUES ( '"+VehicleID+"', '"+Price+"', 'Unowned', 'None', 'None' )" );
CreateVehicle(ModelID.tointeger(),WorldID.tointeger(),player.Pos, player.Angle,ColID1.tointeger(),ColID2.tointeger());
Message( "Admin ["+player.Name+"] Has added a new Vehicle ID: "+VehicleID+"." );
player.Pos.z +6;
}
}
}


Also this:


else if ( cmd == "removecar" )
{
if ( !player.IsSpawned ) MessagePlayer("You need be spawned to use this command.", player );
else if ( !text ) MessagePlayer("Use /"+cmd+" <Veh/ID>.", player);
else {
local veh = FindVehicle( text.tointeger() );
if ( !veh ) MessagePlayer("Invalid Vehicle ID.", player );
else {
veh.Delete()
QuerySQL( Vehicles, "DELETE FROM Creation WHERE ID='"+veh.ID+"'" );
QuerySQL( Vehicles, "DELETE FROM Sale WHERE ID='"+veh.ID+"'" );
Message( "Admin ["+player.Name+"] Removed car ID: "+veh.ID+".");
}
}
}



Also this


else if ( cmd == "setowner" )
{
if ( !text ) MessagePlayer("Use /"+cmd+" <Nick/ID> <Veh/ID>.", player);
else {
local plr = GetPlayer( GetTok( text, " ", 1 ) );
if ( !plr ) MessagePlayer("Invalid player.", player );
else {
local veh = FindVehicle( GetTok( text, " ", 2 ).tointeger() );
if ( !veh ) MessagePlayer("Invalid 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( "Admin ["+player.Name+"] Set Vehicle ID "+veh.ID+" owner to ["+plr.Name+"]." );
}
}
}
}

dracc

What is this "level 9" you're talking about?

Mursaleen5544

Add this Line in the start of your commands.
like
 if ( cmd == "changecol" )
{
Add_line_here
{
}
Line : local id = player.ID
if ( stats[ player.ID ].Level < 9 )  return MessagePlayer( "[#FF0000][Error] - You Need At Least Level 9 To Use This Command.", player);