Sending success message back
#1

Not sure if the topic says its name but

What I mean is when a admin does a command it sends him a message back with a sendclientmessage that he did that to a player for example:

I have a freeze command but I want to add a sendclientmessage back to the admin saying he successfully frozen this player, which I do think should look like
pawn Код:
format( str, sizeof ( str ),"[SUCCESS] You have frozen %s successfully);
    SendClientMessage( playerid, COLOR_LIGHTGREEN -1, str );
and than back one in unmute command, (not sure about the format just a rough thing what I think it would look like.)
Here is the command its self:
pawn Код:
COMMAND:freeze(playerid, params[])
{
    if (MasterAccount[playerid][mSuperAdmin] || Character[playerid][cAdminLevel] >= 1)
    if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SYNTAX]: : /freeze [playerid]");
    if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Invalid player id");
    if(IsFrozen[playerb]) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Player is already frozen.");
    IsFrozen[playerb] = 1;
    GetPlayerPos(playerb, FX[playerb], FY[playerb], FZ[playerb]);
    SendClientMessage(playerb, COLOR_RED, "[INFO]: You have been frozen!");
    return 1;
}
Anyone could explain to me how to do it?

Thanks a bunch
Reply
#2

Yes, the first one is almost right.

pawn Код:
// freeze command

new string[128], name[24];

GetPlayerName(playerb,name,24); // getting the name of the target (playerb)

format(string,128,"You Have Successfully Frozen Player %s (%d)",name,playerb); // name, id of playerb
SendClientMessage(playerid,-1,string); // sending the above message to the admin

// unfreeze command

new string[128], name[24];

GetPlayerName(playerb,name,24); // getting the name of the target (playerb)

format(string,128,"You Have Successfully Unfrozen Player %s (%d)",name,playerb); // name, id of playerb
SendClientMessage(playerid,-1,string);
playerid = The default ID
playerb = target ID (in your case)
Reply
#3

Quote:
Originally Posted by grand.Theft.Otto
Посмотреть сообщение
Yes, the first one is almost right.

pawn Код:
// mute command

new string[128], name[24];

GetPlayerName(playerb,name,24); // getting the name of the target (playerb)

format(string,128,"You Have Successfully Frozen Player %s (%d)",name,playerb); // name, id of playerb
SendClientMessage(playerid,-1,string); // sending the above message to the admin

// unmute command

new string[128], name[24];

GetPlayerName(playerb,name,24); // getting the name of the target (playerb)

format(string,128,"You Have Successfully Unfrozen Player %s (%d)",name,playerb); // name, id of playerb
SendClientMessage(playerid,-1,string);
playerid = The default ID
playerb = target ID (in your case)
Uhh kinda confusing to add it if you ask me.

Mind doing a favor and putting it together?
Sorry for asking that if not thats fine thanks for help I will try playing around with it... I guess

EDIT: Don't mind I got it
Reply
#4

Oops, for the green //commented lines , I put mute/unmute command, I meant freeze/unfreeze

For the freeze command:

pawn Код:
COMMAND:freeze(playerid, params[])
{
    if(MasterAccount[playerid][mSuperAdmin] || Character[playerid][cAdminLevel] >= 1)
    {
        if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SYNTAX]: : /freeze [playerid]");
        if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Invalid player id");
        if(IsFrozen[playerb]) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Player is already frozen.");

        IsFrozen[playerb] = 1;

        GetPlayerPos(playerb, FX[playerb], FY[playerb], FZ[playerb]);

        SendClientMessage(playerb, COLOR_RED, "[INFO]: You have been frozen!");
       
        new string[128], name[24];
        GetPlayerName(playerb,name,24); // getting the name of the target (playerb)
       
        format(string,128,"You Have Successfully Frozen Player %s (%d)",name,playerb); // name, id of playerb
        SendClientMessage(playerid,-1,string); // sending the above message to the admin
    }
    return 1;
}
For the unfreeze command:

pawn Код:
new string[128], name[24];

GetPlayerName(playerb,name,24); // getting the name of the target (playerb)

format(string,128,"You Have Successfully Unfrozen Player %s (%d)",name,playerb); // name, id of playerb
SendClientMessage(playerid,-1,string);
^ Put that in the /unfreeze command, just like I did in your /freeze command
Reply
#5

Quote:
Originally Posted by grand.Theft.Otto
Посмотреть сообщение
Oops, for the green //commented lines , I put mute/unmute command, I meant freeze/unfreeze

For the freeze command:

pawn Код:
COMMAND:freeze(playerid, params[])
{
    if(MasterAccount[playerid][mSuperAdmin] || Character[playerid][cAdminLevel] >= 1)
    {
        if(sscanf(params, "u", playerb)) return SendClientMessage(playerid, COLOR_LIGHTBLUE, "[SYNTAX]: : /freeze [playerid]");
        if(!IsPlayerConnected(playerb)) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Invalid player id");
        if(IsFrozen[playerb]) return SendClientMessage(playerid, COLOR_RED, "[ERROR]: Player is already frozen.");

        IsFrozen[playerb] = 1;

        GetPlayerPos(playerb, FX[playerb], FY[playerb], FZ[playerb]);

        SendClientMessage(playerb, COLOR_RED, "[INFO]: You have been frozen!");
       
        new string[128], name[24];
        GetPlayerName(playerb,name,24); // getting the name of the target (playerb)
       
        format(string,128,"You Have Successfully Frozen Player %s (%d)",name,playerb); // name, id of playerb
        SendClientMessage(playerid,-1,string); // sending the above message to the admin
    }
    return 1;
}
For the unfreeze command:

pawn Код:
new string[128], name[24];

GetPlayerName(playerb,name,24); // getting the name of the target (playerb)

format(string,128,"You Have Successfully Unfrozen Player %s (%d)",name,playerb); // name, id of playerb
SendClientMessage(playerid,-1,string);
^ Put that in the /unfreeze command, just like I did in your /freeze command
Yea I already have unfreeze cmd I just needed the message being sended back and got it working my self sorry for taking your time! And thanks a lot again!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)