SA-MP Forums Archive
Doesnt send message. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Doesnt send message. (/showthread.php?tid=506023)



Doesnt send message. - Laure - 11.04.2014

Hi there my server has no system to return message if someone enters an unavailable command i tried to make one but didnt work heres my try:
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    new string[128];
    format(string, sizeof(string), "[cmd] [%s]: %s", GetPlayerName(playerid), cmdtext);
    print(string);
    if(!success)
    {
        SendClientMessage(playerid, COLOR_GREY, "** Sorry you have entered a command that doesnt exist.");
    }

    return 1;
}
Please help me out.


Re: Doesnt send message. - iZN - 11.04.2014

pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    new string[128];
    format(string, sizeof(string), "[cmd] [%s]: %s", GetPlayerName(playerid), cmdtext);
    print(string);
    if(!success)
    {
        SendClientMessage(playerid, COLOR_GREY, "** Sorry you have entered a command that doesnt exist.");
        return true;
    }

    return 1;
}



Re: Doesnt send message. - Laure - 11.04.2014

not working?


Re: Doesnt send message. - iZN - 11.04.2014

Quote:
Originally Posted by Imperor
Посмотреть сообщение
not working?
What is not actually working? Any errors coming up?


Re: Doesnt send message. - Konstantinos - 11.04.2014

https://sampwiki.blast.hk/wiki/GetPlayerName

It's stored to an array, it doesn't return the name directly.

pawn Код:
new string[64];
GetPlayerName(playerid, string, 21);
format(string, sizeof(string), "[cmd] [%s]: %s", string, cmdtext);



Re: Doesnt send message. - gekas - 11.04.2014

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
https://sampwiki.blast.hk/wiki/GetPlayerName

It's stored to an array, it doesn't return the name directly.

pawn Код:
new string[64];
GetPlayerName(playerid, string, 21);
format(string, sizeof(string), "[cmd] [%s]: %s", string, cmdtext);
This is the really.


Re: Doesnt send message. - BroZeus - 11.04.2014

this
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success) return SendClientMessage(playerid, 0xFF0000FF, "This command does not exist! Please use /cmds to view a list of available commands.");//edit this line as per as your needs
    return 1;
}



Re: Doesnt send message. - Laure - 13.04.2014

Quote:
Originally Posted by BroZeus
Посмотреть сообщение
this
pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
    if(!success) return SendClientMessage(playerid, 0xFF0000FF, "This command does not exist! Please use /cmds to view a list of available commands.");//edit this line as per as your needs
    return 1;
}
neither worked.


Re: Doesnt send message. - PrivatioBoni - 13.04.2014

pawn Код:
public OnPlayerCommandPerformed(playerid, cmdtext[], success)
{
        switch(success)
        {
            case 0:
            {
                new string[64];
                format(string, sizeof(string), "%s is an invalid command.", cmdtext);
                return SendClientMessage(playerid, COLOR_RED, string);
            }

        }

        return 1;
}