Whats wrong ?
#1

Hey, I am trying to make a simple "afk" command so if I type it, it will send out that " %s player is away from keyboard!"

This is what I've done:

Код:
COMMAND:afk(playerid,params[])
{
    new string[125]
    format(string, sizeof(string),"{2641FEFF} %s is away from keyboard!", PlayerName(playerid));
    return 1;
}
Errors:

Код:
(14214) : error 001: expected token: ";", but found "-identifier-"
(14214) : error 012: invalid function call, not a valid address
(14214) : warning 215: expression has no effect
(14214) : error 001: expected token: ";", but found ")"
(14214) : fatal error 107: too many error messages on one line
Reply
#2

Here
pawn Код:
COMMAND:afk(playerid,params[])
{
    new string[125];
    format(string, sizeof(string),"{2641FEFF} %s is away from keyboard!", PlayerName(playerid));
    return 1;
}
pawn Код:
COMMAND:afk(playerid,params[])
{
    new string[125];
    format(string, sizeof(string),"{2641FEFF} %s is away from keyboard!", PlayerName(playerid));
    SendAdminMessage(COLOR_RED, 1, string); // maybe usefull
    return 1;
}
Reply
#3

pawn Код:
COMMAND:afk(playerid,params[])
{
    new string[125];
    format(string, sizeof(string),"{2641FEFF} %s is away from keyboard!", PlayerName(playerid));
    return 1;
}
Reply
#4

You guys sent me the same stuff I did and I said it has errors :/
Reply
#5

Quote:
Originally Posted by Jhony_Blaze
Посмотреть сообщение
You guys sent me the same stuff I did and I said it has errors :/
You had this
pawn Код:
new string[125]
But you forgot to place the ; at the end of the line so we changed it to
pawn Код:
new string[125];
Reply
#6

Oh yeah, sorry, but I still get the same errors ...
Reply
#7

You got this
pawn Код:
COMMAND:afk(playerid,params[])
{
    new string[125];
    format(string, sizeof(string),"{2641FEFF} %s is away from keyboard!", PlayerName(playerid));
    return 1;
}
Update it to this
pawn Код:
COMMAND:afk(playerid,params[])
{
    new string[125];
    format(string, sizeof(string),"{2641FEFF} You have set your self Away from keyboard!",);
    SendClientMessage(playerid, COLOR_RED, string);
    return 1;
}
And if it is for admins

pawn Код:
COMMAND:afk(playerid,params[])
{
    new string[125];
    format(string, sizeof(string),"{2641FEFF} %s is away from keyboard!", PlayerName(playerid));
    SendAdminMessage(COLOR_RED, 1, string);
    return 1;
}
Reply
#8

Its alright now. Thanks !
Reply
#9

Quote:
Originally Posted by Jhony_Blaze
Посмотреть сообщение
I still got the same errors I think the problem is somewhere here :

Код:
format(string, sizeof(string),"{2641FEFF} %s is away from keyboard!", PlayerName(playerid));
Send me the list of the errors
Reply
#10

You have just formatted a string, without using it.
Change it to:
pawn Код:
COMMAND:afk(playerid,params[])
{
    new string[125];
    format(string, sizeof(string),"{2641FEFF} %s is away from keyboard!", PlayerName(playerid));
    SendClientMessageToAll(-1,string); // The message will be sent to all the players
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)