A problem with this.
#1

Well, I follow the guide about OnPlayerText, but it shows black in the chat! How to fix it?

pawn Код:
public OnPlayerText(playerid, text[])
{
    new name[MAX_PLAYER_NAME], msg[128];
    GetPlayerName(playerid, name, sizeof(name));
    format(msg, sizeof(msg), "%s: [%d] %s", name, playerid, text);
    SendClientMessageToAll(playerid, msg);
    return 0;
}
Reply
#2

pawn Код:
SendClientMessageToAll(color, const message[]);
...color, not playerid - its all players, hehe
Reply
#3

It shows me error:

Код:
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(4810) : error 017: undefined symbol "color"
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(4810) : error 029: invalid expression, assumed zero
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(4810) : error 017: undefined symbol "message"
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(4810) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Reply
#4

Quote:
Originally Posted by LeeXian99
Посмотреть сообщение
It shows me error:

Код:
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(4810) : error 017: undefined symbol "color"
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(4810) : error 029: invalid expression, assumed zero
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(4810) : error 017: undefined symbol "message"
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(4810) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


4 Errors.
Change

pawn Код:
SendClientMessageToAll(playerid, msg);
To this

pawn Код:
SendClientMessageToAll(-1, msg);
Reply
#5

Yes, thank you, but what I should do if I want the name color sent to SendClientMessageToAll.
Like this:

Xian: [0] Test *Black = White in server.
Someone: [1] Hello!
Reply
#6

Quote:
Originally Posted by LeeXian99
Посмотреть сообщение
Yes, thank you, but what I should do if I want the name color sent to SendClientMessageToAll.
Like this:

Xian: [0] Test *Black = White in server.
Someone: [1] Hello!
Change it to this:

pawn Код:
public OnPlayerText(playerid, text[])
{
    new name[MAX_PLAYER_NAME], msg[128];
    GetPlayerName(playerid, name, sizeof(name));
    format(msg, sizeof(msg), "%s:{FFFFFF} [%d] %s", name, playerid, text);
    SendClientMessageToAll(0x44FF00FF, msg);
    return 0;
}
Reply
#7

What about this? I want it become one command, I am too lazy to separate it. :/

pawn Код:
CMD:cmds(playerid,params[])
{
    new string[512];
    format(string, sizeof(string),"/kill - Suicide\n/car - Spawns a car\n/tcar - Spawns a pre-tuned car\n/fix - Fix a car\n/nos - Add nitrous on your car\n/xnos - Remove nitrous from your car\n/godcar - Make the car god\n/teles - Teleports\n/updates - Check the current update\n/website - Our forum!\n/gps - Find the player\n/setmytime - Set your time\n/radio - Play radio\n/music(2) - Play music\n/stop - Stop everything that you're playing\n/pc - Parachute.\n/respawn - Respawn\n/healme - Heal yourself (free)");
    ShowPlayerDialog, playerid, 1, DIALOG_STYLE_MSGBOX, "Commands", string, "OK", "");
    return 1;
}
Error:
Код:
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(5308) : error 075: input line too long (after substitutions)
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(5311) : error 076: syntax error in the expression, or invalid function call
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(5311) : error 029: invalid expression, assumed zero
C:\Users\Kelvin\Desktop\Scripting\gamemodes\racerevolution.pwn(5311) : warning 215: expression has no effect
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
Reply
#8

pawn Код:
CMD:cmds2(playerid,params[])
{
    new string[512];
    new longstring[512];
    format(string, sizeof(string),"/kill - Suicide\n/car - Spawns a car\n/tcar - Spawns a pre-tuned car\n/fix - Fix a car\n/nos - Add nitrous on your car\n");
    strcat(longstring,string,sizeof(longstring));
    format(string, sizeof(string),"/xnos - Remove nitrous from your car\n/godcar - Make the car god\n/teles - Teleports\n/updates - Check the current update\n/website - Our forum!\n");
    strcat(longstring,string,sizeof(longstring));
    format(string, sizeof(string),"/gps - Find the player\n/setmytime - Set your time\n/radio - Play radio\n/music(2) - Play music\n/stop - Stop everything that you're playing\n");
    strcat(longstring,string,sizeof(longstring));
    format(string, sizeof(string),"/pc  - Parachute\n/respawn - Respawn\n/healme - Heal yourself (free)");
    strcat(longstring,string,sizeof(longstring));
    ShowPlayerDialog(playerid, 1, DIALOG_STYLE_MSGBOX, "Commands", longstring, "OK", "");
    return 1;
}
...tested, works
Reply
#9

Quote:
Originally Posted by FunnyBear
Посмотреть сообщение
Change it to this:

pawn Код:
public OnPlayerText(playerid, text[])
{
    new name[MAX_PLAYER_NAME], msg[128];
    GetPlayerName(playerid, name, sizeof(name));
    format(msg, sizeof(msg), "%s:{FFFFFF} [%d] %s", name, playerid, text);
    SendClientMessageToAll(0x44FF00FF, msg);
    return 0;
}
No, not this, I mean follow the colors of a player.
Reply
#10

Quote:
Originally Posted by LeeXian99
Посмотреть сообщение
No, not this, I mean follow the colors of a player.
pawn Код:
SendClientMessageToAll(GetPlayerColor(playerid), msg);
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)