SA-MP Forums Archive
[Pedido] Carregar armas da org por um arquivo - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Pedido] Carregar armas da org por um arquivo (/showthread.php?tid=597954)



Carregar armas da org por um arquivo - lKiller - 07.01.2016

Alguem pode me mandar um script assim que equpe a todos da org, pode ser resumido sу pra ter uma base de como ficaria o code na hora de carregar o arquivo e equipar, porfavor


Re: Carregar armas da org por um arquivo - Monotox - 07.01.2016

Use a funзгo Fread.

Код:
// Open "file.txt" in "read only" mode
new File:handle = fopen("file.txt", io_read),
 
	// Initialize "buf"
	buf[128];
 
// Check, if the file is opened
if(handle)
{
	// Success
 
	// Read the whole file
	while(fread(handle, buf)) print(buf);
 
	// Close the file
	fclose(handle);
}
else
{
	// Error
	print("The file \"file.txt\" does not exists, or can't be opened.");



Re: Carregar armas da org por um arquivo - lKiller - 07.01.2016

problema maior agr й na hora de equipar, tipo como coloco isso junto a setplayerweapon e carrego as armas que coloquei no arquivo


Re: Carregar armas da org por um arquivo - lKiller - 08.01.2016

Alguem pode ajudar?


Re: Carregar armas da org por um arquivo - GabrielCOP - 08.01.2016

https://sampforum.blast.hk/showthread.php?tid=597294

Salvamento

pawn Код:
bCini6_SetInt("Armas ORG.ini","Arma 1",ORG_Arma_1);
bCini6_SetInt("Armas ORG.ini","Balas arma 1",ORG_Arma_1);
bCini6_SetInt("Armas ORG.ini","Arma 2",ORG_Arma_2);
bCini6_SetInt("Armas ORG.ini","Balas arma 2",ORG_Arma_1);
bCini6_SetInt("Armas ORG.ini","Arma 3",ORG_Arma_3);
bCini6_SetInt("Armas ORG.ini","Balas arma 3",ORG_Arma_1);
Carregamento

pawn Код:
GivePlayerWeapon(playerid,bCini6_ReadInt("Armas ORG.ini","Arma 1"),bCini6_ReadInt("Armas ORG.ini","Balas arma 1"));
GivePlayerWeapon(playerid,bCini6_ReadInt("Armas ORG.ini","Arma 2"),bCini6_ReadInt("Armas ORG.ini","Balas arma 2"));
GivePlayerWeapon(playerid,bCini6_ReadInt("Armas ORG.ini","Arma 3"),bCini6_ReadInt("Armas ORG.ini","Balas arma 3"));
A lуgica tб aн, agora й sу adaptar ao seu gm.