Author Topic: /removecar Command  (Read 1954 times)

StixsmasterHD

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
/removecar Command
« on: July 12, 2012, 11:12:25 am »
Can sum1 help me add onto the main.nut file's "onPlayerCommand( pPlayer, szCmd, szParams )" function so that users may properly remove vehicles? Or provide the snippet to do so properly?

I have tried to add it myself and what not but I keep getting errors here and there. This is mostly due to the wiki lacking so much info related to scripting. What it has is good but it needs so much more.

SugarD

  • Argonath RPG Dev/Manager
  • Tester
  • Sr. Member
  • ****
  • Posts: 820
  • Karma: +37/-75
  • STOP IN THE NAME OF THE COLESLAW!
    • View Profile
    • Clan Xperience
Re: /removecar Command
« Reply #1 on: July 12, 2012, 11:49:12 pm »
What do you mean by removing vehicles? Removing existing ones LU provided in it's default scripts, or remove ones that users have created via commands with your own scripts?

StixsmasterHD

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: /removecar Command
« Reply #2 on: July 12, 2012, 11:59:13 pm »
What do you mean by removing vehicles? Removing existing ones LU provided in it's default scripts, or remove ones that users have created via commands with your own scripts?

ones created by users not those provided by the content.xml

BTW error I seem to get is sumthang like "Could not retrieve UserData"

I dont know what that means and/or how to solve that issue either. If sumone could provide a user friendly tutorial or sumthang to help would be great.
« Last Edit: July 13, 2012, 12:01:07 am by StixsmasterHD »

SugarD

  • Argonath RPG Dev/Manager
  • Tester
  • Sr. Member
  • ****
  • Posts: 820
  • Karma: +37/-75
  • STOP IN THE NAME OF THE COLESLAW!
    • View Profile
    • Clan Xperience
Re: /removecar Command
« Reply #3 on: July 13, 2012, 12:08:36 am »
What do you mean by removing vehicles? Removing existing ones LU provided in it's default scripts, or remove ones that users have created via commands with your own scripts?

ones created by users not those provided by the content.xml

BTW error I seem to get is sumthang like "Could not retrieve UserData"

I dont know what that means and/or how to solve that issue either. If sumone could provide a user friendly tutorial or sumthang to help would be great.
The first could be resolved through a usage of a database, and have the command remove the vehicle from the database, although destroying a vehicle directly in the server's memory is another situation. I know it's possible, but unsure of how it's done exactly.

As for the error, I remember it being related to database/hashing issues.

StixsmasterHD

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: /removecar Command
« Reply #4 on: July 13, 2012, 12:11:42 am »
What do you mean by removing vehicles? Removing existing ones LU provided in it's default scripts, or remove ones that users have created via commands with your own scripts?

ones created by users not those provided by the content.xml

BTW error I seem to get is sumthang like "Could not retrieve UserData"

I dont know what that means and/or how to solve that issue either. If sumone could provide a user friendly tutorial or sumthang to help would be great.
The first could be resolved through a usage of a database, and have the command remove the vehicle from the database, although destroying a vehicle directly in the server's memory is another situation. I know it's possible, but unsure of how it's done exactly.

As for the error, I remember it being related to database/hashing issues.

I am aware of sqlite and if I remember correctly it should save data via I think a txt file or sum special format for it to read off your harddrive and well I have tried to read the tutorial but seriously is there no way to be more user friendly about the install?

I jest tried to install sqlite into my main.nut file into the rest of my script snippets but even after serious modification to the example script I get that error.

There has to be an easier way to do this.
« Last Edit: July 13, 2012, 12:30:58 am by StixsmasterHD »

Thijn

  • Tester
  • Sr. Member
  • ****
  • Posts: 531
  • Karma: +27/-16
    • View Profile
Re: /removecar Command
« Reply #5 on: July 15, 2012, 12:03:07 pm »
If you want to remove the vehicle the player is in:
Code: [Select]
local veh = pPlayer.Vehicle;
pPlayer.ExitVehicle();
veh.Remove();

Or by vehicle ID (See the wiki:
Code: [Select]
function onPlayerCommand( player, cmd, text )
{
if ( cmd == "remvehicle" )
{
if ( text )
{
local veh = FindVehicle( text.tointeger() );
if ( veh )
{
veh.Remove();
MessagePlayer( "Removed vehicle ID: " + text, player );
}
}
}
}

Oh and the Could not retrieve UserData means you're using an undefined function or string.
Something like:
Code: [Select]
local blah = "Hi!";
print( bleh );
Will trigger that.

 

© Liberty Unleashed Team.