SA-MP Forums Archive
How do I "%i/i% PLAYERS" to appear... - 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: How do I "%i/i% PLAYERS" to appear... (/showthread.php?tid=261732)



How do I "%i/i% PLAYERS" to appear... - Join7 - 14.06.2011

How do I "%i/i% PLAYERS" to appear after I have chosen with which skin to let me go. Once you choose which Civilian me spawn, then display "%i/i% PLAYERS"

Код:
#include <a_samp>
#define SEC1 1000
#define SEC2 2000
#define SEC5 5000

new Text:PlayersOnServer;
new string[16];
new MaxP;
new totalon;

public OnFilterScriptInit()
{
	MaxP = GetMaxPlayers();
	drawagain();
	SetTimer("pOnline", SEC2, 1);
	return 1;
}

public OnFilterScriptExit()
{
	for(new i=0; i<MAX_PLAYERS; i++) {
		TextDrawHideForPlayer(i, PlayersOnServer);
	}
	return 1;
}

forward drawagain();
public drawagain(){
	if(PlayersOnServer){
		TextDrawDestroy(PlayersOnServer);
	}
	format(string, sizeof(string), "%i/%i PLAYERS", totalon, MaxP);
	PlayersOnServer = TextDrawCreate(30,326, string);
	return 1;
}

forward pOnline();
public pOnline(){
	totalon = 0;
	for(new i=0; i<MAX_PLAYERS; i++) {
		if(IsPlayerConnected(i)) {
			if(totalon == 0){
				totalon = 1;
			}
			else if (totalon > 0){
				totalon++;
			}
		}
	}
	
	drawagain();
	TextDrawFont(PlayersOnServer,2);
	TextDrawUseBox(PlayersOnServer,0);
	TextDrawColor(PlayersOnServer,0xFFFFFFFF);
	TextDrawAlignment(PlayersOnServer, 1);
    
	for(new i=0; i<MAX_PLAYERS; i++) {
		if(IsPlayerConnected(i)) {
			TextDrawShowForPlayer(i, PlayersOnServer);
		}
		else {
			TextDrawHideForPlayer(i, PlayersOnServer);
		}
	}
	return 1;
}



Re: How do I "%i/i% PLAYERS" to appear... - Join7 - 15.06.2011

idea?