08.10.2010, 08:11
Hello guys how i want to make when player use commands /ask send client message for admins only i can see it only like lets do /ask for player want help from admins ok and only the admins get it
COMMAND:ask(playerid,params[])
{
new str[128];
if(sscanf(params,"s[128]",str))return SendClientMessage(playerid,0xff0000ffFF,"Error: Usage /ask [message]");
{
for(new i; i < MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i) || !IsPlayerAdmin(i))continue;
else
{
format(str,sizeof(str),"(%d)%s asks: %s?",playerid,playername(playerid),str);
SendClientMessage(i,0x00ff00AA,str);
}
}
}
return 1;
}
stock playername(playerid)//preferably put this way down at the bottom of the script although it doesn't realy matter.
{
new pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
return pname;
}
COMMAND:ask(playerid,params[])
{
if(!strlen(params))return SendClientMessage(playerid,0xff0000ffFF,"Error: Usage /ask [message]");
{
for(new i; i < MAX_PLAYERS;i++)
{
if(!IsPlayerConnected(i) || !IsPlayerAdmin(i))continue;
else
{
format(params,128,"(%d)%s asks: %s?",playerid,playername(playerid),params);
SendClientMessage(i,0x00ff00AA,str);
}
}
}
return 1;
}
I know its just what i'm used to i should have used params only
![]() Like this pawn Код:
|
Originally Posted by LarzI
Wrong.
|
Isnull is a seperate function which i don't use. Its not wrong at all. If it was inefficient beyond beleif i'd understand but that won't real make a difference on performance at all, its one command.
|