Problem with my command /id
#1

Hey there I got a problem with the following command, it doesn't show up when you execute the command.

pawn Код:
COMMAND:id(playerid,params[])
{
    new Msg[128], Name, Msgname[24]; // Gives the variables for the /id command
    if (sscanf(params, "u", Name)) // Check if the player has typed the command correctly
        SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/id <Part of name/name>\""); // else send how it should be.
   
    if (IsPlayerConnected(Name)) // Check if the other player is connected
    {
        GetPlayerName(Name, Msgname, sizeof(Msgname));
        format(Msg, 128, "Name/ID is: %s(%i)", Msgname, Name);
    }

    return 1;
}
Reply
#2

Your code was more efficient. The only problem was you didn't send the message after formatting the string.
Reply
#3

Quote:
Originally Posted by SuperViper
Посмотреть сообщение
Your code was more efficient. The only problem was you didn't send the message after formatting the string.
Oh yeah I see, but still, there was also an error in my server console, after executing the command.
sccanf error.
Reply
#4

If it's the 'system not initialized' error then it means that you didn't properly compile your gamemode with the latest include file.
Reply
#5

pawn Код:
COMMAND:id(playerid,params[])
{
    new Msg[128], Name, Msgname[24]; // Gives the variables for the /id command
    if (sscanf(params, "u[24]", Name)) // Check if the player has typed the command correctly
    {
        SendClientMessage(playerid, 0xFF0000AA, "Usage: \"/id <Part of name/name>\""); // else send how it should be.
    }
    else
    {  
       if (IsPlayerConnected(Name)) // Check if the other player is connected
       {
           GetPlayerName(Name, Msgname, sizeof(Msgname));
           format(Msg, 128, "Name/ID is: %s(%i)", Msgname, Name);
           SendClientMessage(playerid, 0xFF0000AA, Msg);
       }
    }
    return 1;
}
Try that..
Reply
#6

It's already fixed, read the whole topic.
Reply
#7

Quote:
Originally Posted by SomebodyAndMe
Посмотреть сообщение
It's already fixed, read the whole topic.
He still has the sscanf error, which I attempted to fix.
Reply
#8

Well, someone posted a script, but removed it after it, I have that in my script right now, without any error.
Reply
#9

May I see it please? I'm curious to see as to whether I was right or wrong..
Reply
#10

Sure.

Credits goes to the user who made it(forgot the name)

EDIT, user has seen it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)