Jump to content

Moomasterq

Members
  • Posts

    16
  • Joined

  • Last visited

Details

  • Gang
    CowPi

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Moomasterq's Achievements

Square

Square (6/54)

0

Reputation

  1. Ok, after fiddling around for a while looking at various functions I found the removeWorldModel function to remove the objects. To get the ids I just looked in the .map file and figured it out.
  2. I'm not sure what you are trying to ask, I have the editor loaded (not running), and my gamemode with the custom map file loaded in the xml file. If I have mapmanager enabled it doesn't let me restart my gamemode, which is bad since it's under heavy development.
  3. <removeWorldObject id="removeWorldObject (modshopdoor_SFSe) (1)" radius="5.9890670776367" interior="0" model="11313" lodModel="0" posX="-1936.26794" posY="239.48399" posZ="35.22146" rotX="0" rotY="0" rotZ="0"></removeWorldObject> <removeWorldObject id="removeWorldObject (sprayshpdr2_SFSe) (1)" radius="6.6437840461731" interior="0" model="11319" lodModel="0" posX="-1906.42065" posY="277.84949" posZ="41.34696" rotX="0" rotY="0" rotZ="0"></removeWorldObject> <removeWorldObject id="removeWorldObject (modshopdoor1_SFS) (1)" radius="5.9891090393066" interior="0" model="10575" lodModel="0" posX="-2716.29932" posY="215.94716" posZ="3.98087" rotX="0" rotY="0" rotZ="0"></removeWorldObject> <removeWorldObject id="removeWorldObject (spdr_sfw) (1)" radius="6.7266039848328" interior="0" model="9625" lodModel="0" posX="-2424.68701" posY="1028.07813" posZ="51.80761" rotX="0" rotY="0" rotZ="0"></removeWorldObject> Hello everyone, after a very successful post in the scripting subforum I tried my hand at mapping. I created various objects with the map editor fairly well, and got the map working but then I went to work on the pay and spray function. But in order to do so I needed to first remove the doors to the garages. So I booted up the editor and worked my magic deleting the doors and then went to upload the map, and that is where everything fell apart. Eventually I figured out that the mapmanager was breaking my game and required me to disable it completely (Everytime I tried to restart my gamemode it broke the map trying to load the editors map instead of the one defined in meta.xml). However, I now have a pretty heft problem, the doors are not being removed from the locations selected in the editors. If I enable the editor and map manager they dissappear, but then loading gamemodes/maps breaks disabling the map and gamemode giving me a black screen until login. I've tried updating my resources, but no luck. Any help would be helpful, and I'll try to respond in the morning. Thanks. Edit: I'd like to note that my objects, vehicles, and everything else loads fine, just not the removal of objects. Edit 2: Figured that the whole map script is worth putting here in case of something breaking it further up
  4. Ok, thanks for all the help, and for putting up with me as I slowly transition from my lovely python syntax world to this creation which is lua. (Also thanks for putting up with David1544). Here is my final script if anyone would like to ever use it/reference it in their own creation --Join Handler, how player joins when spawns function joinHandler(_, playeraccount) --Spawning Player if getAccountData(playeraccount, "did.they.ever.login") == 1 then local loginX = getAccountData(playeraccount, "cowpi.loginlocation.x") local loginY = getAccountData(playeraccount, "cowpi.loginlocation.y") local loginZ = getAccountData(playeraccount, "cowpi.loginlocation.z") spawnPlayer(source, loginX, loginY, loginZ) else spawnPlayer(source, spawnX, spawnY, spawnZ) end fadeCamera(source, true) setCameraTarget(source, source) outputChatBox("Welcome to CowPi MTA", source) end addEventHandler("onPlayerLogin", getRootElement(), joinHandler) --Quit handler, handles the position of player on last login function quitHandler() local playeraccount = getPlayerAccount (source) if (playeraccount) and not isGuestAccount(playeraccount) then local logoutX, logoutY, logoutZ = getElementPosition(source) setAccountData(playeraccount, "cowpi.loginlocation.x", logoutX) setAccountData(playeraccount, "cowpi.loginlocation.y", logoutY) setAccountData(playeraccount, "cowpi.loginlocation.z", logoutZ) setAccountData(playeraccount, "did.they.ever.login", 1) end end addEventHandler("onPlayerQuit", getRootElement(), quitHandler) Just make sure to set the setaccountdata things to whatever you'd like to call them, and to define spawnX/Y/Z as well. Once again thanks.
  5. I have no guest login function, essentially removing the guest login option. I also disabled the logout feature, so no guests can be created, ever. For the second much more confusing sentence, I was asking if it'd be possible to make it so that once the player leaves, it sets a data value of 1 to account data making it so the player has essentially been "tracked". If the value is empty it will spawn you at the spawn coordinates instead of the last location.
  6. Not anymore, but it still doesn't solve the dilemma of first login. Edit: could I make a setaccount data so that onlogout it sets a value to 1 and then it goes through something that says if 1 do the login thing, else login at spawn?
  7. If I change it to onPlayerJoin it then makes the player spawn instantly. If I removed guest accounts I could force onPlayerLogin essentailly, but then I have no where for the new players to spawn on their first spawn.
  8. Essentially allow for guests and first time players to be able to spawn as the current working system with tracking logouts didn't work too well with new players/guests. Edit: I do plan to disable guests eventually, and if it makes it easier to do so, I'd do it now
  9. Ok, after having this working, I decided I haven't had enough and I'd like to set up the function for guest accounts/first time joining accounts. However, I have no way of doing this as of now. Here is what I have so far, yet it does not work. --Join Handler, how player joins when spawns function joinHandler(_, playeraccount) --Spawning Player if (getAccountData(playeraccount, "cowpi.loginlocation.y") then if (playeraccount) then --and not isGuestAccount(playeraccount) then local loginX = getAccountData(playeraccount, "cowpi.loginlocation.x") local loginY = getAccountData(playeraccount, "cowpi.loginlocation.y") local loginZ = getAccountData(playeraccount, "cowpi.loginlocation.z") spawnPlayer(source, loginX, loginY, loginZ) else spawnPlayer(source, spawnX, spawnY, spawnZ) end else spawnPlayer(source, spawnX, spawnY, spawnZ) end fadeCamera(source, true) setCameraTarget(source, source) outputChatBox("Welcome to CowPi MTA", source) end addEventHandler("onPlayerLogin", getRootElement(), joinHandler) I cut out the spawn variables so you don't have to look at them and cut out the quitHandler as that isn't really needed now...
  10. Thanks thisisdoge I have it working now. I already had the spawn coordinates set but I didn't want to include them in the prior post because they would clutter it more so than it already is. I was aware of the wiki and the events, but thank you anyway for linking it and being helpful, had I not been in the posistion that I'm in that would've been immensely helpful. Also thank you to solidsnake14 who helped me out originally clean up some of my script. Here is the final script if anyone ever wants to use/reference it in the future local spawnX = math.random(-1715,-1705) local spawnY = math.random(-495,-485) local spawnZ = 14 --local playeraccount = getPlayerAccount(thePlayer) --Join Handler, how player joins when spawns function joinHandler(_, playeraccount) --Spawning Player if (playeraccount) then --and not isGuestAccount(playeraccount) then local loginX = getAccountData(playeraccount, "cowpi.loginlocation.x") local loginY = getAccountData(playeraccount, "cowpi.loginlocation.y") local loginZ = getAccountData(playeraccount, "cowpi.loginlocation.z") spawnPlayer(source, loginX, loginY, loginZ) --spawnPlayer(source, spawnX, spawnY, spawnZ) else spawnPlayer(source, spawnX, spawnY, spawnZ) end fadeCamera(source, true) setCameraTarget(source, source) outputChatBox("Welcome to CowPi MTA", source) end addEventHandler("onPlayerLogin", getRootElement(), joinHandler) --Quit handler, handles the position of player on last login function quitHandler() local playeraccount = getPlayerAccount (source) if (playeraccount) and not isGuestAccount(playeraccount) then local logoutX, logoutY, logoutZ = getElementPosition(source) setAccountData(playeraccount, "cowpi.loginlocation.x", logoutX) setAccountData(playeraccount, "cowpi.loginlocation.y", logoutY) setAccountData(playeraccount, "cowpi.loginlocation.z", logoutZ) end end addEventHandler("onPlayerQuit", getRootElement(), quitHandler)
  11. Ok, even when I remove/disable that line, my player still spawns at 0, 0 ,0. Does account data get stored in strings and requires me to tonumber() it or do you think that my leaving function is improper? --Join Handler, how player joins when spawns function joinHandler(_, playeraccount) --Spawning Player if (playeraccount) then --and not isGuestAccount(playeraccount) then local loginX = getAccountData(playeraccount, "cowpi.loginlocation.x") local loginY = getAccountData(playeraccount, "cowpi.loginlocation.y") local loginZ = getAccountData(playeraccount, "cowpi.loginlocation.z") spawnPlayer(source, loginX, loginY, loginZ) --spawnPlayer(source, spawnX, spawnY, spawnZ) else spawnPlayer(source, spawnX, spawnY, spawnZ) end fadeCamera(source, true) setCameraTarget(source, source) outputChatBox("Welcome to CowPi MTA", source) end addEventHandler("onPlayerLogin", getRootElement(), joinHandler) --Quit handler, handles the position of player on last login function quitHandler(_, playeraccount) if (playeraccount) and not isGuestAccount(playeraccount) then local logoutX, logoutY, logoutZ = getElementPosition(thePlayer) setAccountData(playeraccount, "cowpi.loginlocation.x", logoutX) setAccountData(playeraccount, "cowpi.loginlocation.y", logoutY) setAccountData(playeraccount, "cowpi.loginlocation.z", logoutZ) end end addEventHandler("onPlayerQuit", getRootElement(), quitHandler) I also have a question about how should I go about making players who never joined before have a spawn? Should I set login X Y and Z as spawnX,y,z and have it redefined if they have a location or no?
  12. Ok I defined joinhandler, and then did a refreshall in console and MTA gave me an error concerning getPlayerAccount as I was trying to take in source instead of thePlayer. Here is my revised script, but I now spawn at 0, 0, 0. If I set player health to 0 through the admin panel I spawn at my original spawn points that I selected (spawnX etc.), but if I reconnect from there I will spawn at 0, 0, 0 once more. Here is my current code local spawnX = math.random(-1715,-1705) local spawnY = math.random(-495,-485) local spawnZ = 14 local playeraccount = getPlayerAccount(thePlayer) --Join Handler, how player joins when spawns function joinHandler(_, playeraccount) --Spawning Player if (playeraccount) and not isGuestAccount(playeraccount) then local loginX = getAccountData(playeraccount, "cowpi.loginlocation.X") local loginY = getAccountData(playeraccount, "cowpi.loginlocation.Y") local loginZ = getAccountData(playeraccount, "cowpi.loginlocation.Z") spawnPlayer(source, loginX, loginY, loginZ) else spawnPlayer(source, spawnX, spawnY, spawnZ) end fadeCamera(source, true) setCameraTarget(source, source) outputChatBox("Welcome to CowPi MTA", source) end addEventHandler("onPlayerLogin", getRootElement(), joinHandler) --Quit handler, handles the position of player on last login function quitHandler(_, playeraccount) if (playeraccount) and not isGuestAccount(playeraccount) then local logoutX, logoutY, logoutZ = getElementPosition(source) setAccountData(playeraccount, "cowpi.loginlocation.X", logoutX) setAccountData(playeraccount, "cowpi.loginlocation.Y", logoutY) setAccountData(playeraccount, "cowpi.loginlocation.Z", logoutZ) end end addEventHandler("onPlayerQuit", getRootElement(), quitHandler)
  13. Ok, I'm relatively new to lua (came from python), so I'm learning gradually (so pardon my idiocracy). I changed to the onPlayerLogin event but it still does not work. --Join Handler, how player joins when spawns function joinHandler() --Spawning Player if (playeraccount) and not isGuestAccount(playeraccount) then local loginX = getAccountData(playeraccount, "cowpi.loginlocation.X") local loginY = getAccountData(playeraccount, "cowpi.loginlocation.Y") local loginZ = getAccountData(playeraccount, "cowpi.loginlocation.Z") spawnPlayer(source, loginX, loginY, loginZ) else spawnPlayer(source, spawnX, spawnY, spawnZ) end fadeCamera(source, true) setCameraTarget(source, source) outputChatBox("Welcome to CowPi MTA", source) end addEventHandler("onPlayerLogin", getRootElement(), joinHandler) Should I change my login method from one of them that I found in MTA resources or should I create the basic one from the wiki here.
×
×
  • Create New...