Posts: 569
Threads: 170
Joined: Apr 2009
Reputation:
0
The text still doesnt want to show up..
Posts: 6,129
Threads: 36
Joined: Jan 2009
You'll need sscanf, and you don't need 256 cells, use 128.
pawn Код:
dcmd_say(playerid, params[])
{
new message[128], string[128], name[MAX_PLAYER_NAME];
if (sscanf(params, "s", message)) SendClientMessage(playerid, COLOR_WHITE, "SYNTAX - /say [message]");
else
{
if(IsPlayerAdmin(playerid))
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "RCON Admin %s: %s.", name, message); // You will probably want to re-format this.
SendClientMessageToAll(COLOR_ORANGE, string);
}
else
{
SendClientMessage(playerid, COLOR_ORANGE, "You're not an RCON administrator.");
}
return 1;
}
}
Posts: 569
Threads: 170
Joined: Apr 2009
Reputation:
0
C:\Dokumente und Einstellungen\Moritz\Desktop\WW3\ad. rcon admin system\advancedrconadmin.pwn(210) : error 017: undefined symbol "sscanf"
C:\Dokumente und Einstellungen\Moritz\Desktop\WW3\ad. rcon admin system\advancedrconadmin.pwn(225) : warning 209: function "dcmd_say" should return a value
Huh`?
Posts: 6,129
Threads: 36
Joined: Jan 2009
This will work
. I put the return in the wrong part, anyway, so you have sscanf now? Good, it's much easier to use it and more efficient.
pawn Код:
dcmd_say(playerid, params[])
{
new message[128], string[128], name[MAX_PLAYER_NAME];
if (sscanf(params, "s", message)) SendClientMessage(playerid, COLOR_WHITE, "SYNTAX - /say [message]");
else
{
if(IsPlayerAdmin(playerid))
{
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string), "RCON Admin %s: %s.", name, message); // You will probably want to re-format this.
SendClientMessageToAll(COLOR_ORANGE, string);
}
else
{
SendClientMessage(playerid, COLOR_ORANGE, "You're not an RCON administrator.");
}
}
return 1;
}
Posts: 6,129
Threads: 36
Joined: Jan 2009
Quote:
Originally Posted by Mo3
Thank you very much Finally my first script is finished! Thanks again
|
No problem, have fun scripting. I highly suggest you review SSCANF (
https://sampwiki.blast.hk/wiki/Dcmd) as it's a much more efficient way of scripting, also easier.