Problem with my /o Command
#1

Hello guys. I have a problem with my /o command. When i type /o Hello, it says ''USAGE: /o <TEXT>''. I cant say anything, it keeps saying how i need to use it. Can anyone fix this for me please? I really need it. Here's the Code:

Код:
COMMAND:o(playerid,params[])
{
    new str[128];
    if(sscanf(params,"s[128]",str)) return SendClientMessage(playerid,-1,"USAGE: /o [TEXT]");
    new name[20];
    GetPlayerName(playerid,name,20);
    format(str,sizeof(str),"[OOC CHAT] %s[ID :%d] : %s",name,playerid,str);
    SendClientMessageToAll(-1,str);
    return 1;
}
Reply
#2

Works fine for me.

Cross check the following
  • You have ssancf2
  • You have added this in your server.cgf
    Код:
    plugins sscanf
Reply
#3

Add this to your stocks:
pawn Код:
stock GetPlayersName(playerid)
{
    new playersName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playersName, MAX_PLAYER_NAME);
    for(new i = 0; i < strlen(playersName); i++)
    {
        if(playersName[i] == '_') playersName[i] = ' ';
    }
    return playersName;
}
And this is the cmd:
pawn Код:
CMD:o(playerid, params[])
{
    if(isnull(params)) return SendClientMessage(playerid, COLOR_GREY, "USAGE: /o [TEXT]");

    new string[126];
    format(string, sizeof(string), "(( %s: %s ))", GetPlayersName(playerid), params);
    SendClientMessageToAll(COLOR_WHITE, string);
    return 1;
}
Reply
#4

I do not have any stocks, where do i need to put the stock? Under OnGameModeInit?
Reply
#5

Quote:
Originally Posted by CrazyManiac
Посмотреть сообщение
I do not have any stocks, where do i need to put the stock? Under OnGameModeInit?
Anywhere in your script.
Reply
#6

Okay, thank you so much guys
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)