SA-MP Forums Archive
Problem with my command /id - 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: Problem with my command /id (/showthread.php?tid=345264)



Problem with my command /id - SomebodyAndMe - 24.05.2012

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



Re: Problem with my command /id - SuperViper - 24.05.2012

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


Re: Problem with my command /id - SomebodyAndMe - 25.05.2012

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.


Re: Problem with my command /id - Vince - 25.05.2012

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


Re: Problem with my command /id - vIBIENNYx - 25.05.2012

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


Re: Problem with my command /id - SomebodyAndMe - 25.05.2012

It's already fixed, read the whole topic.


Re: Problem with my command /id - vIBIENNYx - 25.05.2012

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


Re: Problem with my command /id - SomebodyAndMe - 25.05.2012

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


Re: Problem with my command /id - vIBIENNYx - 25.05.2012

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


Re: Problem with my command /id - SomebodyAndMe - 25.05.2012

Sure.

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

EDIT, user has seen it.