Making a command silent, so it wont send message to all.
#1

Hi there so as the title says how do i make a command silent i tried replacing the SendClientMessageToAll with my function SendMessageToAllAdmins but it wont work i need help and who ever explains it +REP. Thank you.

PHP код:
CMD:slap(playerid,params[])
{
    if(
pInfo[playerid][pLogged] == 1)
    {
        if(
pInfo[playerid][pAdminLevel] >= 1)
        {
            new 
targetid,string[256];
            if(
sscanf(params"u"targetid)) return  SendClientMessage(playerid,-1,""chat" /slap [playerid]");
            if(!
IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");
            new 
Float:posxx[3];
            
GetPlayerPos(targetidposxx[0], posxx[1], posxx[2]);
            
SetPlayerPos(targetidposxx[0], posxx[1], posxx[2]+4);
            
format(stringsizeof(string), ""chat""COL_LIGHTBLUE" %s %s has slapped %s",GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid));
            
SendClientMessageToAll(-1,string);
            
printf(" %s %s has slapped %s",GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid));
        }
        else {
            
SendClientMessage(playerid,-1,""chat""COL_LIGHTBLUE" You do not have the right admin permissions for this command!");
        }
    }
    else if(
pInfo[playerid][pLogged] == 0)
    {
        
SendClientMessage(playerid,-1,""chat""COL_LIGHTBLUE" Nice try u fucking fag gay!");
        
printf("%s has been kicked for trying to use a command without being logged in!"PlayerName(playerid));
        
Kick(playerid);
    }
    return 
1;

Reply
#2

pawn Код:
CMD:slap(playerid,params[])
{
    if(pInfo[playerid][pLogged] == 1)
    {
        if(pInfo[playerid][pAdminLevel] >= 1)
        {
            new targetid,string[256];
            if(sscanf(params, "u", targetid)) return  SendClientMessage(playerid,-1,""chat" /slap [playerid]");
            if(!IsPlayerConnected(targetid)) return SendClientMessage(playerid,-1,""chat" Player is not online");

            new Float:posxx[3];

            GetPlayerPos(targetid, posxx[0], posxx[1], posxx[2]);
            SetPlayerPos(targetid, posxx[0], posxx[1], posxx[2]+4);

            format(string, sizeof(string), ""chat""COL_LIGHTBLUE" %s %s has slapped %s",GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid));
            SendAdminMessage(-1,string);
            printf(" %s %s has slapped %s",GetAdminName(playerid),PlayerName(playerid),PlayerName(targetid));
        }
        else {
            SendClientMessage(playerid,-1,""chat""COL_LIGHTBLUE" You do not have the right admin permissions for this command!");
        }
    }
    else if(pInfo[playerid][pLogged] == 0)
    {
        SendClientMessage(playerid,-1,""chat""COL_LIGHTBLUE" Nice try u fucking fag gay!");
        printf("%s has been kicked for trying to use a command without being logged in!", PlayerName(playerid));
        Kick(playerid);
    }
    return 1;
}
pawn Код:
stock SendAdminMessage(color, const string[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(pInfo[i][pAdminLevel] != 0)
    SendClientMessage(i, color, string);
    }
    return 1;
}
EDIT: tell me if u got any error
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)