13.04.2009, 20:50
Okey, i tryed this code and added taked oway all the errors but when i type /a text i get command not found. But then i just type /a i get [ADMIN]Name[lvl thing]:/a ..
Here is the code without error:
Here is the code without error:
pawn Код:
if(strcmp(cmdtext, "/a", true) == 0)
{
new idx;
if(dini_Int(file, "admin") <1) return SendClientMessage(playerid, COLOR_YELLOW, "You are not admin!");
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)) return SendClientMessage(playerid, COLOR_YELLOW, "Usage: /a [ur txt here]");
new pname3[256];
new string[256];
GetPlayerName(playerid, pname3, sizeof(pname3));
format(string,sizeof(string),"[ADMIN]: %s (lvl:%d): %s", pname3, PlayerInfo[playerid][Admin], result);
for(new i=0;i<MAX_PLAYERS;i++)
{
if(dini_Int(file, "admin") >= 1)
SendClientMessage(i,COLOR_ORANGE,string);
}
return 1;
}