Doesnt send message.
#1

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.
Reply
#2

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;
}
Reply
#3

not working?
Reply
#4

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

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);
Reply
#6

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.
Reply
#7

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;
}
Reply
#8

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.
Reply
#9

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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)