supergonkas Posted May 13, 2013 Share Posted May 13, 2013 i just have a small question is there a way to make a save system that saves costum stuff? Link to comment
Castillo Posted May 13, 2013 Share Posted May 13, 2013 What do you mean by "custom stuff"? Link to comment
supergonkas Posted May 13, 2013 Author Share Posted May 13, 2013 i have the bone_attach scrpit and i was thinking if it was possible to store it as "save" Link to comment
supergonkas Posted May 13, 2013 Author Share Posted May 13, 2013 how i could do that ? Link to comment
xXMADEXx Posted May 13, 2013 Share Posted May 13, 2013 Its simple... When the player quits, get all his attached elements, save it (how ever you want,) when he joins, check to see if he haves any saved items. Link to comment
supergonkas Posted May 13, 2013 Author Share Posted May 13, 2013 the part of to get the attachments and check i can do but can you explain me how can i save them? Link to comment
xXMADEXx Posted May 13, 2013 Share Posted May 13, 2013 getAccountData setAccountData - For default saving way... Not MySQL/SQL Link to comment
supergonkas Posted May 13, 2013 Author Share Posted May 13, 2013 ok gonna try make a save system,and i will put here the result Link to comment
supergonkas Posted May 14, 2013 Author Share Posted May 14, 2013 i tried to make this can you check if it makes any sense function onPlayerQuit(player,text) playeraccount = getPlayerAccount(player) if (playeraccount) bone = exports.bone_attach:getElementBoneAttachmentDetails(object[source]) then setAccountData(playeraccount,"number",bone) end end) function onPlayerLogin() playeraccount = getPlayerAccount(player) if (playeraccount) then local playermoney = exports.bone_attach:isElementAttachedToBone(object[source]) number = getAccountData(playeraccount,"number") if ( playermoney ) then end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin) Link to comment
Moderators IIYAMA Posted May 14, 2013 Moderators Share Posted May 14, 2013 All players have an account, even the ones that did not login. but only people that aren't logged in do have a GuestAccount. (not login) if not isGuestAccount ( account ) then -- check if the player is logged in. Link to comment
supergonkas Posted May 14, 2013 Author Share Posted May 14, 2013 when i was tryig it it didnt worked and i was logged in ,why? Link to comment
Moderators IIYAMA Posted May 14, 2013 Moderators Share Posted May 14, 2013 pls copie correctly. addEventHandler ( "onPlayerQuit", root, function (quiteType)--onPlayerQuit local playeraccount = getPlayerAccount(source) if not isGuestAccount ( playeraccount) then setAccountData(playeraccount,"number",exports.bone_attach:getElementBoneAttachmentDetails(object[source]) ) end end) addEventHandler ( "onPlayerLogin", root, function ()--onPlayerLogin local playeraccount = getPlayerAccount(source) local playermoney = exports.bone_attach:isElementAttachedToBone(object[source]) local number = getAccountData(playeraccount,"number") if playermoney then end end) Link to comment
supergonkas Posted May 14, 2013 Author Share Posted May 14, 2013 why it doensnt work ? addEventHandler ( "onPlayerQuit", root, function (quiteType)--onPlayerQuit local playeraccount = getPlayerAccount(source) if not isGuestAccount ( playeraccount) then setAccountData(playeraccount,"number",exports.bone_attach:getElementBoneAttachmentDetails(object[source]) ) end end) addEventHandler ( "onPlayerLogin", root, function ()--onPlayerLogin local playeraccount = getPlayerAccount(source) local playermoney = exports.bone_attach:isElementAttachedToBone(object[source]) local number = getAccountData(playeraccount,"number") if playermoney then exports.bone_attach:attachElementToBone(object[source],source,1,0,0,0.1,0,0,0) end end) Link to comment
Moderators IIYAMA Posted May 14, 2013 Moderators Share Posted May 14, 2013 pls /debugscript 3 "object[source]" table does exist? Link to comment
iPrestege Posted May 14, 2013 Share Posted May 14, 2013 There's no need to get the player account when the player login because the account is already defined on the event parameters : -- # Server Side addEventHandler ( "onPlayerLogin", root, function ( _,account ) local playermoney = exports.bone_attach:isElementAttachedToBone(object[source]) local number = getAccountData(account,"number") if playermoney then exports.bone_attach:attachElementToBone(object[source],source,1,0,0,0.1,0,0,0) end end ) Link to comment
supergonkas Posted May 15, 2013 Author Share Posted May 15, 2013 i got this but but why it still doesnt work? addEventHandler ( "onPlayerQuit", root, function (quiteType)--onPlayerQuit local playeraccount = getPlayerAccount(source) if not isGuestAccount ( playeraccount) then setAccountData(playeraccount,"number",exports.bone_attach:getElementBoneAttachmentDetails(object[source]) ) end end) -- # Server Side addEventHandler ( "onPlayerLogin", root, function ( _,account ) local playermoney = exports.bone_attach:isElementAttachedToBone(object[source]) local number = getAccountData(account,"number") if playermoney then exports.bone_attach:attachElementToBone(object[source],source,1,0,0,0.1,0,0,0) end end ) Link to comment
iPrestege Posted May 15, 2013 Share Posted May 15, 2013 Where's the object defined at? Link to comment
supergonkas Posted May 15, 2013 Author Share Posted May 15, 2013 the object[source] is from another resource Link to comment
iPrestege Posted May 15, 2013 Share Posted May 15, 2013 Lol! I think you are joking ? Or what? And you're asking why the script doesn't work? Add the code with the resource server side file . Link to comment
supergonkas Posted May 15, 2013 Author Share Posted May 15, 2013 i added with resource server file but still doesnt work i logout ,but when i login back it dont saty at my head anymore Link to comment
iPrestege Posted May 15, 2013 Share Posted May 15, 2013 Post the whole server side script if you don't mind . Link to comment
supergonkas Posted May 15, 2013 Author Share Posted May 15, 2013 here it is -- # Server Side object = { } addEvent("CreateTheObject",true) addEventHandler("CreateTheObject",getRootElement(), function ( Model ) if ( object[source] and isElement ( object[source] ) ) then destroyElement ( object[source] ) end local x,y,z = getElementPosition ( source ) object[source] = createObject ( Model , x , y , z ) exports.bone_attach:attachElementToBone(object[source],source,1,0,0,0.1,0,0,0) if getElementModel ( object[source] ) == 3515 then setObjectScale ( object[source] , 0.2 ) end if getElementModel ( object[source] ) == 1248 then setObjectScale ( object[source] , 1.3 ) exports.bone_attach:attachElementToBone(object[source],source,1,0,0.03,0.1,0,0,180) end if getElementModel ( object[source] ) == 2045 then setObjectScale ( object[source] , 1 ) exports.bone_attach:attachElementToBone(object[source],source,12,-0.2,0,0.08,0,0,90) end if getElementModel ( object[source] ) == 13562 then setObjectScale ( object[source] , 0.2 ) exports.bone_attach:attachElementToBone(object[source],source,1,0,0.03,0.2,0,0,0) end if getElementModel ( object[source] ) == 1512 then setObjectScale ( object[source] , 0.1 ) setElementAlpha ( object[source] , 0 ) exports.bone_attach:attachElementToBone(object[source],source,1,0,0.03,0.1,0,0,180) end if getElementModel ( object[source] ) == 3524 then setObjectScale ( object[source] , 0.4 ) exports.bone_attach:attachElementToBone(object[source],source,1,0,0.036,-0.8,0,0,180) end if getElementModel ( object[source] ) == 2908 then setObjectScale ( object[source] , 1.4 ) exports.bone_attach:attachElementToBone(object[source],source,1,0,0.1,0.1,270,90,0) end if getElementModel ( object[source] ) == 1485 then setObjectScale ( object[source] , 1.4 ) exports.bone_attach:attachElementToBone(object[source],source,1, -0.01, -0.01, -0.035, 0, 90, 0 ) end if getElementModel ( object[source] ) == 330 then setObjectScale ( object[source] , 1 ) exports.bone_attach:attachElementToBone(object[source],source,12, 0, 0, 0.01, 0, -50, 0 ) end if getElementModel ( object[source] ) == 3027 then setObjectScale ( object[source] , 1.3 ) exports.bone_attach:attachElementToBone(object[source],source,1, -0.01, 0.09, 0, 90, 90, 90 ) smoke = createObject ( 1485 , x , y , z ) exports.bone_attach:attachElementToBone(smoke,source,1, -0.02, 0.06, 0.03, 90, 90, 0 ) setElementAlpha ( smoke , 0 ) end if getElementModel ( object[source] ) == 1485 then setObjectScale ( object[source] , 1.4 ) exports.bone_attach:attachElementToBone(object[source],source,1, -0.01, -0.01, -0.035, 90, 0, 0 ) end if getElementModel ( object[source] ) == 1736 then setElementDoubleSided ( object[source], true ) exports.bone_attach:attachElementToBone(object[source],source,1, 0, 0, 0, 0, 0, 180 ) end if getElementModel ( object[source] ) == 2589 then setElementDoubleSided ( object[source], true ) exports.bone_attach:attachElementToBone(object[source],source,1, 0, 0, -0.9, 0, 180, 180 ) end if getElementModel ( object[source] ) == 1786 then setElementDoubleSided ( object[source], true ) exports.bone_attach:attachElementToBone(object[source],source,1, 0, -0.15, -0.2, 0, 0, 180 ) end if getElementModel ( object[source] ) == 16779 then setElementDoubleSided ( object[source], true ) exports.bone_attach:attachElementToBone(object[source],source,1, 0, 0, -0.1, 0, 180, 180 ) end if getElementModel ( object[source] ) == 3528 then setObjectScale ( object[source] , 0.09 ) setElementDoubleSided ( object[source], true ) exports.bone_attach:attachElementToBone(object[source],source,1, 0.018, 0.1, 0.1, 0, 0, 90 ) end if getElementModel ( object[source] ) == 7093 then setObjectScale ( object[source] , 0.2 ) setElementDoubleSided ( object[source], true ) setElementCollisionsEnabled ( object[source], true ) exports.bone_attach:attachElementToBone(object[source],source,1, 0, 0.6, 0.2, 0, 0, 0 ) end end ) addEventHandler ( "onPlayerQuit", root, function (quiteType)--onPlayerQuit local playeraccount = getPlayerAccount(source) if not isGuestAccount ( playeraccount) then setAccountData(playeraccount,"number",exports.bone_attach:getElementBoneAttachmentDetails(object[source]) ) end end) addEventHandler ( "onPlayerLogin", root, function ( _,account ) local playermoney = exports.bone_attach:isElementAttachedToBone(object[source]) local number = getAccountData(account,"number") if playermoney then exports.bone_attach:attachElementToBone(object[source],source,1,0,0,0.1,0,0,0) end end ) Link to comment
iPrestege Posted May 15, 2013 Share Posted May 15, 2013 You have to set the account data when the player creating the object for the first time and save it then get the data when login and create another one that's all . Link to comment
supergonkas Posted May 15, 2013 Author Share Posted May 15, 2013 how i do that (which comands) ? 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