Jump to content

Scripting Introduction, please help me!


DarkLink

Recommended Posts

First of all, sorry for my bad english xD

Hi, i am new in scripting..

I read the scripting introduction, and try to do it..

So i end it this script:

function createVehicleForPlayer(thePlayer, "createvehicle", "468") 
  
        local x,y,z = getElementPosition(thePlayer) -- get the position of the player 
        x = x + 5 -- add 5 units to the x position 
        local createdVehicle = createVehicle(tonumber(468),x,y,z) 
        -- check if the return value was ''false'' 
        if (createdVehicle == false) then 
                -- if so, output a message to the chatbox, but only to this player. 
                outputChatBox("Failed to create vehicle.",thePlayer) 
        end 
end 
addCommandHandler("createvehicle", createVehicleForPlayer) 

Then i save it, script.lua

I do a meta.xml it this:

<meta> 
     <info author="DarkLink" description="A few simple commands" /> 
     <script src="script.lua" /> 
</meta> 

Then put it together in one folder called "commands" to resourcecache and also zipped to resources!

I open the server, and i saw the 101 resources loaded, then i enter in my server...

Open the console and write createvehicle, and not happens...i also try the createvehicle 468.. And nothing..

Please...someone more expert try to help me...ok!?

I did like to learn more of lua ^^

Thank you!

Link to comment
in the server console (Black thing) type start commands

OR

give yourself admin (it tells you have to do that in the wiki)

login then press p go to the resources tab find commands, click on it then press start.

THAAAAANK YOU VERY MUUUUCH!!!

REALLY I APRECCIATE YOUR HELP!

thank you 2 ^^

Link to comment
  • 3 weeks later...

Starting resources can be done very simple in the mtaserver.conf:

  
    <!-- Specifies resources that are loaded when the server starts and/or which are protected from being stopped. To specify several resources, add more <resource> parameter(s). --> 
    <resource src="admin" startup="1" protected="0"/> 
    <resource src="helpmanager" startup="1" protected="0"/> 
    <resource src="mapcycler" startup="1" protected="0"/> 
    <resource src="mapmanager" startup="1" protected="0"/> 
    <resource src="resourcebrowser" startup="1" protected="1" default="true"/> 
    <resource src="resourcemanager" startup="1" protected="1"/> 
    <resource src="scoreboard" startup="1" protected="0"/> 
    <resource src="spawnmanager" startup="1" protected="0"/> 
    <resource src="votemanager" startup="1" protected="0"/> 
    <resource src="webadmin" startup="1" protected="0"/> 
  

As you can see this part of the config tells the server to start all these resources,

Now to automaticly start you resource just ad the following line:

  
    <resource src="your-resources-here" startup="1" protected="0"/> 
  

Just fill in your resource there and save the file, start up the server, go to the server, and see it working without doing anything.

Greatings Frank

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...