AlvareZ_ Posted March 9, 2013 Share Posted March 9, 2013 Me Podrian explicar un poco mas detallado el setAccountData y getAccountData, lo que quiero es que al loggear le salga algo y la segunda vez No me explican un poco mas detallado esto: Gracias de ante mano function onPlayerQuit ( ) -- when a player leaves, store his current money amount in his account data local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then -- if the player is logged in local playermoney = getPlayerMoney ( source ) -- get the player money setAccountData ( playeraccount, "piraterpg.money", playermoney ) -- save it in his account end end function onPlayerLogin (_, playeraccount ) -- when a player logins, retrieve his money amount from his account data and set it if ( playeraccount ) then local playermoney = getAccountData ( playeraccount, "piraterpg.money" ) -- make sure there was actually a value saved under this key (check if playermoney is not false). -- this will for example not be the case when a player plays the gametype for the first time if ( playermoney ) then setPlayerMoney ( source, playermoney ) end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin) Link to comment
Sasu Posted March 9, 2013 Share Posted March 9, 2013 setAccountData y getAccountData es parecido al setElementData y getElementData. Solo que setAccountData guarda datos, lo que vos quieras, en la cuenta del player y getAccountData es para obtenerlas. Si tu quieres mostrarle algo cuando se registre, puedes hacer esto: Que verifique si tiene un dato especefico, si no lo tiene le mostras lo que queres. Asi mira: function onPlayerNuevoQuit() local playeraccount = getPlayerAccount(source)--Obtener cuenta del player if ( playeraccount ) and not isGuestAccount ( playeraccount ) then if (not getAccountData(playeraccount, "nuevo")) then -- Si no obtiene el dato... setAccountData(playeraccount, "nuevo", "viejo") -- Darle el dato diciendo que este player ya es viejo asi no le aparece la bienvenida end end end addEventHandler("onPlayerQuit", getRootElement(), onPlayerNuevoQuit) function onPlayerRegister(_, playeraccount) if (not getAccountData(playeraccount, "nuevo")) then--Si no tiene el dato... outputChatBox("Bienvenido a nuestro server 24/7 de MTA:SA", source, 0, 255, 0, false)--mostrarle en el chat lo que esta entre "" end end addEventHandler("onPlayerLogin", getRootElement(), onPlayerRegister) No se si me explique bien. Link to comment
AlvareZ_ Posted March 10, 2013 Author Share Posted March 10, 2013 Eso seria en clinent-side no ? intento crearlo con unas set camera entonces seria : function onPlayerNuevoQuit() local playeraccount = getPlayerAccount(source) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then if (not getAccountData(playeraccount, "nuevo")) then setAccountData(playeraccount, "nuevo", "viejo") end end end addEventHandler("onPlayerQuit", getRootElement(), onPlayerNuevoQuit) function onPlayerRegister(_, playeraccount) if (not getAccountData(playeraccount, "nuevo")) then setCameraMatrix(2350.2368164063, 69.811370849609, 26.484375, 2340.9641113281, 12.886473655701, 26.3359375) setTimer(setCameraMatrix, 8000, 1, 2272.8959960938, -32.551116943359, 26.339841842651, 2315.6574707031, -28.518367767334, 26.3359375) end end addEventHandler("onPlayerLogin", getRootElement(), onPlayerRegister) Gracias por ayudarme Link to comment
NodZen Posted March 10, 2013 Share Posted March 10, 2013 Eso seria en clinent-side no ? intento crearlo con unas set camera entonces seria : function onPlayerNuevoQuit() local playeraccount = getPlayerAccount(source) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then if (not getAccountData(playeraccount, "nuevo")) then setAccountData(playeraccount, "nuevo", "viejo") end end end addEventHandler("onPlayerQuit", getRootElement(), onPlayerNuevoQuit) function onPlayerRegister(_, playeraccount) if (not getAccountData(playeraccount, "nuevo")) then setCameraMatrix(2350.2368164063, 69.811370849609, 26.484375, 2340.9641113281, 12.886473655701, 26.3359375) setTimer(setCameraMatrix, 8000, 1, 2272.8959960938, -32.551116943359, 26.339841842651, 2315.6574707031, -28.518367767334, 26.3359375) end end addEventHandler("onPlayerLogin", getRootElement(), onPlayerRegister) Gracias por ayudarme Si quieres hacerlo Client, cambia los Eventos que tienes. Link to comment
AlvareZ_ Posted March 10, 2013 Author Share Posted March 10, 2013 Lo puse ServerSide pero no anda, me da badArgument setCameraMatrix en la linea 13 Link to comment
NodZen Posted March 10, 2013 Share Posted March 10, 2013 Lo puse ServerSide pero no anda, me da badArgument setCameraMatrix en la linea 13 Y a Quién va dirigida esa cámara?. Link to comment
AlvareZ_ Posted March 10, 2013 Author Share Posted March 10, 2013 Solucionado, Muchas Gracias sasuke te entendi Muy Bien, y igual Muchas Gracias Nod Link to comment
NodZen Posted March 10, 2013 Share Posted March 10, 2013 Solucionado, Muchas Gracias sasuke te entendi Muy Bien, y igual Muchas Gracias Nod No hay problema, pero que estaba mal?. Link to comment
AlvareZ_ Posted March 10, 2013 Author Share Posted March 10, 2013 Solo me faltaba un source, ahora intento agregarle esto: pero no me da function onPlayerNuevoQuit() local playeraccount = getPlayerAccount(source) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then if (not getAccountData(playeraccount, "nuevo")) then spawnPlayer (source, 2312.84375, -1.3126500844955, 26.7421875, 0, math.random (280,288), 0, 0, spawnTeam) outputChatBox("Bienvenido de Vuelta"..getPlayerName.."Diviertete!", source, 255, 0, 0, 255) setAccountData(playeraccount, "nuevo", "viejo") end end end addEventHandler("onPlayerQuit", getRootElement(), onPlayerNuevoQuit) Link to comment
NodZen Posted March 10, 2013 Share Posted March 10, 2013 (edited) Solo me faltaba un source, ahora intento agregarle esto: pero no me da function onPlayerNuevoQuit() local playeraccount = getPlayerAccount(source) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then if (not getAccountData(playeraccount, "nuevo")) then spawnPlayer (source, 2312.84375, -1.3126500844955, 26.7421875, 0, math.random (280,288), 0, 0, spawnTeam) outputChatBox("Bienvenido de Vuelta"..getPlayerName.."Diviertete!", source, 255, 0, 0, 255) setAccountData(playeraccount, "nuevo", "viejo") end end end addEventHandler("onPlayerQuit", getRootElement(), onPlayerNuevoQuit) getPlayerName, no está definido de quien es el nombre. Ademas , no creaste el Team ( spawnTeam ). Edited March 11, 2013 by Guest Link to comment
AlvareZ_ Posted March 11, 2013 Author Share Posted March 11, 2013 No me anda nada, Mira registre una nueva cuenta que no es admin ni nada y Sale cada ves que loggeo, y con la mia que tiene Admin no me sale que sera? function onPlayerNuevoQuit() local playeraccount = getPlayerAccount(source) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then local localPlayerName = getPlayerName(getLocalPlayer()) spawnPlayer (source, 2312.84375, -1.3126500844955, 26.7421875, 0, math.random (280,288), 0, 0, spawnTeam) outputChatBox("Bienvenido de Vuelta"..getPlayerName(playerSource)"Diviertete!", source, 255, 0, 0, 255) if (not getAccountData(playeraccount, "nuevo")) then setAccountData(playeraccount, "nuevo", "viejo") end end end addEventHandler("onPlayerQuit", getRootElement(), onPlayerNuevoQuit) function onPlayerRegister(_, playeraccount) if (not getAccountData(playeraccount, "nuevo")) then setCameraMatrix(source, 2350.2368164063, 69.811370849609, 26.484375, 2340.9641113281, 12.886473655701, 26.3359375) setTimer(setCameraMatrix, 8000, 1, source, 2272.8959960938, -32.551116943359, 26.339841842651, 2315.6574707031, -28.518367767334, 26.3359375) end end addEventHandler("onPlayerLogin", getRootElement(), onPlayerRegister) Link to comment
NodZen Posted March 11, 2013 Share Posted March 11, 2013 (edited) Para Mi es este el problema. outputChatBox("Bienvenido de Vuelta"..getPlayerName(playerSource)"Diviertete!", source, 255, 0, 0, 255) Cambialo por este outputChatBox("Bienvenido de Vuelta "..getPlayerName(source).. "Diviertete!", source, 255, 0, 0, 255) Edited March 12, 2013 by Guest Link to comment
AlvareZ_ Posted March 11, 2013 Author Share Posted March 11, 2013 Sigue sin salir ni Spawnear, y le sale seguido la setCameraMatrix a la cuenta que registre nueva Link to comment
NodZen Posted March 11, 2013 Share Posted March 11, 2013 getLocalPlayer, es client y tus eventos son server side Link to comment
Sasu Posted March 11, 2013 Share Posted March 11, 2013 Ademas estas usando el evento de onPlayerQuit. Crea una funcion aparte. Link to comment
AlvareZ_ Posted March 11, 2013 Author Share Posted March 11, 2013 Si pongo todo asi deberia andar, no ? function onPlayerNuevoQuit() local playeraccount = getPlayerAccount(source) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then spawnPlayer (source, 2312.84375, -1.3126500844955, 26.7421875, 0, math.random (280,288), 0, 0, spawnTeam) outputChatBox("Bienvenido de Vuelta "..getPlayerName(source).. "Diviertete!", source, 255, 0, 0, 255) if (not getAccountData(playeraccount, "nuevo")) then setAccountData(playeraccount, "nuevo", "viejo") end end end addEventHandler("onPlayerQuit", getRootElement(), onPlayerNuevoQuit) function onPlayerRegister(_, playeraccount) if (not getAccountData(playeraccount, "nuevo")) then setCameraMatrix(source, 2350.2368164063, 69.811370849609, 26.484375, 2340.9641113281, 12.886473655701, 26.3359375) setTimer(setCameraMatrix, 8000, 1, source, 2272.8959960938, -32.551116943359, 26.339841842651, 2315.6574707031, -28.518367767334, 26.3359375) end end addEventHandler("onPlayerLogin", getRootElement(), onPlayerRegister) Link to comment
Sasu Posted March 11, 2013 Share Posted March 11, 2013 function onPlayerNuevoQuit() local playeraccount = getPlayerAccount(source) if ( playeraccount ) and not isGuestAccount ( playeraccount ) then if (not getAccountData(playeraccount, "nuevo")) then setAccountData(playeraccount, "nuevo", "viejo") end end end addEventHandler("onPlayerQuit", getRootElement(), onPlayerNuevoQuit) function playerViejo() local account = getPlayerAccount(source) if (getAccountData(account, "nuevo") == "viejo") then spawnPlayer (source, 2312.84375, -1.3126500844955, 26.7421875, 0, math.random (280,288), 0, 0) outputChatBox("Bienvenido de Vuelta "..getPlayerName(source).. "Diviertete!", source, 255, 0, 0, 255) end end addEventHandler("onPlayerLogin", getRootElement(), playerViejo) function onPlayerRegister(_, playeraccount) if (not getAccountData(playeraccount, "nuevo")) then setCameraMatrix(source, 2350.2368164063, 69.811370849609, 26.484375, 2340.9641113281, 12.886473655701, 26.3359375) setTimer(setCameraMatrix, 8000, 1, source, 2272.8959960938, -32.551116943359, 26.339841842651, 2315.6574707031, -28.518367767334, 26.3359375) end end addEventHandler("onPlayerLogin", getRootElement(), onPlayerRegister) Link to comment
AlvareZ_ Posted March 11, 2013 Author Share Posted March 11, 2013 Sigue sin andar , No hay error debug, Con mi cuenta admin no me muestra las setCameraMatrix y con la cuenta que me registre si me las muestra, y tambien si ya esta registrada me loggeo con la mia y no me spawnea y no me dice nada en el chat Link to comment
NodZen Posted March 11, 2013 Share Posted March 11, 2013 Sigue sin andar , No hay error debug, Con mi cuenta admin no me muestra las setCameraMatrix y con la cuenta que me registre si me las muestra, y tambien si ya esta registrada me loggeo con la mia y no me spawnea y no me dice nada en el chat Te falta if isObjectInACLGroup ( "user." .. accountname, aclGetGroup ( "admin" ) ) then Link to comment
AlvareZ_ Posted March 11, 2013 Author Share Posted March 11, 2013 Ya me Anda Sasuke!, Muchas Gracias a Los dos Link to comment
NodZen Posted March 11, 2013 Share Posted March 11, 2013 Ya me Anda Sasuke!, Muchas Gracias a Los dos Cual era el problema? o que te faltaba agregar? Link to comment
AlvareZ_ Posted March 11, 2013 Author Share Posted March 11, 2013 Como me lo dijo sasuke era Link to comment
NodZen Posted March 11, 2013 Share Posted March 11, 2013 Como me lo dijo sasuke era pero la camara no se queda alli? Link to comment
Recommended Posts