SA-MP Forums Archive
Count problem:S - 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: Count problem:S (/showthread.php?tid=258669)



Count problem:S - Admigo - 31.05.2011

Heey all,

I made a donut pickup system.
But when i pickup the donut is says in gametext donut 0 out of 50.
This is the code:
Код:
	new string[128];
	format(string,sizeof(string),"Donut %d out of 50!",donutcount[playerid]);
	GameTextForPlayer(playerid,string,5000,5);
	
	if(pickupid==donut1)
	{
		if(istokendonut1[playerid]==1)
		{
		istokendonut1[playerid]=0;
		GivePlayerMoney(playerid,1000);
		donutcount[playerid]++;
		}
		if(istokendonut1[playerid]==0)
		{
		SendClientMessage(playerid,COLOR_RED,"You already found this donut!");
		}
	}
	if(pickupid==donut2)
	{
		if(istokendonut2[playerid]==1)
		{
		istokendonut2[playerid]=0;
		GivePlayerMoney(playerid,1000);
		donutcount[playerid]++;
		}
		if(istokendonut2[playerid]==0)
		{
		SendClientMessage(playerid,COLOR_RED,"You already found this donut!");
		}
	}
How can i fix this?

Thanks Admigo.


Re: Count problem:S - Admigo - 31.05.2011

Why he is not counting?


Re: Count problem:S - Admigo - 31.05.2011

I have this on top off script:
Код:
new donutcount[MAX_PLAYERS]=0;
new istokendonut1[MAX_PLAYERS]=0;
new istokendonut2[MAX_PLAYERS]=0;
And i change the the code but same problem:
Код:
if(pickupid==donut1)
	{
		if(istokendonut1[playerid]==0)
		{
		donutcount[playerid]++;
		new string[128];
		GivePlayerMoney(playerid,1000);
		donutcount[playerid]++;
		format(string,sizeof(string),"Donut %d out of 50!",donutcount);
		//GameTextForPlayer(playerid,string,5000,5);
		istokendonut1[playerid]=1;
		return GameTextForPlayer(playerid, string, 5000, 5);
		}
		if(istokendonut1[playerid]==1)
		{
		SendClientMessage(playerid,COLOR_RED,"You already found this donut!");
		}
	}
	if(pickupid==donut2)
	{
		if(istokendonut2[playerid]==0)
		{
		donutcount[playerid]++;
		new string[128];
		GivePlayerMoney(playerid,1000);
		format(string,sizeof(string),"Donut %d out of 50!",donutcount);
		//GameTextForPlayer(playerid,string,5000,5);
		istokendonut2[playerid]=1;
		return GameTextForPlayer(playerid, string, 1000, 5);
		}
		if(istokendonut2[playerid]==1)
		{
		SendClientMessage(playerid,COLOR_RED,"You already found this donut!");
		}
	}



Re: Count problem:S - Admigo - 31.05.2011

Its fixed! I deleted the [playerid] at donutcount but is this not count for every player?