Can someone take a look at this? -
cloudysky - 11.06.2011
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
Re: Can someone take a look at this? -
ricardo178 - 11.06.2011
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.");
}
Re: Can someone take a look at this? -
cloudysky - 12.06.2011
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.
Re: Can someone take a look at this? -
PrawkC - 12.06.2011
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.
Re: Can someone take a look at this? -
cloudysky - 12.06.2011
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.
Re: Can someone take a look at this? -
PrawkC - 12.06.2011
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.