20.08.2014, 07:20
Well i was making a tag like Deadly(0) when the player chat's but all of it just messed up my gamemode
So, I was Just Wondering how to add it?
So, I was Just Wondering how to add it?
public OnPlayerText(playerid, text[])
{
new pText[128];
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName,sizeof(pName));
if(GetPlayerScore(playerid) == 1000)
{
format(pText, sizeof (pText), "%s (ID: %d) [{#FF0000}Deadly{FFFFFF}]: %s", pName, playerid, text);
SendPlayerMessageToAll(playerid, pText);
}
else
{
format(pText, sizeof (pText), "%s (ID: %d): %s",pName, playerid, text);
SendPlayerMessageToAll(playerid, pText);
}
return 0; // ignore the default text and send the custom one
}
public OnPlayerText(playerid, text[])
{
new pText[160];
new pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName,sizeof(pName));
if(GetPlayerScore(playerid) >= 1000)
{
format(pText, sizeof (pText), "{%06x}%s (ID: %d) [{FF0000}%s{FFFFFF}]: {FFFFFF}%s", GetPlayerColor(playerid) >>> 8, pName, playerid, GetTagFromScore(playerid), text);
SendClientMessageToAll(-1, pText);
}
else
{
format(pText, sizeof (pText), "{%06x}%s (ID: %d): {FFFFFF}%s", GetPlayerColor(playerid) >>> 8, pName, playerid, text);
SendClientMessageToAll(-1, pText); // CLIENT message not PLAYER message.
// Player messages are "Name: your formatted string"
// Client messages are "your formatted string"
}
return 0;
}
GetTagFromScore(playerid)
{
new string[32];
switch(GetPlayerScore(playerid))
{
case 1000: format(string, sizeof (string), "Deadly");
case 2000: format(string, sizeof (string), "what ever you want");
// ...
}
return string;
}
Cannary2048's code will work (Note change player message to client mesage)
But making a function that gets the tag from the score would be easier if you want to use them somewhere else. pawn Код:
|
new string[144];
format(string, sizeof (string), "{FF0000}Deadly(%i): %s", playerid, text);
SendClientMessageToAll(-1, string);