What am I doing wrong
#1

What did I do wrong here

pawn Код:
CMD:test(playerid,params[])
{
    new string[128];
    format(string, sizeof(string), "%s used /test command", GetName(playerid));
    SendClientMessage(playerid, COLOR_YELLOW, string);
    return true;
}

stock GetName(playerid)
{
    new string[MAX_PLAYER_NAME];
    GetPlayerName(playerid,string,sizeof(string));
    return string;
}
Reply
#2

Nothing wrong? what are you trying to do? Send this message to admins or what or what is your problem?
Reply
#3

I am just trying to output
pawn Код:
format(string, sizeof(string), "%s used /test command", GetName(playerid));
Its not being outputed lol
Reply
#4

It sends the message to yourself, but not everyone.

Change "SendClientMessage(playerid," to "SendClientMessageToAll(".
Reply
#5

I know it does. Everything stopped outputing stuff out. Its not displaying any messages I send.
I just added Whirlpool plugin few mins ago and everything stoped being outputed.
Reply
#6

Plugin doesn't matter, Also it works fine for me


I don't know what is the usage of this command but as you like try to debug
pawn Код:
CMD:test(playerid,params[])
{
    printf("%s used /test command",GetName(playerid));
    return true;
}
now check your server console if you are able to see this message that means everything is fine
Reply
#7

Tried. I even got a blank script outputing it normaly but once I add whirlpool it stops outputing stuff lmfao
Reply
#8

Are you sure your whirlpool is not outdated? Also i dont think so whirlpool has anything to do with it.
It should work normally as you said using the following code.
pawn Код:
CMD:test(playerid,params[])
{
    new string[128];
    format(string, sizeof(string), "%s used /test command", GetName(playerid));
    SendClientMessageToAll(playerid, COLOR_YELLOW, string);
    return true;
}
Reply
#9

Quote:
Originally Posted by Imperor
Посмотреть сообщение
Are you sure your whirlpool is not outdated? Also i dont think so whirlpool has anything to do with it.
It should work normally as you said using the following code.
pawn Код:
CMD:test(playerid,params[])
{
    new string[128];
    format(string, sizeof(string), "%s used /test command", GetName(playerid));
    SendClientMessageToAll(playerid, COLOR_YELLOW, string);
    return true;
}
Your cmd is wrong. "SendClientMessageToAll" doesn't have a playerid parameter.

pawn Код:
CMD:test(playerid,params[])
{
    new string[128];
    format(string, sizeof(string), "%s used /test command", GetName(playerid));
    SendClientMessageToAll(COLOR_YELLOW, string);
    return 1;
}
Quote:
Originally Posted by SeniorGamer
Посмотреть сообщение
What did I do wrong here

pawn Код:
CMD:test(playerid,params[])
{
    new string[128];
    format(string, sizeof(string), "%s used /test command", GetName(playerid));
    SendClientMessage(playerid, COLOR_YELLOW, string);
    return true;
}

stock GetName(playerid)
{
    new string[MAX_PLAYER_NAME];
    GetPlayerName(playerid,string,sizeof(string));
    return string;
}
This is a common problem, witch is very easy to fix. You're formating "string" and "string" in the command and stock, just change the name of "string" in the stock.

pawn Код:
stock GetName(playerid)
{
    new stockstring[MAX_PLAYER_NAME];
    GetPlayerName(playerid, stockstring, sizeof(stockstring));
    return stockstring;
}
And the whole code would look like this:
pawn Код:
CMD:test(playerid,params[])
{
    new string[128];
    format(string, sizeof(string), "%s used /test command", GetName(playerid));
    SendClientMessageToAll(COLOR_YELLOW, string);
    return 1;
}

stock GetName(playerid)
{
    new stockstring[MAX_PLAYER_NAME];
    GetPlayerName(playerid, stockstring, sizeof(stockstring));
    return stockstring;
}
Reply
#10

Quote:
Originally Posted by SickAttack
This is a common problem, witch is very easy to fix. You're formating "string" and "string" in the command and stock, just change the name of "string" in the stock.
This would be true if 'string' was a global variable, but it isn't. It's local in both functions and won't be changed by any outside callback or function. The code is fine, but something is stopping it from sending? I don't see what could cause that, and I find it even harder to see how the Whirlpool plugin stops it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)