JkR Posted March 11, 2014 Share Posted March 11, 2014 Buenas, en este script se trata de una tienda de armas, la tienda anda perfectamente pero al comprar, si cuando te desconectas y vuelves a conectar apareces con el dinero de antes de comprar, ya probe algunas funciones para que se guarde el dinero, espero que me puedan ayudar, aqui les dejo una de ellas. function onPlayerQuit ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then local money = getAccountData(playeraccount, "stats.money") setAccountData ( playeraccount, "stats.money", money ) end end function onPlayerLogin ( ) local playeraccount = getPlayerAccount ( source ) if ( playeraccount ) then local money = getAccountData ( playeraccount, "stats.money" ) setPlayerMoney(source, money) if ( money ) then setElementData ( source, "stats.money", money ) end end end addEventHandler ( "onPlayerQuit", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogout", getRootElement ( ), onPlayerQuit ) addEventHandler ( "onPlayerLogin", getRootElement ( ), onPlayerLogin ) Link to comment
Castillo Posted March 11, 2014 Share Posted March 11, 2014 Debe ser que en el script de comprar armas estas tomando el dinero client-side, lo que hace que no se sincronize con el servidor. Link to comment
JkR Posted March 11, 2014 Author Share Posted March 11, 2014 Entonces debo probar poniendo esas funciones en el server-side ? Link to comment
Castillo Posted March 11, 2014 Share Posted March 11, 2014 Tenes que poner todo lo que sea takePlayerMoney/setPlayerMoney en el server side. Link to comment
JkR Posted March 11, 2014 Author Share Posted March 11, 2014 Bien, lo intentaré, si no funciona te lo haré saber Link to comment
JkR Posted March 13, 2014 Author Share Posted March 13, 2014 Parece haber un problema y esque si pongo todo lo del dinero en server y eso, las tiendas no abren... pongo un ejemplo del script. function giveso () money = getPlayerMoney (source) if (money >= 6000) then player = getLocalPlayer() outputChatBox ("Usted compro Sawn Off $6000",225,225,0) takePlayerMoney(6000) giveWeapon (source,26,350,true) end end addEvent("giveso",true) addEventHandler("giveso",getRootElement(),giveso) Link to comment
Castillo Posted March 13, 2014 Share Posted March 13, 2014 geLocalPlayer es client side solamente. Link to comment
JkR Posted March 13, 2014 Author Share Posted March 13, 2014 Y que deberia poner entonces? Link to comment
Castillo Posted March 13, 2014 Share Posted March 13, 2014 function giveso ( ) local money = getPlayerMoney ( source ) if ( money >= 6000 ) then outputChatBox ( "Usted compro Sawn Off $6000", source, 225, 225, 0 ) takePlayerMoney ( source, 6000 ) giveWeapon ( source, 26, 350, true ) end end addEvent ( "giveso", true ) addEventHandler ( "giveso", getRootElement(), giveso ) Link to comment
JkR Posted March 13, 2014 Author Share Posted March 13, 2014 Bien, gracias Castillo... mañana probare si funciona y te confirmo Link to comment
Recommended Posts