public OnPlayerText(playerid, text[])
{
SetPlayerChatBubble(playerid, text, C_WHITE, 100.0, 10000);
}
new text[128];
new string[128];
format(string, sizeof(string), "** %s %s [%d]: %s", ClassName(playerid), Name(playerid), playerid, text);
foreach(Player, i)
}
return 1;
}
... can you show more of the code please? This doesn't really seem to give the full picture.
Also, include the ClassName function you're using. |
stock RankName(playerid)
{
new rank = Rank(playerid);
new rankname[24];
if(rank == 1) rankname = RANK1NAME;
if(rank == 2) rankname = RANK2NAME;
if(rank == 3) rankname = RANK3NAME;
if(rank == 4) rankname = RANK4NAME;
if(rank == 5) rankname = RANK5NAME;
if(rank == 6) rankname = RANK6NAME;
if(rank == 7) rankname = RANK7NAME;
if(rank == 8) rankname = RANK8NAME;
if(rank == 9) rankname = RANK9NAME;
if(rank == 10) rankname = RANK10NAME;
if(rank == 11) rankname = RANK11NAME;
if(rank == 12) rankname = RANK12NAME;
if(rank == 13) rankname = RANK13NAME;
if(rank == 14) rankname = RANK14NAME;
return rankname;
}
if(rank == 1) {format(rankname,24,"%s",RANK1NAME);}
CMD:r(playerid, params[])
{
new text[128];
if(sscanf(params, "s[128]", text)) return SendClientMessage(playerid, C_GREY, "USAGE: /r [text]");
new string[128];
format(string, sizeof(string), "** %s %s [%d]: %s **", ClassName(playerid), Name(playerid), playerid, text);
foreach(Player, i)
{
if(gTeam[playerid] == gTeam[i])
{
SendClientMessage(i, C_RADIOBLUE, string);
}
}
return 1;
}
You can't do somestring = "thisword", you need to format it.
In this case, you'd do pawn Код:
|
stock RankName(playerid) // returns the rankname on success, or 0/false on failure
{
switch(Rank(playerid))
{
case 1: return RANK1NAME;
case 2: return RANK2NAME;
case 3: return RANK3NAME;
case 4: return RANK4NAME;
case 5: return RANK5NAME;
case 6: return RANK6NAME;
case 7: return RANK7NAME;
case 8: return RANK8NAME;
case 9: return RANK9NAME;
case 10: return RANK10NAME;
case 11: return RANK11NAME;
case 12: return RANK12NAME;
case 13: return RANK13NAME;
case 14: return RANK14NAME;
}
return false;
}
public OnPlayerText(playerid, text[])
{
SetPlayerChatBubble(playerid, text, C_WHITE, 100.0, 10000);
new
text[128],
string[128]
;
format(string, sizeof(string), "** %s %s [%d]: %s", RankName(playerid), Name(playerid), playerid, text);
SendClientMessageToAll(C_WHITE, string);
return 0;
}
warning 219: local variable "text" shadows a variable at a preceding level
text[128],
@Realcop - I added your RankName stock instead of mine, and replaced your OnPlayerText with mine, but my compiler crashed.
I put back my original stock, and only added your OnPlayerText, and i only got 1 warning. pawn Код:
pawn Код:
|
public OnPlayerText(playerid, text[]) //In the callback header here
{
SetPlayerChatBubble(playerid, text, C_WHITE, 100.0, 10000);
new
text[128], //And you're also defining it here, how will the compiler know which one from which?
string[128]
;
format(string, sizeof(string), "** %s %s [%d]: %s", RankName(playerid), Name(playerid), playerid, text);
SendClientMessageToAll(C_WHITE, string);
return 0;
}
public OnPlayerText(playerid, text[]) //In the callback header here
{
SetPlayerChatBubble(playerid, text, C_WHITE, 100.0, 10000);
new
string[128]
;
format(string, sizeof(string), "** %s %s [%d]: %s", RankName(playerid), Name(playerid), playerid, text);
SendClientMessageToAll(C_WHITE, string);
return 0;
}