Nie działa mi nVault, a jak nie działa nVault to cały plugin
LOGI
L 05/20/2010 - 20:08:10: Start of error session. L 05/20/2010 - 20:08:10: Info (map "de_dust") (file "addons/amxmodx/logs/error_20100520.log") L 05/20/2010 - 20:08:10: [AMXX] Plugin ("gta_mod.amxx") is setting itself as failed. L 05/20/2010 - 20:08:10: [AMXX] Plugin says: Error opening nVault L 05/20/2010 - 20:08:10: [AMXX] Displaying debug trace (plugin "gta_mod.amxx") L 05/20/2010 - 20:08:10: [AMXX] Run time error 1: forced exit L 05/20/2010 - 20:08:10: [AMXX] [0] gta_mod.sma::plugin_cfg (line 765) L 05/20/2010 - 20:08:27: Start of error session. L 05/20/2010 - 20:08:27: Info (map "de_dust") (file "addons/amxmodx/logs/error_20100520.log")
KOD
new g_Vault; //Global var to hold our vault handle
new money2[33]
plugin_init(){
//ZAPIS
g_Vault=nvault_open("GTA") //tutaj podajemy "nazwe" pliku z danymi
if (g_Vault == INVALID_HANDLE)
set_fail_state( "Nie moge otworzyc pliku ");
//KONIEC ZAPISU
}
public load_money(id){
new name[35]
get_user_name(id,name,34)
new szKey[40], vaultdata[256]
formatex( szKey , 39 , "%sMONEY" , name);
new iMoney = nvault_get( g_Vault , szKey );
//If our money key was found, set the users money to the value we read from vault and
//delete the key so the player will not get the same money again.
if ( iMoney )
{
cs_set_user_money( id , iMoney , 1 );
nvault_remove( g_Vault , szKey );
client_print( id , print_chat , "* Your money was loaded from vault: $%d" , iMoney );
}
new money2temp[33]
parse(vaultdata,money2temp,32) // wydobywamy z ciagu vaultdata nasze dane
money2[id]=str_to_num(money2temp) // przypisujemy danym ich wartosci wczytane
return PLUGIN_CONTINUE
}
public save_money(id){
new name[35]
get_user_name(id,name,34)
new szMoney[7]; //Data holder for the money amount
new szKey[40]; //Key used to save money "STEAM_0:0:1234MONEY"
formatex( szKey , 39 , "%sMONEY" , name );
formatex( szMoney , 6 , "%d" , money2[id] );
nvault_set( g_Vault , szKey , szMoney );
// client_print( id , print_chat , "* Your money was saved to vault" );
return PLUGIN_CONTINUE
}
Użytkownik Frajer edytował ten post 22.05.2010 11:01