SA-MP Forums Archive
Need some help here.... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Need some help here.... (/showthread.php?tid=77287)



Need some help here.... - Trill - 10.05.2009

Well, im making a Gang-Safe system, i have a command /gangbankbalance it is supposed to show you the Money, Materials and Drugs amount in the Gangs Bank, i have the scriptfile there, i manually edit'd the scriptfile making the shit like 100 money 50 mats w/e ya get what im saying
it should print whatever the Scriptfile Contains, (money,mats,drugs)
However, it only prints: Money: 0 Mats: 0 Drugs: 0

Heres the bits of script:

Код:
enum dSafe1
{
	MoneyAmmount,
	MatsAmmount,
	DrugsAmmount,
};
new safe1[dSafe1];
Код:
		if(strcmp(cmd,"/gangbankbalance",true)==0)
  {
 	if(IsPlayerConnected(playerid))
	 	  {
		if(PlayerInfo[playerid][pMember] == 5 || PlayerInfo[playerid][pLeader] == 5)
		  {
		  format(string, sizeof(string), "*Money: $%d Mats: %d Drugs: %d",safe1[MoneyAmmount] ,safe1[MatsAmmount] ,safe1[DrugsAmmount]);
			SendClientMessage(playerid, COLOR_WHITE, string);
		  }
		  }
		  }
Код:
public LoadGangSafe1()
{
	new arrCoords[4][64];
	new strFromFile2[256];
	new File: file = fopen("safe1.ini", io_read);
	if (file)
	{
		fread(file, strFromFile2);
		split(strFromFile2, arrCoords, ',');
		safe1[MoneyAmmount] = strval(arrCoords[0]);
		safe1[MatsAmmount] = strval(arrCoords[1]);
		safe1[DrugsAmmount] = strval(arrCoords[2]);
		fclose(file);
	}
	return 1;
}

public SaveGangSafe1()
{
	new coordsstring[256];
	format(coordsstring, sizeof(coordsstring), "%d,%d,%d", safe1[MoneyAmmount], safe1[MatsAmmount], safe1[DrugsAmmount]);
	new File: file2 = fopen("safe1.ini", io_write);
	fwrite(file2, coordsstring);
	fclose(file2);
	return 1;
}
when the scriptfile has this:
Код:
2,100,5
Anything you all see thats wrong with it?


Re: Need some help here.... - Trill - 10.05.2009

No help?


Re: Need some help here.... - Trill - 10.05.2009

edit'd first post, hopefully itll make more sense so i can get some help


Re: Need some help here.... - Backwardsman97 - 10.05.2009

Why don't you try and use something like dini?


Re: Need some help here.... - Trill - 10.05.2009

Could you elaborate? Never heard of that before...

&+ Im also somewhat looking for an explanation as to why this wont work so i can avoid it in the future