Raised This Month: $51 Target: $400
 12% 

[Ayuda]Guardar una variable


  
 
 
Thread Tools Display Modes
Author Message
BlackFur
BANNED
Join Date: Apr 2012
Location: RCL
Old 12-20-2012 , 07:22   [Ayuda]Guardar una variable
#1

Bueno vengo a pedir como guardar una variable en mi caso
PHP Code:
new g_serverkill 
es que no se como :p , y la quiero guardar para hacer algo con ella luego.
BlackFur is offline
lucas_7_94
Leche Loco
Join Date: Mar 2009
Location: Argentina
Old 12-20-2012 , 08:24   Re: [Ayuda]Guardar una variable
#2

Guardar una variable en donde ? En otra variable , en una base de datos , en un archivo ?
__________________
ATWWMH - MiniDuels
Madness is like gravity, just need a little push.
lucas_7_94 is offline
Send a message via Skype™ to lucas_7_94
BlackFur
BANNED
Join Date: Apr 2012
Location: RCL
Old 12-20-2012 , 10:14   Re: [Ayuda]Guardar una variable
#3

fvault es para luego calcular un valor
BlackFur is offline
GalaxyA
BANNED
Join Date: Sep 2012
Location: Noob Member
Old 12-20-2012 , 12:39   Re: [Ayuda]Guardar una variable
#4

Pero Black postea el code po ¬¬
GalaxyA is offline
Send a message via MSN to GalaxyA
Roccoxx
AlliedModders Donor
Join Date: Jan 2012
Location: Argentina
Old 12-20-2012 , 13:15   Re: [Ayuda]Guardar una variable
#5

fvault
https://forums.alliedmods.net/showthread.php?t=114458
https://forums.alliedmods.net/showthread.php?t=76453

nvault

http://forums.alliedmods.net/showpos...63&postcount=1
https://forums.alliedmods.net/showthread.php?t=49676

ahi tenes
__________________
Tutorials here (Spanish)

Like as another Pijudo said: "Tired and retired"
Roccoxx is offline
Send a message via MSN to Roccoxx
BlackFur
BANNED
Join Date: Apr 2012
Location: RCL
Old 12-20-2012 , 13:40   Re: [Ayuda]Guardar una variable
#6

creo que no entienden es una variable del server no de un usuario :c
BlackFur is offline
Roccoxx
AlliedModders Donor
Join Date: Jan 2012
Location: Argentina
Old 12-20-2012 , 13:48   Re: [Ayuda]Guardar una variable
#7

y bueno.
PHP Code:
new const g_vault_name[] = "AP";

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Dedicado a meTaLiCroSS xD
    
register_forward(FM_Sys_Error"fw_svshutdown"// El nombre de 
    
register_forward(FM_GameShutdown"fw_svshutdown"// las forwards
    
register_forward(FM_ServerDeactivate "fw_svshutdown"// lo dice todo
    
register_forward(FM_ChangeLevel"fw_svshutdown"// Gracias eXacT :P
    
    // Evento
    
register_logevent("logevent_round_end"2"1=Round_End")
}

public 
logevent_round_end() // Al finalizar la ronda
{
        
SaveAp()
}

LoadAp() // Funcion para cargar AP
{   
    new 
name[32] = "sv"
    
new data[16]; 
    if(
fvault_get_data(g_vault_namenamedata15)) // Si se obtiene la data
    
{
        
haces lo tuyo
    
}
}

SaveAp() // Funcion para guardar AP
{
    new 
name[32] = "sv"
    
new data[16]; // Obtenemos los 
    
num_to_str(g_serverkilldata15); // g_serverkill
    
    
fvault_set_data(g_vault_namenamedata); // y guardamos
}

public 
fw_svshutdown() // Si el servidor cae
{
        
SaveAp() // Guardamos..

probalo lo hice por aca
__________________
Tutorials here (Spanish)

Like as another Pijudo said: "Tired and retired"
Roccoxx is offline
Send a message via MSN to Roccoxx
YakumoHiratsuhi
Veteran Member
Join Date: Dec 2010
Location: Dreαmlαnd.
Old 12-20-2012 , 16:12   Re: [Ayuda]Guardar una variable
#8

igualmente como hizo Roccoxx, las vaults se manejan por "keys" que son los identificadores de cada registro, el guardo la key como "sv" y cada vez que se carga, guarda los datos de g_serverkill.

+1
__________________
"Podra parecer ridiculo o imposible, pero este es el camino que seguimos los verdaderos hombres, si hay un muro en el camino, lo derribamos, si no hay camino, haremos uno, con nuestras propias manos, porque el magma de nuestro corazón arde en llamas."
YakumoHiratsuhi is offline
Send a message via MSN to YakumoHiratsuhi
BlackFur
BANNED
Join Date: Apr 2012
Location: RCL
Old 12-20-2012 , 18:50   Re: [Ayuda]Guardar una variable
#9

a gracias tonce la key para el servidor es "sv"?
BlackFur is offline
Roccoxx
AlliedModders Donor
Join Date: Jan 2012
Location: Argentina
Old 12-20-2012 , 18:57   Re: [Ayuda]Guardar una variable
#10

si, aunque en lugar de crear 2 veces name la podes hacer una vez, lo mio fue solo un ejemplo
__________________
Tutorials here (Spanish)

Like as another Pijudo said: "Tired and retired"

Last edited by Roccoxx; 12-20-2012 at 18:59.
Roccoxx is offline
Send a message via MSN to Roccoxx
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:48.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode