dcmd_say(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
new tmp[256], idx;
tmp = strtok(params,idx);
if(!strlen(tmp))
{
SendClientMessage(playerid,COLOR_GREY,"|| Usage: /say (text) ||");
SendClientMessage(playerid,COLOR_GREY,"|| Function: Announces a adminґs text global. ||");
return true;
}
tmp = strrest(params,idx);
new pname2[MAX_PLAYER_NAME], string[256];
GetPlayerName(playerid, pname2, sizeof(pname2));
format(string, sizeof(string), "|| Administrator %s: %s ||", pname2, tmp);
SendClientMessageToAll(COLOR_ORANGE, string);
return true;
}
else return SendClientMessage(playerid, COLOR_RED, "[!] You are not logged into RCON.");
}
dcmd_say(playerid,params[])
{
if(IsPlayerAdmin(playerid))
{
if(!strlen(params))
{
SendClientMessage(playerid,COLOR_GREY,"|| Usage: /say (text) ||");
SendClientMessage(playerid,COLOR_GREY,"|| Function: Announces a adminґs text global. ||");
return true;
}
new pname2[MAX_PLAYER_NAME], string[256];
GetPlayerName(playerid, pname2, sizeof(pname2));
format(string, sizeof(string), "|| Administrator %s: %s ||", pname2, params);
SendClientMessageToAll(COLOR_ORANGE, string);
return true;
}
else return SendClientMessage(playerid, COLOR_RED, "[!] You are not logged into RCON.");
}
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;
}
}
. 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.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;
}
Finally my first script is finished!
Thanks again
|
Originally Posted by Mo3
Thank you very much
Finally my first script is finished! Thanks again |