Jump to content

PLEASE HELP!!!


5150

Recommended Posts

i have tried for so long to make one simple script for an admin base i am making... it is a gate allowing access. i know how to make it, but i dont know what to do after i plug the info in (i use a model that apparently is bad or something) can anyone tell me the steps in successfully making this work in the server i play on, and any others i want to add it too... here is the script to check for errors. the tutorials never helped me, ive done my research

.

.

.

.

.

.

admingate = createObject(10841, -1641, -36.7998, 1, 0, 0, 135.03295)

function gateOpen()

moveObject(admingate, 2000, -1641, -36.7998, 5,)

end

addCommandHandler("/adminbo", gateOpen)--Command /adminbo to open gate

function gateClose()

moveObject( admingate, 2000, -1641, -36.7998, 1,)

end

addCommandHandler("/adminbc", gateClose)--Command /adminbc to close gate

Link to comment

Try this ..

admingate = createObject(10841, -1641, -36.7998, 1, 0, 0, 135.03295) 
  
function gateOpen() 
moveObject(admingate, 2000, -1641, -36.7998, 5) 
end 
addCommandHandler("adminbo", gateOpen) --Command /adminbo to open gate 
  
function gateClose() 
moveObject( admingate, 2000, -1641, -36.7998, 1) 
end 
addCommandHandler("adminbc", gateClose)--Command /adminbc to close gate 

By Code's

admingate = createObject([Object ID], [X], [Y], [Z], [Rotation.X], [Rotation.Y], [Rotation.Z]) 
  
function gateOpen() 
moveObject(admingate, [Object ID], [X], [Y], [Z]) 
end 
addCommandHandler("adminbo", gateOpen) --Command /adminbo to open gate 
  
function gateClose() 
moveObject( admingate, [Object ID], [X], [Y], [Z]) 
end 
addCommandHandler("adminbc", gateClose)--Command /adminbc to close gate 

||Sorry For My BAd English||

Link to comment

(server-side)

root = getRootElement() 
gResRoot = getResourceRootElement(getThisResource()) 
  
--X Y Z cordinates 
id,x,y,z,rx,ry,rz = [X],[Y],0,0,90 
Xero = "CloseGate" 
  
gate = createObject(id,x,y,z,rx,ry,rz) 
Col = createColSphere(x,y,z,5) 
  
function GatePlayerOpen(player) 
    if (getElementType(player) == "player") then 
        if (Xero == "CloseGate") then 
            OpenMyGate(player) 
        else 
            CloseMyGate(player) 
        end 
    end 
end 
addEventHandler("onColShapeHit",Col,GatePlayerOpen) 
addEventHandler("onColShapeLeave",Col,GatePlayerOpen) 
  
function GatePlayerOpen2(player) 
    if Xero == "CloseGate" then 
        outputChatBox("Player Open Gate.",player,170,255,0) 
        local x,y,z = getElementPosition(Kapi) 
        moveObject(Gate,2000,x,y,z-5.5) 
        Xero = "OpenGate" 
    end 
end 
  
function ClosePlayerGate(player) 
    if Xero == "OpenGate" then 
        outputChatBox("Player Close Gate.",player,170,255,0) 
        moveObject(Gate,2000,x,y,z) 
        Xero = "CloseGate" 
    end 
end 

Link to comment

Yeah. Sometimes the wiki's introduction page doesn't help much. :roll:

Okay, here are the steps:

1) Copy the below code and save it as "script.lua"

  
admingate = createObject(10841, -1641, -36.7998, 1, 0, 0, 135.03295) 
  
function gateOpen() 
moveObject(admingate, 2000, -1641, -36.7998, 5) 
outputChatBox("Gate is now opened!", 0, 255, 0, true) 
end 
addCommandHandler("adminbo", gateOpen) --Command /adminbo to open gate 
  
function gateClose() 
moveObject( admingate, 2000, -1641, -36.7998, 1) 
end 
addCommandHandler("adminbc", gateClose)--Command /adminbc to close gate 
outputChatBox("Gate is now closed!", 0, 255, 0, true) 
  

2) Copy the below code and save it as "meta.xml"

  

    "DeathWatch5150" version="1.0" name="My First Resource" description="This resource open and close a gate by a command" type="script" /> 
    

3) Create a ZIP folder called "myfirstresource" and put the above files in it.

4) Put the newly created ZIP folder in MTA San Andreas 1.4\server\mods\deathmatch\resources\[gameplay]

5) Congratulations! you have successfully created your very first resource.

Information regarding meta.xml.

The meta.xml should be present in every resource/gamemode/map you make as it tells the server there is a script in the folder.

If you didn't include put a meta.xml in your resource folder, your resource/script is never going to run as the server would never know about the presence/existence of your script.

So yes, meta.xml is a very important file and you certainly need it. :)

Link to comment
Yeah. Sometimes the wiki's introduction page doesn't help much. :roll:

Okay, here are the steps:

1) Copy the below code and save it as "script.lua"

  
admingate = createObject(10841, -1641, -36.7998, 1, 0, 0, 135.03295) 
  
function gateOpen() 
moveObject(admingate, 2000, -1641, -36.7998, 5) 
outputChatBox("Gate is now opened!", 0, 255, 0, true) 
end 
addCommandHandler("adminbo", gateOpen) --Command /adminbo to open gate 
  
function gateClose() 
moveObject( admingate, 2000, -1641, -36.7998, 1) 
end 
addCommandHandler("adminbc", gateClose)--Command /adminbc to close gate 
outputChatBox("Gate is now closed!", 0, 255, 0, true) 
  

2) Copy the below code and save it as "meta.xml"

  

    "DeathWatch5150" version="1.0" name="My First Resource" description="This resource open and close a gate by a command" type="script" /> 
    

3) Create a ZIP folder called "myfirstresource" and put the above files in it.

4) Put the newly created ZIP folder in MTA San Andreas 1.4\server\mods\deathmatch\resources\[gameplay]

5) Congratulations! you have successfully created your very first resource.

Information regarding meta.xml.

The meta.xml should be present in every resource/gamemode/map you make as it tells the server there is a script in the folder.

If you didn't include put a meta.xml in your resource folder, your resource/script is never going to run as the server would never know about the presence/existence of your script.

So yes, meta.xml is a very important file and you certainly need it. :)

man youre the best thanks. now once its in [gameplay] it will appear in any server i start, and i will have to send it to the owner of any other server for it to be there?

Link to comment
You are welcome. :)

Yes, if you want the resource to be able to work in a particular server, you have to send your resource to the server's owner.

sorry im such a bother lol, but i just copied what you gave me, edited the output message, saved it to .lua, then saved the meta to .xml, then saved it all to a "winRAR archive", then put it in gameplay. it didnt create the object or output a message when i typed it. did i do something wrong?

Link to comment

keeps saying access denied... keep in mind you're dealing with a guy that knows barely anything about scripting and dealing with personal servers xD i do my research but theres barely anything on youtube, and the wiki never seems to help for some reason :P

Link to comment

Okay, you have to make yourself admin to do that.

Here's a tutorial on how to do that: viewtopic.php?f=98&t=89673&p=808707&hilit=how+to+make+yourself+admin#p808707

After making yourself, admin. Start the game and login in the server ('/login name password') and type '/start myfirstresource'. This will start your resource.Then try opening/closing gates. If it doesn't work, type '/debugscript 3' and restart the resource by typing '/restart myfirstresource'.

About debugscript 3:

Debugscript as the name suggest debug the script and checks if they are any problems in the script and if it has any, it will output them on the screen.

'debugscript 1' will output only errors.

'debugscript 2' will output errors and warnings.

'debugscript 3' will output errors, warnings and info messages.

You can read more about it on here: https://wiki.multitheftauto.com/wiki/Debugging

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...