StreetFighter Posted October 17, 2009 Share Posted October 17, 2009 Hello, I'm new in lua and I'm a having a little trouble getting started. I've create a very basic gamemodescript: the meta.xml file: <meta> <info name="Fun Mode" author="StreetFighter442" version="1.0" /> <script src="script.lua" type="server" /> <script src="modelreplace.lua" type="client" /> </meta> here's the script.lua: function joinHandler() local x = 1959.55 local y = -1714.46 local z = 10 spawnPlayer(source, x, y, z) fadeCamera(source, true) setCameraTarget(source, source) outputChatBox("Welcome balb to My Server", source) end function loadMapFile ( filename ) node = getResourceConfig ( filename ) -- Check if the file was loaded ok if ( node ) then -- Load the loaded xml file into the element tree loadMapData ( node, getRootNode ) -- Unload the xml file again xmlUnloadFile ( node ) end end function createVehicleForPlayer(thePlayer, commend) outputChatBox("test: "..getPlayerName(thePlayer),thePlayer) local x2,y2,z2 = getElementPosition(thePlayer) -- get the position of the player local orgx,orgy,orgz = getElementPosition(thePlayer) -- get the position of the player for i=0,20,1 do x2 = x2 + 1 -- add 5 units to the x position local createdVehicle = createPed(127,x2,y2,z2) --local rot = atan2(orgx,orgy,x2,y2); --setPedRotation(rot) --setPedControlState(createdVehicle, "fire", true) --setPedAnimation(createdVehicle, "ped", "WOMAN_walknorm") -- 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 ped.",thePlayer) end end end addCommandHandler("createped", createVehicleForPlayer) addEventHandler("onPlayerJoin", getRootElement(), joinHandler) and here's the modelreplace.lua: function remotePlayerJoin() outputChatBox("* " .. getPlayerName(source) .. " has joined the server") end addEventHandler("onClientPlayerJoin", getRootElement(), remotePlayerJoin) If i join now my server with the gamemode above running, I get an "error downloading requested files" error, but if join my server when he's running the freeroam gamemode everything works fine. Hope you can help, Thanks in advance. Link to comment
CallumD Posted October 17, 2009 Share Posted October 17, 2009 I find that if my resources have a space in the name I get a download error. Link to comment
StreetFighter Posted October 17, 2009 Author Share Posted October 17, 2009 thanks, that was the solution. I had a space in the name of my gamemode. Link to comment
Salem Posted October 21, 2009 Share Posted October 21, 2009 J have the same problem, but still couldnt connect in MTA 1.0.1 My resources haven't got any spaces! Pls help Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now