SA-MP Forums Archive
Samp function - 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: Samp function (/showthread.php?tid=547687)



Samp function - osman2571 - 24.11.2014

Is there any way to make some function who detect is player died 100 times


Re: Samp function - Sawalha - 24.11.2014

pawn Код:
new Deaths[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, reason)
{
      Deaths[playerid]+=1;
      if(Deaths[playerid] == 100)
      {
             // action to be taken here (100 deaths)
      }
      return 1;
}
that's an example.


Re: Samp function - Jonesy96 - 24.11.2014

Or you can use a MySQL database

Код:
forward deathcoount(playerid);
public deathcount(playerid){
	new query[900];
	new rows, fields;
	new deaths;
	format(query, sizeof(query), "SELECT * FROM `player_table` WHERE `playerid`=%d LIMIT 1;", playerid);
	mysql_query(connection, query);
	cache_get_data(rows,fields);

        if(rows){
	deaths = cache_get_field_content_int(0, "deaths");
		
	if(deaths == 100){
		//action here
	}
        }
	return 1;

}



AW: Re: Samp function - osman2571 - 24.11.2014

Quote:
Originally Posted by Sawalha
Посмотреть сообщение
pawn Код:
new Deaths[MAX_PLAYERS];
public OnPlayerDeath(playerid, killerid, reason)
{
      Deaths[playerid]+=1;
      if(Deaths[playerid] == 100)
      {
             // action to be taken here (100 deaths)
      }
      return 1;
}
that's an example.
oh i forgot for this thanks