Question? (+1 rep for you :))
#1

I want to count the players so I will make:

new players

Код:
public OnPlayerConnect(playerid)
{
 	SendClientMessage(playerid,RED,"Welcome to Player Rights Server");
 	SendClientMessage(playerid,YELLOW,"Admins are here to Help you if they Did anything Wrong Just tell the Owner");
 	SendClientMessageToAll(RED,"A player has Joined the Game");
    new string[128];
	format(string, sizeof(string), "there are Currently %d players online", players);
	SendClientMessage(playerid, -1, string);
	

	return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
 	SendClientMessage(playerid,RED,"Hope to you to Come Back");
 	new string[128];
	format(string, sizeof(string), "there are Currently %d online", players);
	SendClientMessage(playerid, -1, string);

	return 1;
}

okay I want make a New String in onplayerconnect how Can I do that?

When I do a new string onplayerconnect


it get me this Error:

D:\Script\gamemodes\FR.pwn(84) : error 021: symbol already defined: "string"




Help me please!!
Reply
#2

pawn Код:
new sPlay[64];
    format(sPlay, sizeof(sPlay), "*** There are curently players %i/%i online", player_count, GetMaxPlayers());
    SendClientMessageToAll(COLOR_GREY, sPlay);
U can add this on player connect,spawn,disconnect.. etc.
Rep Nao :P
Reply
#3

and add this on player connect
pawn Код:
player_count++;
And this on playerdisconnect
pawn Код:
player_count--;
REEEP!
Reply
#4

remove the new string[128];
theres already one

don't forget to

pawn Код:
//OnPlayerConnect

player++;

//OnPlayerDisconnect

player--;
Quote:
Originally Posted by ProdrifterX
Посмотреть сообщение
pawn Код:
new sPlay[64];
    format(sPlay, sizeof(sPlay), "*** There are curently players %i/%i online", player_count, GetMaxPlayers());
    SendClientMessageToAll(COLOR_GREY, sPlay);
U can add this on player connect,spawn,disconnect.. etc.
Rep Nao :P
Quote:
Originally Posted by ProdrifterX
Посмотреть сообщение
and add this on player connect
pawn Код:
player_count++;
And this on playerdisconnect
pawn Код:
player_count--;
REEEP!
Stop double posting there is edit button
Reply
#5

Quote:
Originally Posted by Andrew97
Посмотреть сообщение
D:\Script\gamemodes\FR.pwn(84) : error 021: symbol already defined: "string"
thats mean you already use string wich same name just re-name other string example "astring"
Reply
#6

Quote:
Originally Posted by RollTi
Посмотреть сообщение
remove the new string[128];
theres already one

don't forget to

pawn Код:
//OnPlayerConnect

player++;

//OnPlayerDisconnect

player--;


Stop double posting there is edit button
Sorry sir.
Reply
#7

Thanks Guys!! but @prodrifter Can you explain for me this Code please BTW your REp is+1
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)