prigat10 Posted September 28, 2011 Report Share Posted September 28, 2011 Salut!Am facut asta dar n use salveaza...creaza fisierul User.txt dar nu salveaza si armele...[pawn]#define PATH "Weapons" SaveWeaponsToFile(playerid){ new i, path[50], string[128], weaponid, ammo; path = GetPlayerFormattedName(playerid); if (!dini_Exists(path)) dini_Create(path); for (i=0; i<13; i++) { GetPlayerWeaponData(playerid,i,weaponid,ammo); format(string,sizeof(string),"Weapon - %d",i); dini_IntSet(path,string,weaponid); format(string,sizeof(string),"AmmoID - %d",i); dini_IntSet(path,string,ammo == 65535 ? 0 : ammo); }}[/pawn]Multumesc! Link to comment Share on other sites More sharing options...
LosTSouL Posted September 30, 2011 Report Share Posted September 30, 2011 Incearca asta , pune-o sub forma de FS[pawn]#include <a_samp>#include <dudb>public OnGameModeInit() SendRconCommand("exit");public OnPlayerSpawn(playerid) LoadWeapons(playerid);public OnFilterScriptInit() printf("Weaponsave FS loaded!");public OnPlayerDisconnect(playerid, reason) SaveWeapons(playerid);stock LoadWeapons(playerid){ new pname[MAX_PLAYER_NAME]; if(!GetPlayerName(playerid, pname, MAX_PLAYER_NAME)) return false; if(!udb_Exists(pname)) udb_Create(pname, ""); for(new wep[8], amm[6], i; i < 13; i++) { format(amm, sizeof amm, "Ammo%d", i); format(wep, sizeof wep, "Weapon%d", i); GivePlayerWeapon(playerid, dUserINT(pname).(wep), dUserINT(pname).(amm)); } return true;}stock SaveWeapons(playerid){ new pname[MAX_PLAYER_NAME]; if(!GetPlayerName(playerid, pname, MAX_PLAYER_NAME)) return false; if(!udb_Exists(pname)) udb_Create(pname, ""); for(new wep[8], amm[6], i, cwep, camm; i < 13; i++) { format(amm, sizeof amm, "Ammo%d", i); format(wep, sizeof wep, "Weapon%d", i); GetPlayerWeaponData(playerid, i, cwep, camm); dUserSetINT(pname).(amm, camm); dUserSetINT(pname).(wep, cwep); } return true;}[/pawn] Link to comment Share on other sites More sharing options...
prigat10 Posted September 30, 2011 Author Report Share Posted September 30, 2011 le am sub forma de fs inlocuiesc doar loadweapons si saveweapons? Link to comment Share on other sites More sharing options...
prigat10 Posted October 7, 2011 Author Report Share Posted October 7, 2011 Ma ajuta cineva?la inceput a mers iar dupa 2 zile nu a mai functionat! Link to comment Share on other sites More sharing options...
PawnFox Posted October 8, 2011 Report Share Posted October 8, 2011 Nu fa 3x Post , o sa primesti WARN! Asteapta sa iti raspunda cineva! 94.23.120.101:7778 Link to comment Share on other sites More sharing options...
heker Posted October 8, 2011 Report Share Posted October 8, 2011 Ma ajuta cineva?la inceput a mers iar dupa 2 zile nu a mai functionat!Daca nu tia raspuns nimeni insemna ca nimeni nu stie 10% warn pentru 2X post chiar 3 Link to comment Share on other sites More sharing options...
IstuntmanI Posted October 8, 2011 Report Share Posted October 8, 2011 1. Nu este 3x post, primul l-a facut cand a creeat topicul, a postat cineva, apoi a facut 2x post, dar al 2-lea il facuse dupa 7 zile, e permis.2. Unwarned.3. Nu pare nimic in neregula... Sigur folosesti functia SaveWeaponsToFile undeva ? Link to comment Share on other sites More sharing options...
prigat10 Posted October 8, 2011 Author Report Share Posted October 8, 2011 da o folosesc,adica am o comanda /saveweapons si e pusa functia SaveWeaponsToFile(playerid).Sau daca ai putea sa imi zici cum sa il modific sa fie alt sistem de salvare? Link to comment Share on other sites More sharing options...
Ph3oNiX Posted October 10, 2011 Report Share Posted October 10, 2011 [pawn]#include <a_samp>#include <dini>#include <dudb>#include <dutils>#include <Colors>#define XFile "WeapnsX/%s.ini"public OnFilterScriptInit(){ return 1;}public OnFilterScriptExit(){ return 1;}public OnPlayerConnect(playerid){ new str[256]; format(str,sizeof(str),XFile,pName(playerid)); if(!dini_Exists(str) { dini_Create(str); dini_IntSet(str,"WeaponSlot1",0); {}public OnPlayerDiscconnect(playerid,reason){ new str[256]; format(str,sizeof(str),XFile,pName(playerid)); for(new wep[8], amm[6], i, cwep, camm; i < 13; i++) { format(amm, sizeof amm, "Ammo%d", i); format(wep, sizeof wep, "Weapon%d", i); GetPlayerWeaponData(playerid, i, cwep, camm); dini_IntSet(str,"WeaponSlot1",GetPlayerWeaponData(playerid, i, cwep, camm)); }} public OnPlayerSpawn(playerid){ for(new wep[8], amm[6], i; i < 13; i++) { format(amm, sizeof amm, "Ammo%d", i); format(wep, sizeof wep, "Weapon%d", i); GivePlayerWeapon(playerid, dUserINT(pname).(wep), dUserINT(pname).(amm)); }}stock pName(playerid){ new name[MAX_PLAYER_NAME];GetPlayerName(playerid,name,sizeof(name));return name;}[/pawn]sau alta metoda:....adaugaLoadWeapon(playerid); la OnPlayerSpawn(playerid)si SaveWeapons(playerid); la comanda aia a ta...pentru ca scriptu meu l-am facut in cateva minute si nu l-am verificat de coduri.. Link to comment Share on other sites More sharing options...
Question
prigat10
Salut!Am facut asta dar n use salveaza...creaza fisierul User.txt dar nu salveaza si armele...
[pawn]
#define PATH "Weapons"
SaveWeaponsToFile(playerid)
{
new i, path[50], string[128], weaponid, ammo;
path = GetPlayerFormattedName(playerid);
if (!dini_Exists(path)) dini_Create(path);
for (i=0; i<13; i++)
{
GetPlayerWeaponData(playerid,i,weaponid,ammo);
format(string,sizeof(string),"Weapon - %d",i);
dini_IntSet(path,string,weaponid);
format(string,sizeof(string),"AmmoID - %d",i);
dini_IntSet(path,string,ammo == 65535 ? 0 : ammo);
}
}[/pawn]
Multumesc!
Link to comment
Share on other sites
8 answers to this question
Recommended Posts