SA-MP Forums Archive
[Help] With some clientmessege [How to do this?] REP+1 !! - 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: [Help] With some clientmessege [How to do this?] REP+1 !! (/showthread.php?tid=314957)



[Help] With some clientmessege [How to do this?] REP+1 !! - ProdrifterX - 01.02.2012

Hello guys...
i need help how to do this like in picture
i need it ingame like this: P
i can do this in randommsg but how to shows players ? i can do this *** Number of players in (nameserver) is (here players) i dont know how to shows players?
help meh pls! thanks!


Uploaded with ImageShack.us

_______________
IP : 188.40.57.132:7777
Drift - Generation



Re: [Help] With some clientmessege [How to do this?] REP+1 !! - milanosie - 01.02.2012

Format a string with the amount of players.
then SendClientMessageToAll(COLOR_GREY, string);


Re: [Help] With some clientmessege [How to do this?] REP+1 !! - ProdrifterX - 01.02.2012

i allrdy do it on sendclientmessagetoall but dont shows players...
can ya help me with format string?
____________________
IP : 188.40.57.132:7777
Drift - Generation



Re: [Help] With some clientmessege [How to do this?] REP+1 !! - milanosie - 01.02.2012

What is your way to check the amount of players online?

I would do: at ongamemodeinit players = 0

Onplayerconnect players = players + 1;
Onplayersdisconnect players = players -1

new string[128];
format(string, sizeof(string), "There are now %d players online!", players);
SendClientMessageToAll(COLOR_GREY, string);


Re: [Help] With some clientmessege [How to do this?] REP+1 !! - MP2 - 01.02.2012

pawn Код:
new player_count; // OUTSIDE ALL CALLBACKS

public OnPlayerConnect(playerid)
{
    player_count++;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    player_count--;
    return 1;
}

// To show the message:
new sPlay[64];
format(sPlay, sizeof(sPlay), "%i/%i players online.", player_count, GetMaxPlayers());
SendClientMessageToAll(COLOR_GREY, sPlay);



Re: [Help] With some clientmessege [How to do this?] REP+1 !! - ProdrifterX - 01.02.2012

MP2 bro thank you so much!


Re: [Help] With some clientmessege [How to do this?] REP+1 !! - -ExG-VirusKiller - 01.02.2012

Hey MP2 I think you have a error in ur code.You have the created the variable as player_count but in onplayerdisconnect u r subtracting 1 from players_online.
What is players_online??


Re: [Help] With some clientmessege [How to do this?] REP+1 !! - MP2 - 01.02.2012

Yes, because a player disconnected.


Re: [Help] With some clientmessege [How to do this?] REP+1 !! - ProdrifterX - 01.02.2012

Quote:

public OnPlayerDisconnect(playerid, reason)
{
players_online--;
return 1;
}

i dont put this 1 cuz it shows error , and without this works perfect..


Re: [Help] With some clientmessege [How to do this?] REP+1 !! - MP2 - 01.02.2012

Well, if you don't put that it's not going to go down when players leave. Sorry, I made a typo. Change players_online to player_count.