GameZoneX Posted May 17, 2011 Posted May 17, 2011 I readded the housing sytem and still isn't working
CowTurbo Posted May 19, 2011 Author Posted May 19, 2011 weird, tell me with point to point what did u do when u install it. and try /debugscript 3 in game and say is there some errors ?
Yussuf Posted May 28, 2011 Posted May 28, 2011 Great work ! I have tried with an other resource but I didn't find a sollution ! My problem is that I would respawn in my house If my player die ! any idea ?
CowTurbo Posted May 29, 2011 Author Posted May 29, 2011 which gamemode are you using ? If you are using your own mode, then replace that with your respawn function. ( Server side ) function respawnToHome() local skin = getElementModel ( source ) local playeraccount = getPlayerAccount ( source ) local house = getAccountData ( playeraccount, "house" ) if ( house == "yes" )then local housex = getAccountData ( playeraccount, "housex" ) local housey = getAccountData ( playeraccount, "housey" ) local housez = getAccountData ( playeraccount, "housez" ) if ( housex ) and ( housey ) and ( housez ) then spawnPlayer ( source, housex, housey, housez, 0, skin ) end else -- HERE ADD YOUR OTHER RESPAWN FUNCTIONS ( IF THE PLAYER DONT HAVE HOME ) end end addEventHandler ("onPlayerWasted",getRootElement(), respawnToHome ) If you are using play then replace this in play folder .lua file addEventHandler("onResourceStart", resourceRoot, function() for i,player in ipairs(getElementsByType("player")) do spawn(player) end end ) function spawn(player) repeat until spawnPlayer ( player, 2412+math.random(1,1), -1413+math.random(1,1),24.4, 90, math.random(9,288) ) fadeCamera(player, true) setCameraTarget(player, player) end addEventHandler("onPlayerJoin", root, function() spawn(source) end ) function respawnToHome() local skin = getElementModel ( source ) local playeraccount = getPlayerAccount ( source ) local house = getAccountData ( playeraccount, "house" ) if ( house == "yes" )then local housex = getAccountData ( playeraccount, "housex" ) local housey = getAccountData ( playeraccount, "housey" ) local housez = getAccountData ( playeraccount, "housez" ) if ( housex ) and ( housey ) and ( housez ) then spawnPlayer ( source, housex, housey, housez, 0, skin ) end else setTimer(spawn, 1800, 1, source) end end addEventHandler ("onPlayerWasted",getRootElement(), respawnToHome ) If you want that too, when player joins and spawn at home with play resource, then use that: addEventHandler("onResourceStart", resourceRoot, function() for i,player in ipairs(getElementsByType("player")) do spawn(player) end end ) function spawn(player) repeat until spawnPlayer ( player, 2412+math.random(1,1), -1413+math.random(1,1),24.4, 90, math.random(9,288) ) fadeCamera(player, true) setCameraTarget(player, player) end addEventHandler("onPlayerJoin", root, function() local playeraccount = getPlayerAccount ( source ) local house = getAccountData ( playeraccount, "house" ) if ( house == "yes" )then local housex = getAccountData ( playeraccount, "housex" ) local housey = getAccountData ( playeraccount, "housey" ) local housez = getAccountData ( playeraccount, "housez" ) if ( housex ) and ( housey ) and ( housez ) then spawnPlayer ( source, housex, housey, housez, 0, skin ) end else spawn( source) end end end ) function respawnToHome() local skin = getElementModel ( source ) local playeraccount = getPlayerAccount ( source ) local house = getAccountData ( playeraccount, "house" ) if ( house == "yes" )then local housex = getAccountData ( playeraccount, "housex" ) local housey = getAccountData ( playeraccount, "housey" ) local housez = getAccountData ( playeraccount, "housez" ) if ( housex ) and ( housey ) and ( housez ) then spawnPlayer ( source, housex, housey, housez, 0, skin ) end else setTimer(spawn, 1800, 1, source) end end addEventHandler ("onPlayerWasted",getRootElement(), respawnToHome ) Hope it helps.
Yussuf Posted May 29, 2011 Posted May 29, 2011 Really thank you very much ! It works ! Thank you !!! :)
Yussuf Posted May 29, 2011 Posted May 29, 2011 Please , do you have a way to show blips in the radar/map ??
)*,..,*( Posted June 7, 2011 Posted June 7, 2011 Maybe selling houses to other players, and setting price to sell it.
CowTurbo Posted June 7, 2011 Author Posted June 7, 2011 Maybe selling houses to other players, and setting price to sell it. If you have givecash functions in server, then he gives you money what you want, and you sell house, and then he can buy. Need some maths from player, but can be used. Please , do you have a way to show blips in the radar/map ?? You do got my msn, i will help with that you.
CowTurbo Posted June 9, 2011 Author Posted June 9, 2011 For everyone, who wants to have on bind "B" house blips, add this to server-side script in house resource. function makeBlips (player) local root = xmlLoadFile ("homes.xml") local houseroot = xmlFindChild (root,"houses",0) if (houseroot) then allHouses = {} for i,v in ipairs (xmlNodeGetChildren(houseroot)) do local x = xmlNodeGetAttribute (v,"x") local y = xmlNodeGetAttribute (v,"y") local z = xmlNodeGetAttribute (v,"z") local number = xmlNodeGetAttribute (v,"num") if not (xmlNodeGetAttribute (v,"owner") == "") then blips[tonumber(number)] = createBlip ( x,y,z,32, 2, getRootElement(), getRootElement(), getRootElement(), getRootElement(),0, 99999.0, player ) else blips[tonumber(number)] = createBlip ( x,y,z,31, 2, getRootElement(), getRootElement(), getRootElement(), getRootElement(),0, 99999.0, player ) end end end end function destroyBlips () for i,v in pairs ( blips ) do destroyElement ( v ) end end function bindKeys () bindKey ( source, "b", "down", makeBlips ) bindKey ( source, "b", "up", destroyBlips ) end addEventHandler ( "onPlayerJoin", getRootElement(), bindKeys ) addEventHandler ( "onPlayerLogin", getRootElement(), bindKeys ) function bindKeysOnStart () for i,v in ipairs ( getElementsByType("player")) do bindKey ( v, "b", "down", makeBlips ) bindKey ( v, "b", "up", destroyBlips ) end end addEventHandler ( "onResourceStart", getResourceRootElement(getThisResource()), bindKeysOnStart )
Raimis_R Posted June 10, 2011 Posted June 10, 2011 Very nice. And this system based on flat files or SQLLite,MySQL or something like this?
MTA Team qaisjp Posted July 9, 2011 MTA Team Posted July 9, 2011 tim260, this is the server error, not resource error, try closing all programs/opening mta as admin/delete mods/deathmatch/resources folder!
AMARANT Posted September 10, 2011 Posted September 10, 2011 I've found a bug. When a player quits the game while being in a house he won't be able to get out from it because any marker doesn't appear in the next connection. Please fix it though it seems that I can fix it on my own on my server...
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