SA-MP Forums Archive
Problem with array - 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)
+--- Thread: Problem with array (/showthread.php?tid=629962)



Problem with array - Flamehaze7 - 06.03.2017

Код:
UccisioniGDM[issuerid] += amount;
	new string[256];
	format(string,sizeof(string),"Danno fatto: %0.f", UccisioniGDM[issuerid]);
	SendClientMessage(issuerid,Lightblue,string);

	if(UccisioniGDM[issuerid] >= 1500.0)
	{
	new nameDM[MAX_PLAYER_NAME];
	new stringDM[256];
	GetPlayerName(issuerid,nameDM,128);
	format(stringDM,sizeof(stringDM),"Il vincitore dell'Evento DM e' %s, ha guadagnato 1 Punto Esperienza e 15000$!",nameDM);

	GivePlayerMoney(issuerid,15000);
	PlayerInfo[issuerid][pExp]++;
	if(PlayerInfo[issuerid][pExp] >= 20)
	{
	LevelUp(issuerid);
	}
	SendClientMessageToAll(Gold,stringDM);
I put this in "OnPlayerTakeDamage" and i have create an if with if UccisioniGDM[issuerid] > 1500.0 it finishes the event
but if i get shot once it finishes :/ can't understand what's wrong in this code..

UccisioniGDM[issuerid] is the array that stores the damage done in the DM Event


Re: Problem with array - Jefff - 06.03.2017

1. UccisioniGDM must be a Float
2. You need reset array when event start UccisioniGDM[ id ] = 0.0;
3. issuerid must be != INVALID_PLAYER_ID


Re: Problem with array - Flamehaze7 - 06.03.2017

Quote:
Originally Posted by Jefff
Посмотреть сообщение
1. UccisioniGDM must be a Float
2. You need reset array when event start UccisioniGDM[ id ] = 0.0;
3. issuerid must be != INVALID_PLAYER_ID
How can i switch UccisioniGDM to a float? A float that is bound to issuerid


Re: Problem with array - Jefff - 06.03.2017

on top must be
pawn Код:
new Float:UccisioniGDM[MAX_PLAYERS];