if(strcmp(cmd, "/say", true) == 0)
{
if(IsPlayerAdmin(playerid))
{
new tmp[256];
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, 0xFFFFE0AA, "Uso: /say [texto]");
return 1;
}
else
{
if(IsPlayerConnected(playerid))
{
new nome[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, nome, sizeof(nome));
format(str, sizeof(str), "* Admin %s: %s", nome, tmp);
SendClientMessageToAll(0x2587CEAA, str);
}
return 1;
}
}
}
if(strcmp(cmd, "/say", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(IsPlayerAdmin(playerid))
{
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
if(!strlen(result))
{
SendClientMessage(playerid, COLOR_GRAD2, "Uso: /say [texto].");
return 0x01;
}
new nome[MAX_PLAYER_NAME], str[128];
GetPlayerName(playerid, nome, sizeof(nome));
format(str, sizeof(str), "*Admin %s: %s.", nome, (result));
SendClientMessageToAll(0x2587CEAA, str);
}
}
return 1;
}
CMD:say(playerid, params[])
{
new nome[MAX_PLAYER_NAME], str[128], Texto[128];
if(sscanf(params, "s[128]", Texto)) return SendClientMessage(playerid, -1, "/Say [Texto]");
GetPlayerName(playerid, nome, sizeof(nome));
format(str, sizeof(str), "* Admin %s: %s", nome, Texto);
SendClientMessageToAll(0x2587CEAA, str);
return 1;
}
Tente:
PHP код:
|
Funcionou, mas fiz uma corrigida no seu cуdigo, vejo que vocк editou, Obrigado б vocкs que responderam б minha pergunta!
|
pawn Код:
|
if(!strcmp(cmtext,"/say", true))
{
new text[50];
if(!sscanf(cmdtext,"s[50]", text)) SendClientMessageToAll(-1, text);
return 1;
}