I got 1 Error !!Help Pls!!
#1

Hello, i tried to add a players online number but i got 1 error here
Код:
D:\GTA PROG\for samp\servers\DHTDM-RP ™\Gamemodes\SPTDM3E.pwn(33900) : error 010: invalid function or declaration
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
line:
Код:
//Players online
    //==========================================================================
>>33900> error here> On‌lineText = TextDrawCreate(192.000000, 411.000000, " ");
	TextDrawBackgroundColor(OnlineText, 255);
	TextDrawFont(OnlineText, 3);
	TextDrawLetterSize(OnlineText, 0.430000, 1.600000);
	TextDrawColor(OnlineText, -1);
	TextDrawSetOutline(OnlineText, 0);
	TextDrawSetProportional(OnlineText, 1);
	TextDrawSetShadow(OnlineText, 1);
The Script :
Код:
new Text:OnlineText;
//---------
format(strings, 100, "~y~Jugadores Online: ~r~%d/100",GetOnLinePlayers());
    TextDrawSetString(OnlineText, strings);
    TextDrawShowForPlayer(playerid, OnlineText);
//--------------------
stock GetOnLinePlayers()
{
	new OnLine;
	for(new i, g = GetMaxPlayers(); i < g; i++)
		if(IsPlayerConnected(i))
			OnLine++;
	return OnLine;
}
//Players online
    //==========================================================================
	On‌lineText = TextDrawCreate(192.000000, 411.000000, " ");
	TextDrawBackgroundColor(OnlineText, 255);
	TextDrawFont(OnlineText, 3);
	TextDrawLetterSize(OnlineText, 0.430000, 1.600000);
	TextDrawColor(OnlineText, -1);
	TextDrawSetOutline(OnlineText, 0);
	TextDrawSetProportional(OnlineText, 1);
	TextDrawSetShadow(OnlineText, 1);
Reply
#2

Код:
new Text:OnlineText;
//---------
format(strings, 100, "~y~Jugadores Online: ~r~%d/100",GetOnLinePlayers());
    TextDrawSetString(OnlineText, strings);
    TextDrawShowForPlayer(playerid, OnlineText);
//--------------------
stock GetOnLinePlayers()
{
	new OnLine;
	for(new i, g = GetMaxPlayers(); i < g; i++)
		if(IsPlayerConnected(i))
			OnLine++;
	return OnLine;
}
//Players online
    //==========================================================================
	On‌lineText = TextDrawCreate(192.000000, 411.000000, " ");
	TextDrawBackgroundColor(OnlineText, 255);
	TextDrawFont(OnlineText, 3);
	TextDrawLetterSize(OnlineText, 0.430000, 1.600000);
	TextDrawColor(OnlineText, -1);
	TextDrawSetOutline(OnlineText, 0);
	TextDrawSetProportional(OnlineText, 1);
	TextDrawSetShadow(OnlineText, 1);
You need to put those codes i marked with red/green colors under callbacks/functions. Put code i marked red under OnGameModeInit() callback, and the green one under OnPlayerConnect().
Reply
#3

ThanX Man But Can i change the position of That?
Reply
#4

hey bro i got another problem when players close it's still with the last number of players
if 4 players online and they close it's still 4/20 ??
Reply
#5

Any Help!!
Reply
#6

Quote:
Originally Posted by vikoo
Посмотреть сообщение
hey bro i got another problem when players close it's still with the last number of players
if 4 players online and they close it's still 4/20 ??
Because you need to update it when they disconnect, or have it linked to a timer to update it constantly.
Reply
#7

nothing must write in "Onplayerdisconnect" ?
Reply
#8

Yea, at least a -- for the variable that tracks current players.

-- is -1, ++ is +1.


Код:
pPlayerCount--;
Reply
#9

where i must add -- ?

i added -- , ++ in first line here right?
onplayerconnect
Код:
    format(strings, 100, "~y~Sparta's Players: ~r~%d/20",GetOnLinePlayers++());
    TextDrawSetString(OnlineText, strings);
    TextDrawShowForPlayer(playerid, OnlineText);
onplayerdisconnect
Код:
    format(strings, 100, "~y~Sparta's Players: ~r~%d/20",GetOnLinePlayers--());
    TextDrawSetString(OnlineText, strings);
    TextDrawShowForPlayer(playerid, OnlineText);
Reply
#10

use foreach:

PHP код:
format(strings100"~y~Sparta's Players: ~r~%d/20"Iter_Count(Player)); 
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)