Can someone take a look at this?
#1

pawn Код:
command(noteplayer, playerid, params[])
{
    new pid;
    new note[128];
    new string[128];
   
    if( PlayerInfo[playerid][Admin] >= 1)
    {
        if(sscanf(params, "i", pid, note))
        {
            SendClientMessage(playerid, COLOUR_ORANGE, "Hint: /noteplayer (playerid) (note)");
            return 1;
        }
        if(!IsPlayerConnected(pid))
        {
            SendClientMessage(playerid, COLOUR_ORANGE, "That player ID is not connected.");
            return 1;
        }
        format(string, sizeof(string), "%s",note);
        GameTextForPlayer(pid, "~r %s", 10000, 0);
    }
    return 1;
}
No errors or warnings but in game it isn't sending the note. Can anyone spot what is wrong and provide help? :S
Reply
#2

Lol... The script isn't complet.

Try this... not tested, i just wrote it right now. if it doesn0t work, try to replace "i" with "ui" in your script.
pawn Код:
COMMAND:noteplayer(playerid, params[])
{
    new pid;
    new note[128];
    new string[128];
    if(IsPlayerConnected(pid))
    {
    if( PlayerInfo[playerid][Admin] >= 1)
    {
        if(sscanf(params, "ui", pid, note))
            {
        format(string, sizeof(string), "An Admin has sent you a note: %s",note);
        SendClientMessage(playerid, COLOUR_ORANGE, string);
        }          
        else return SendClientMessage(playerid, COLOUR_ORANGE, "You are not an admin.");
    }
    else return SendClientMessage(playerid, COLOUR_ORANGE, "Hint: /noteplayer (playerid) (note)");
    }
    else return SendClientMessage(playerid, COLOUR_ORANGE, "That player id is not connected.");
}
Reply
#3

Thanks for the reply but that won't send the note in the formatting I would like, GameTextForPlayer is the way i would like my note to display, not SendClientMessage.

Again thanks for the reply.
Reply
#4

pawn Код:
command(noteplayer, playerid, params[])
{
    new pid;
    new note[128];
    new string[128];
   
    if( PlayerInfo[playerid][Admin] >= 1)
    {
        if(sscanf(params, "is[128]", pid, note)) //You forgot to add the "s" , and the [128] is the size
        {
            SendClientMessage(playerid, COLOUR_ORANGE, "Hint: /noteplayer (playerid) (note)");
            return 1;
        }
        if(!IsPlayerConnected(pid))
        {
            SendClientMessage(playerid, COLOUR_ORANGE, "That player ID is not connected.");
            return 1;
        }
        format(string, sizeof(string), "~r %s",note);
        GameTextForPlayer(pid, string , 10000, 0); //You use the string we formatted for the text
    }
    return 1;
}
Untested, but should work.
Reply
#5

No it didn't work, it made the money in the top right hand corner vanish and then it came back as a green square. Also when i pressed Esc, where the writting should be is white squares.
Reply
#6

pawn Код:
command(noteplayer, playerid, params[])
{
    new pid;
    new note[128];
    new string[128];

    if(sscanf(params, "is[128]", pid, note)) return SendClientMessage(playerid, COLOUR_ORANGE, "Hint: /noteplayer (playerid) (note)");
    if(!IsPlayerConnected(pid)) return SendClientMessage(playerid, COLOUR_ORANGE, "That player ID is not connected.");
   
    format(string, sizeof(string), "~r~ %s",note);
    GameTextForPlayer(pid, string , 10000, 0);
   
    return 1;
}
This works 100%, tested.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)